cleanup draw alert (#19655)

* cleanup

* use Rect

* Revert "use Rect"

This reverts commit 96d04339a0.

* remove None from static map
pull/19666/head
Dean Lee 2021-01-05 20:27:15 +08:00 committed by GitHub
parent d71fede2f9
commit 20918d82b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -416,7 +416,6 @@ static void ui_draw_vision_footer(UIState *s) {
static void ui_draw_vision_alert(UIState *s) {
static std::map<cereal::ControlsState::AlertSize, const int> alert_size_map = {
{cereal::ControlsState::AlertSize::NONE, 0},
{cereal::ControlsState::AlertSize::SMALL, 241},
{cereal::ControlsState::AlertSize::MID, 390},
{cereal::ControlsState::AlertSize::FULL, s->fb_h}};
@ -428,9 +427,9 @@ static void ui_draw_vision_alert(UIState *s) {
int alr_s = alert_size_map[scene->alert_size];
const int alr_x = scene->viz_rect.x - bdr_s;
const int alr_w = scene->viz_rect.w + (bdr_s*2);
const int alr_h = alr_s+(scene->alert_size==cereal::ControlsState::AlertSize::NONE?0:bdr_s);
const int alr_y = s->fb_h-alr_h;
const int alr_w = scene->viz_rect.w + (bdr_s * 2);
const int alr_h = alr_s + bdr_s;
const int alr_y = s->fb_h - alr_h;
ui_draw_rect(s->vg, alr_x, alr_y, alr_w, alr_h, color);