better ui_draw() (#1432)

* better ui_draw()

* fix missed border

reduce code

remove white line
old-commit-hash: 3fe3afeede
commatwo_master
Dean Lee 5 years ago committed by GitHub
parent 22b70c7394
commit 40dfc4874b
  1. 31
      selfdrive/ui/paint.cc
  2. 3
      selfdrive/ui/sidebar.cc

@ -881,15 +881,11 @@ static void ui_draw_vision(UIState *s) {
glEnable(GL_SCISSOR_TEST);
glViewport(ui_viz_rx+ui_viz_ro, s->fb_h-(box_y+box_h), viz_w, box_h);
glScissor(ui_viz_rx, s->fb_h-(box_y+box_h), ui_viz_rw, box_h);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
draw_frame(s);
glViewport(0, 0, s->fb_w, s->fb_h);
glDisable(GL_SCISSOR_TEST);
glClear(GL_STENCIL_BUFFER_BIT);
glViewport(0, 0, s->fb_w, s->fb_h);
nvgBeginFrame(s->vg, s->fb_w, s->fb_h, 1.0f);
// Draw augmented elements
if (!scene->frontview && !scene->fullview) {
ui_draw_world(s);
@ -909,9 +905,6 @@ static void ui_draw_vision(UIState *s) {
} else {
if (!scene->frontview){ui_draw_vision_footer(s);}
}
nvgEndFrame(s->vg);
glDisable(GL_BLEND);
}
static void ui_draw_background(UIState *s) {
@ -925,28 +918,16 @@ static void ui_draw_background(UIState *s) {
void ui_draw(UIState *s) {
ui_draw_background(s);
if (s->started && s->active_app == cereal_UiLayoutState_App_none && s->status != STATUS_STOPPED) {
ui_draw_sidebar(s);
if (s->vision_seen){
ui_draw_vision(s);
}
} else {
if (!s->scene.uilayout_sidebarcollapsed) {
ui_draw_sidebar(s);
}
}
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClear(GL_STENCIL_BUFFER_BIT);
glViewport(0, 0, s->fb_w, s->fb_h);
nvgBeginFrame(s->vg, s->fb_w, s->fb_h, 1.0f);
ui_draw_sidebar(s);
if (s->started && s->active_app == cereal_UiLayoutState_App_none && s->status != STATUS_STOPPED && s->vision_seen) {
ui_draw_vision(s);
}
nvgEndFrame(s->vg);
glDisable(GL_BLEND);
}
}
void ui_draw_image(NVGcontext *vg, float x, float y, float w, float h, int image, float alpha){

@ -180,6 +180,9 @@ static void ui_draw_sidebar_connectivity(UIState *s) {
void ui_draw_sidebar(UIState *s) {
ui_draw_sidebar_background(s);
if (s->scene.uilayout_sidebarcollapsed){
return;
}
ui_draw_sidebar_settings_button(s);
ui_draw_sidebar_home_button(s);
ui_draw_sidebar_network_strength(s);

Loading…
Cancel
Save