Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

skin_engine: New tag to draw a rectangle (optionally with a gradient)

%dr(x, y, width, height, [colour1[, colour2]]):
x,y - viewport relative pixel coordinates to start the rectangle.
width, height - obvious. can be '-' to fill the viewport
if both colours are left out the viewports foreground colour will be used
if one colour is specified it will fill the rectangle that colour.
if both colours are specified it will gradient fill the rectangle.

Change-Id: Iad451e99ded663bc7c5d182443659db7d909b388

+105 -6
+48
apps/gui/skin_engine/skin_parser.c
··· 638 638 return 0; 639 639 } 640 640 641 + static int parse_drawrectangle( struct skin_element *element, 642 + struct wps_token *token, 643 + struct wps_data *wps_data) 644 + { 645 + (void)wps_data; 646 + struct draw_rectangle *rect = 647 + (struct draw_rectangle *)skin_buffer_alloc(sizeof(struct draw_rectangle)); 648 + 649 + if (!rect) 650 + return -1; 651 + 652 + rect->x = get_param(element, 0)->data.number; 653 + rect->y = get_param(element, 1)->data.number; 654 + 655 + if (isdefault(get_param(element, 2))) 656 + rect->width = curr_vp->vp.width - rect->x; 657 + else 658 + rect->width = get_param(element, 2)->data.number; 659 + 660 + if (isdefault(get_param(element, 3))) 661 + rect->height = curr_vp->vp.height - rect->y; 662 + else 663 + rect->height = get_param(element, 3)->data.number; 664 + 665 + rect->start_colour = curr_vp->vp.fg_pattern; 666 + rect->end_colour = curr_vp->vp.fg_pattern; 667 + 668 + if (element->params_count > 4) 669 + { 670 + if (!parse_color(curr_screen, get_param_text(element, 4), 671 + &rect->start_colour)) 672 + return -1; 673 + rect->end_colour = rect->start_colour; 674 + } 675 + if (element->params_count > 5) 676 + { 677 + if (!parse_color(curr_screen, get_param_text(element, 5), 678 + &rect->end_colour)) 679 + return -1; 680 + } 681 + token->value.data = PTRTOSKINOFFSET(skin_buffer, rect); 682 + 683 + return 0; 684 + } 685 + 641 686 static int parse_viewportcolour(struct skin_element *element, 642 687 struct wps_token *token, 643 688 struct wps_data *wps_data) ··· 2012 2057 #ifndef __PCTOOL__ 2013 2058 sb_skin_has_title(curr_screen); 2014 2059 #endif 2060 + break; 2061 + case SKIN_TOKEN_DRAWRECTANGLE: 2062 + function = parse_drawrectangle; 2015 2063 break; 2016 2064 #endif 2017 2065 case SKIN_TOKEN_FILE_DIRECTORY:
+22 -1
apps/gui/skin_engine/skin_render.c
··· 176 176 if (do_refresh) 177 177 draw_peakmeters(gwps, info->line_number, vp); 178 178 break; 179 + case SKIN_TOKEN_DRAWRECTANGLE: 180 + if (do_refresh) 181 + { 182 + struct draw_rectangle *rect = 183 + SKINOFFSETTOPTR(skin_buffer, token->value.data); 184 + #ifdef HAVE_LCD_COLOR 185 + if (rect->start_colour != rect->end_colour && 186 + gwps->display->screen_type == SCREEN_MAIN) 187 + { 188 + gwps->display->gradient_fillrect(rect->x, rect->y, rect->width, 189 + rect->height, rect->start_colour, rect->end_colour); 190 + } 191 + else 179 192 #endif 180 - #ifdef HAVE_LCD_BITMAP 193 + { 194 + unsigned backup = vp->fg_pattern; 195 + vp->fg_pattern = rect->start_colour; 196 + gwps->display->fillrect(rect->x, rect->y, rect->width, 197 + rect->height); 198 + vp->fg_pattern = backup; 199 + } 200 + } 201 + break; 181 202 case SKIN_TOKEN_PEAKMETER_LEFTBAR: 182 203 case SKIN_TOKEN_PEAKMETER_RIGHTBAR: 183 204 data->peak_meter_enabled = true;
+9
apps/gui/skin_engine/wps_internals.h
··· 113 113 bool horizontal; 114 114 OFFSETTYPE(struct gui_img *) backdrop; 115 115 }; 116 + 117 + struct draw_rectangle { 118 + int x; 119 + int y; 120 + int width; 121 + int height; 122 + unsigned start_colour; 123 + unsigned end_colour; 124 + }; 116 125 #endif 117 126 118 127
+3
apps/screen_access.c
··· 264 264 #endif 265 265 #if defined(HAVE_LCD_BITMAP) 266 266 .set_framebuffer = (void*)lcd_set_framebuffer, 267 + #if defined(HAVE_LCD_COLOR) 268 + .gradient_fillrect = lcd_gradient_fillrect, 269 + #endif 267 270 #endif 268 271 }, 269 272 #if NB_SCREENS == 2
+4
apps/screen_access.h
··· 162 162 #endif 163 163 #if defined(HAVE_LCD_BITMAP) 164 164 void (*set_framebuffer)(void *framebuffer); 165 + #if defined(HAVE_LCD_COLOR) 166 + void (*gradient_fillrect)(int x, int y, int width, int height, 167 + unsigned start, unsigned end); 168 + #endif 165 169 #endif 166 170 }; 167 171
+9 -5
firmware/drivers/lcd-bitmap-common.c
··· 41 41 #endif 42 42 43 43 #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) 44 - void lcd_gradient_fillrect(int x1, int x2, int y1, int y2, 44 + void lcd_gradient_fillrect(int x, int y, int width, int height, 45 45 unsigned start_rgb, unsigned end_rgb) 46 46 { 47 47 int old_pattern = current_vp->fg_pattern; 48 48 int step_mul, i; 49 - if (y2 - y1 == 0) return; 49 + int x1, x2; 50 + x1 = x; 51 + x2 = x + width; 52 + 53 + if (height == 0) return; 50 54 51 - step_mul = (1 << 16) / (y2 - y1); 55 + step_mul = (1 << 16) / height; 52 56 int h_r = RGB_UNPACK_RED(start_rgb); 53 57 int h_g = RGB_UNPACK_GREEN(start_rgb); 54 58 int h_b = RGB_UNPACK_BLUE(start_rgb); ··· 59 63 h_g = (h_g << 16) + (1 << 15); 60 64 h_b = (h_b << 16) + (1 << 15); 61 65 62 - for(i = y1; i < y2; i++) { 66 + for(i = y; i < y + height; i++) { 63 67 current_vp->fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); 64 68 lcd_hline(x1, x2, i); 65 69 h_r -= rstep; ··· 108 112 h_g -= h * gstep; 109 113 h_b -= h * bstep; 110 114 end_rgb = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); 111 - lcd_gradient_fillrect(x1, x2, y, y + h, start_rgb, end_rgb); 115 + lcd_gradient_fillrect(x1, y, x2 - x1, h, start_rgb, end_rgb); 112 116 } 113 117 114 118 #endif
+1
lib/skin_parser/tag_table.c
··· 244 244 { SKIN_TOKEN_VAR_TIMEOUT, "vl", "S|D", SKIN_REFRESH_DYNAMIC }, 245 245 246 246 { SKIN_TOKEN_SUBSTRING, "ss", "IiT|s", SKIN_REFRESH_DYNAMIC }, 247 + { SKIN_TOKEN_DRAWRECTANGLE, "dr", "IIii|ss", SKIN_REFRESH_STATIC }, 247 248 { SKIN_TOKEN_UNKNOWN, "" , "", 0 } 248 249 /* Keep this here to mark the end of the table */ 249 250 };
+2
lib/skin_parser/tag_table.h
··· 288 288 SKIN_TOKEN_VAR_TIMEOUT, 289 289 290 290 SKIN_TOKEN_SUBSTRING, 291 + 292 + SKIN_TOKEN_DRAWRECTANGLE, 291 293 }; 292 294 293 295 /*
+7
manual/appendix/wps_tags.tex
··· 100 100 \config{\%Fl('id',filename)} & See section \ref{ref:multifont}.\\ 101 101 \end{tagmap} 102 102 103 + \section{Misc Coloring Tags} 104 + \begin{tagmap} 105 + \config{\%dr(x,y,width,height,[color1,color2])} & Color a rectangle. \\ 106 + \end{tagmap} 107 + width and height can be - to fill the viewport. If no color is 108 + specified the viewports foreground color will be used. If two 109 + colors are specified it will do a gradient fill. 103 110 } 104 111 105 112 \section{Power Related Information}