summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-11-21 00:14:52 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-11-21 00:25:12 -0500
commit658cc9588569af9cba054ad6f1b1e92204961d20 (patch)
tree2f95a8ed522bd2247fea0db25bfa4010e91326ec
parenteb9b3513faa0d7e5bc2d7bb9ed098801191af1d8 (diff)
downloadrockbox-658cc9588569af9cba054ad6f1b1e92204961d20.tar.gz
rockbox-658cc9588569af9cba054ad6f1b1e92204961d20.zip
remove some sprintf putsxy calls in favor of putsxyf
we now have putsxyf in screens[] so no need for a separate buffer in these cases Change-Id: Ife0738e731f03d255f512bab3d5bb07b8be8693d
-rw-r--r--apps/gui/color_picker.c26
-rw-r--r--apps/gui/line.c3
-rw-r--r--apps/menus/eq_menu.c13
3 files changed, 16 insertions, 26 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index a32f1ee179..ef17c0a230 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -154,7 +154,6 @@ static void draw_screen(struct screen *display, char *title,
154{ 154{
155 unsigned text_color = LCD_BLACK; 155 unsigned text_color = LCD_BLACK;
156 unsigned background_color = LCD_WHITE; 156 unsigned background_color = LCD_WHITE;
157 char buf[32];
158 int i, char_height, line_height; 157 int i, char_height, line_height;
159 int max_label_width; 158 int max_label_width;
160 int text_x, text_top; 159 int text_x, text_top;
@@ -253,17 +252,16 @@ static void draw_screen(struct screen *display, char *title,
253 set_drawinfo(display, mode, fg, bg); 252 set_drawinfo(display, mode, fg, bg);
254 253
255 /* Draw label */ 254 /* Draw label */
256 buf[0] = str(LANG_COLOR_RGB_LABELS)[i];
257 buf[1] = '\0';
258 vp.flags &= ~VP_FLAG_ALIGNMENT_MASK; 255 vp.flags &= ~VP_FLAG_ALIGNMENT_MASK;
259 display->putsxy(text_x, text_top, buf); 256 display->putsxyf(text_x, text_top, "%c", str(LANG_COLOR_RGB_LABELS)[i]);
260 /* Draw color value */ 257 /* Draw color value */
258 vp.flags |= VP_FLAG_ALIGN_RIGHT;
261 if (display->depth >= 24) 259 if (display->depth >= 24)
262 snprintf(buf, 4, "%03d", rgb->rgb_val[i] & 0xFF); 260 display->putsxyf(text_x, text_top, "%03d", rgb->rgb_val[i] & 0xFF);
263 else 261 else
264 snprintf(buf, 3, "%02d", rgb->rgb_val[i] & 0x3F); 262 display->putsxyf(text_x, text_top, "%02d", rgb->rgb_val[i] & 0x3F);
265 vp.flags |= VP_FLAG_ALIGN_RIGHT; 263
266 display->putsxy(text_x, text_top, buf); 264
267 265
268 /* Draw scrollbar */ 266 /* Draw scrollbar */
269 gui_scrollbar_draw(display, /* screen */ 267 gui_scrollbar_draw(display, /* screen */
@@ -280,9 +278,6 @@ static void draw_screen(struct screen *display, char *title,
280 text_top += line_height; 278 text_top += line_height;
281 } /* end for */ 279 } /* end for */
282 280
283 /* Format RGB: #rrggbb */
284 snprintf(buf, sizeof(buf), str(LANG_COLOR_RGB_VALUE),
285 rgb->red, rgb->green, rgb->blue);
286 vp.flags |= VP_FLAG_ALIGN_CENTER; 281 vp.flags |= VP_FLAG_ALIGN_CENTER;
287 if (display->depth >= 16) 282 if (display->depth >= 16)
288 { 283 {
@@ -301,8 +296,9 @@ static void draw_screen(struct screen *display, char *title,
301 /* Draw RGB: #rrggbb in middle of swatch */ 296 /* Draw RGB: #rrggbb in middle of swatch */
302 set_drawinfo(display, DRMODE_FG, get_black_or_white(rgb), 297 set_drawinfo(display, DRMODE_FG, get_black_or_white(rgb),
303 background_color); 298 background_color);
304 299 /* Format RGB: #rrggbb */
305 display->putsxy(0, top + (height - char_height) / 2, buf); 300 display->putsxyf(0, top + (height - char_height) / 2,
301 str(LANG_COLOR_RGB_VALUE), rgb->red, rgb->green, rgb->blue);
306 302
307 /* Draw border around the rect */ 303 /* Draw border around the rect */
308 set_drawinfo(display, DRMODE_SOLID, text_color, background_color); 304 set_drawinfo(display, DRMODE_SOLID, text_color, background_color);
@@ -318,7 +314,9 @@ static void draw_screen(struct screen *display, char *title,
318 if (height >= char_height) 314 if (height >= char_height)
319 { 315 {
320 set_drawinfo(display, DRMODE_SOLID, text_color, background_color); 316 set_drawinfo(display, DRMODE_SOLID, text_color, background_color);
321 display->putsxy(0, top + (height - char_height) / 2, buf); 317 /* Format RGB: #rrggbb */
318 display->putsxyf(0, top + (height - char_height) / 2,
319 str(LANG_COLOR_RGB_VALUE), rgb->red, rgb->green, rgb->blue);
322 } 320 }
323 } 321 }
324 322
diff --git a/apps/gui/line.c b/apps/gui/line.c
index d319ff3c51..7e84aa7b31 100644
--- a/apps/gui/line.c
+++ b/apps/gui/line.c
@@ -264,8 +264,7 @@ next:
264 else 264 else
265 { 265 {
266 /* any other character here is an erroneous format string */ 266 /* any other character here is an erroneous format string */
267 snprintf(tempbuf, sizeof(tempbuf), "<E:%c>", ch); 267 display->putsxyf(xpos, y, "<E:%c>", ch);
268 display->putsxy(xpos, y, tempbuf);
269 /* Don't consider going forward, fix the caller */ 268 /* Don't consider going forward, fix the caller */
270 return; 269 return;
271 } 270 }
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index fd9f484047..c25d19e352 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -590,7 +590,6 @@ int eq_menu_graphical(void)
590 int *setting; 590 int *setting;
591 int current_band, x, y, step, fast_step, min, max; 591 int current_band, x, y, step, fast_step, min, max;
592 enum eq_slider_mode mode; 592 enum eq_slider_mode mode;
593 char buf[24];
594 int h, height, start_item, nb_eq_sliders[NB_SCREENS]; 593 int h, height, start_item, nb_eq_sliders[NB_SCREENS];
595 FOR_NB_SCREENS(i) 594 FOR_NB_SCREENS(i)
596 viewportmanager_theme_enable(i, false, NULL); 595 viewportmanager_theme_enable(i, false, NULL);
@@ -638,10 +637,8 @@ int eq_menu_graphical(void)
638 min = EQ_GAIN_MIN; 637 min = EQ_GAIN_MIN;
639 max = EQ_GAIN_MAX; 638 max = EQ_GAIN_MAX;
640 639
641 snprintf(buf, sizeof(buf), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE), 640 screens[i].putsxyf(0, 0, str(LANG_SYSFONT_EQUALIZER_EDIT_MODE),
642 str(LANG_SYSFONT_GAIN), "(dB)"); 641 str(LANG_SYSFONT_GAIN), "(dB)");
643
644 screens[i].putsxy(0, 0, buf);
645 } else if (mode == CUTOFF) { 642 } else if (mode == CUTOFF) {
646 /* cutoff */ 643 /* cutoff */
647 setting = &global_settings.eq_band_settings[current_band].cutoff; 644 setting = &global_settings.eq_band_settings[current_band].cutoff;
@@ -651,10 +648,8 @@ int eq_menu_graphical(void)
651 min = EQ_CUTOFF_MIN; 648 min = EQ_CUTOFF_MIN;
652 max = EQ_CUTOFF_MAX; 649 max = EQ_CUTOFF_MAX;
653 650
654 snprintf(buf, sizeof(buf), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE), 651 screens[i].putsxyf(0, 0, str(LANG_SYSFONT_EQUALIZER_EDIT_MODE),
655 str(LANG_SYSFONT_EQUALIZER_BAND_CUTOFF), "(Hz)"); 652 str(LANG_SYSFONT_EQUALIZER_BAND_CUTOFF), "(Hz)");
656
657 screens[i].putsxy(0, 0, buf);
658 } else { 653 } else {
659 /* Q */ 654 /* Q */
660 setting = &global_settings.eq_band_settings[current_band].q; 655 setting = &global_settings.eq_band_settings[current_band].q;
@@ -664,10 +659,8 @@ int eq_menu_graphical(void)
664 min = EQ_Q_MIN; 659 min = EQ_Q_MIN;
665 max = EQ_Q_MAX; 660 max = EQ_Q_MAX;
666 661
667 snprintf(buf, sizeof(buf), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE), 662 screens[i].putsxyf(0, 0, str(LANG_SYSFONT_EQUALIZER_EDIT_MODE),
668 str(LANG_SYSFONT_EQUALIZER_BAND_Q), ""); 663 str(LANG_SYSFONT_EQUALIZER_BAND_Q), "");
669
670 screens[i].putsxy(0, 0, buf);
671 } 664 }
672 665
673 /* Draw scrollbar if needed */ 666 /* Draw scrollbar if needed */