diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-09 11:55:44 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-11-09 11:58:17 -0500 |
commit | c2220a3b50325702e53d7d4bbdb485068e1148f9 (patch) | |
tree | 070f5c99af42e1293e7ce4661541a074348299d1 | |
parent | e8aaee4979800b51ee18ebed7690da1e81a95893 (diff) | |
download | rockbox-c2220a3b50325702e53d7d4bbdb485068e1148f9.tar.gz rockbox-c2220a3b50325702e53d7d4bbdb485068e1148f9.zip |
eq_menu cleanup some getstringsize calls
remove some unused calls and save some space by only grabbing font h once
it doesn't change throughout the function
Change-Id: Iec3b8b34150d15b36062cba59c8d365b751bd0f6
-rw-r--r-- | apps/menus/eq_menu.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 109c3c9ab7..2bf26e2b5a 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c | |||
@@ -480,17 +480,18 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
480 | /* Print out the band label */ | 480 | /* Print out the band label */ |
481 | if (band == 0) { | 481 | if (band == 0) { |
482 | screen->putsxy(x1, y1, "LS: "); | 482 | screen->putsxy(x1, y1, "LS: "); |
483 | screen->getstringsize("LS:", &w, &h); | 483 | /*screen->getstringsize("LS:", &w, &h); UNUSED*/ |
484 | } else if (band == EQ_NUM_BANDS - 1) { | 484 | } else if (band == EQ_NUM_BANDS - 1) { |
485 | screen->putsxy(x1, y1, "HS: "); | 485 | screen->putsxy(x1, y1, "HS: "); |
486 | screen->getstringsize("HS:", &w, &h); | 486 | /*screen->getstringsize("HS:", &w, &h); UNUSED*/ |
487 | } else { | 487 | } else { |
488 | snprintf(buf, sizeof(buf), "PK%d:", band); | 488 | snprintf(buf, sizeof(buf), "PK%d:", band); |
489 | screen->putsxy(x1, y1, buf); | 489 | screen->putsxy(x1, y1, buf); |
490 | screen->getstringsize(buf, &w, &h); | 490 | /*screen->getstringsize(buf, &w, &h); UNUSED*/ |
491 | } | 491 | } |
492 | 492 | ||
493 | screen->getstringsize("A", &w, &h); | 493 | w = screen->getstringsize("A", NULL, &h); |
494 | |||
494 | x1 += 5*w; /* 4 chars for label + 1 space = 5 */ | 495 | x1 += 5*w; /* 4 chars for label + 1 space = 5 */ |
495 | 496 | ||
496 | /* Print out gain part of status line (left justify after label) */ | 497 | /* Print out gain part of status line (left justify after label) */ |
@@ -503,7 +504,7 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
503 | abs_gain / EQ_USER_DIVISOR, abs_gain % EQ_USER_DIVISOR, | 504 | abs_gain / EQ_USER_DIVISOR, abs_gain % EQ_USER_DIVISOR, |
504 | screen->lcdwidth >= 160 ? "dB" : ""); | 505 | screen->lcdwidth >= 160 ? "dB" : ""); |
505 | screen->putsxy(x1, y1, buf); | 506 | screen->putsxy(x1, y1, buf); |
506 | screen->getstringsize(buf, &w, &h); | 507 | w = screen->getstringsize(buf, NULL, NULL); |
507 | x1 += w; | 508 | x1 += w; |
508 | 509 | ||
509 | /* Print out Q part of status line (right justify) */ | 510 | /* Print out Q part of status line (right justify) */ |
@@ -514,7 +515,7 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
514 | 515 | ||
515 | snprintf(buf, sizeof(buf), "%d.%d%s", q / EQ_USER_DIVISOR, | 516 | snprintf(buf, sizeof(buf), "%d.%d%s", q / EQ_USER_DIVISOR, |
516 | q % EQ_USER_DIVISOR, screen->lcdwidth >= 160 ? " Q" : ""); | 517 | q % EQ_USER_DIVISOR, screen->lcdwidth >= 160 ? " Q" : ""); |
517 | screen->getstringsize(buf, &w, &h); | 518 | w = screen->getstringsize(buf, NULL, NULL); |
518 | x2 = x + width - w - 2; | 519 | x2 = x + width - w - 2; |
519 | screen->putsxy(x2, y1, buf); | 520 | screen->putsxy(x2, y1, buf); |
520 | 521 | ||
@@ -526,7 +527,7 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
526 | 527 | ||
527 | snprintf(buf, sizeof(buf), "%5d%s", cutoff, | 528 | snprintf(buf, sizeof(buf), "%5d%s", cutoff, |
528 | screen->lcdwidth >= 160 ? "Hz" : ""); | 529 | screen->lcdwidth >= 160 ? "Hz" : ""); |
529 | screen->getstringsize(buf, &w, &h); | 530 | w = screen->getstringsize(buf, NULL, NULL); |
530 | x1 = x1 + (x2 - x1 - w)/2; | 531 | x1 = x1 + (x2 - x1 - w)/2; |
531 | screen->putsxy(x1, y1, buf); | 532 | screen->putsxy(x1, y1, buf); |
532 | 533 | ||
@@ -590,7 +591,7 @@ int eq_menu_graphical(void) | |||
590 | int current_band, x, y, step, fast_step, min, max; | 591 | int current_band, x, y, step, fast_step, min, max; |
591 | enum eq_slider_mode mode; | 592 | enum eq_slider_mode mode; |
592 | char buf[24]; | 593 | char buf[24]; |
593 | int w, h, height, start_item, nb_eq_sliders[NB_SCREENS]; | 594 | int h, height, start_item, nb_eq_sliders[NB_SCREENS]; |
594 | FOR_NB_SCREENS(i) | 595 | FOR_NB_SCREENS(i) |
595 | viewportmanager_theme_enable(i, false, NULL); | 596 | viewportmanager_theme_enable(i, false, NULL); |
596 | 597 | ||
@@ -601,7 +602,7 @@ int eq_menu_graphical(void) | |||
601 | screens[i].clear_display(); | 602 | screens[i].clear_display(); |
602 | 603 | ||
603 | /* Figure out how many sliders can be drawn on the screen */ | 604 | /* Figure out how many sliders can be drawn on the screen */ |
604 | screens[i].getstringsize("A", &w, &h); | 605 | h = screens[i].getcharheight(); |
605 | 606 | ||
606 | /* Total height includes margins (1), text, slider, and line selector (1) */ | 607 | /* Total height includes margins (1), text, slider, and line selector (1) */ |
607 | height = 3 + h + 1 + SCROLLBAR_SIZE + 3; | 608 | height = 3 + h + 1 + SCROLLBAR_SIZE + 3; |