summaryrefslogtreecommitdiff
path: root/apps/gui/color_picker.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/color_picker.c')
-rw-r--r--apps/gui/color_picker.c26
1 files changed, 12 insertions, 14 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