summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-06-07 05:13:36 +0200
committerChristian Soffke <christian.soffke@gmail.com>2023-06-09 03:15:10 +0200
commit666a836227fff725cba0884edd6113b5d548c7dd (patch)
tree7b3972c8077922a22c3ff896cb8efca6a1369612
parentbd339dabacb0966830baf2ecc3320d0b412c0507 (diff)
downloadrockbox-666a836227fff725cba0884edd6113b5d548c7dd.tar.gz
rockbox-666a836227fff725cba0884edd6113b5d548c7dd.zip
Skin Engine: Enable dithering for images drawn onto backdrop layer
Backdrop images loaded using %X(filename) already had dithering enabled, but images loaded using the %x tag in viewports annotated with %VB did not. Change-Id: I9c6d11d8e7ab41a53eb9e453d78ae0dc58cb947b
-rw-r--r--apps/gui/skin_engine/skin_parser.c15
-rw-r--r--apps/gui/skin_engine/wps_internals.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 6cc3c596b0..b801eaae12 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -426,9 +426,16 @@ static int parse_image_load(struct skin_element *element,
426 img->buflib_handle = -1; 426 img->buflib_handle = -1;
427 img->is_9_segment = false; 427 img->is_9_segment = false;
428 img->loaded = false; 428 img->loaded = false;
429 img->dither = false;
429 430
430 if (token->type == SKIN_TOKEN_IMAGE_DISPLAY) 431 if (token->type == SKIN_TOKEN_IMAGE_DISPLAY)
432 {
431 token->value.data = PTRTOSKINOFFSET(skin_buffer, img); 433 token->value.data = PTRTOSKINOFFSET(skin_buffer, img);
434#ifdef HAVE_BACKDROP_IMAGE
435 if (curr_vp)
436 img->dither = curr_vp->output_to_backdrop_buffer;
437#endif
438 }
432 439
433 if (!strcmp(img->bm.data, "__list_icons__")) 440 if (!strcmp(img->bm.data, "__list_icons__"))
434 { 441 {
@@ -1910,11 +1917,12 @@ static int buflib_move_callback(int handle, void* current, void* new)
1910} 1917}
1911#endif 1918#endif
1912 1919
1913static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char* bmpdir) 1920static int load_skin_bmp(struct wps_data *wps_data, struct gui_img *img, char* bmpdir)
1914{ 1921{
1915 1922
1916 (void)wps_data; /* only needed for remote targets */ 1923 (void)wps_data; /* only needed for remote targets */
1917 char img_path[MAX_PATH]; 1924 char img_path[MAX_PATH];
1925 struct bitmap *bitmap = &img->bm;
1918 1926
1919 get_image_filename(bitmap->data, bmpdir, 1927 get_image_filename(bitmap->data, bmpdir,
1920 img_path, sizeof(img_path)); 1928 img_path, sizeof(img_path));
@@ -1938,7 +1946,8 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
1938 bmpformat = FORMAT_ANY|FORMAT_REMOTE; 1946 bmpformat = FORMAT_ANY|FORMAT_REMOTE;
1939 else 1947 else
1940#endif 1948#endif
1941 bmpformat = FORMAT_ANY|FORMAT_TRANSPARENT; 1949 bmpformat = img->dither ? FORMAT_ANY|FORMAT_DITHER|FORMAT_TRANSPARENT :
1950 FORMAT_ANY|FORMAT_TRANSPARENT;
1942 1951
1943 handle = core_load_bmp(img_path, bitmap, bmpformat, &buf_reqd, &buflib_ops); 1952 handle = core_load_bmp(img_path, bitmap, bmpformat, &buf_reqd, &buflib_ops);
1944 if (handle != CLB_ALOC_ERR) 1953 if (handle != CLB_ALOC_ERR)
@@ -1990,7 +1999,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
1990 char path[MAX_PATH]; 1999 char path[MAX_PATH];
1991 int handle; 2000 int handle;
1992 strcpy(path, img->bm.data); 2001 strcpy(path, img->bm.data);
1993 handle = load_skin_bmp(wps_data, &img->bm, bmpdir); 2002 handle = load_skin_bmp(wps_data, img, bmpdir);
1994 img->buflib_handle = handle; 2003 img->buflib_handle = handle;
1995 img->loaded = img->buflib_handle > 0; 2004 img->loaded = img->buflib_handle > 0;
1996 2005
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 6b9719282e..8ad8325e66 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -102,6 +102,7 @@ struct gui_img {
102 int display; 102 int display;
103 bool using_preloaded_icons; /* using the icon system instead of a bmp */ 103 bool using_preloaded_icons; /* using the icon system instead of a bmp */
104 bool is_9_segment; 104 bool is_9_segment;
105 bool dither;
105}; 106};
106 107
107struct image_display { 108struct image_display {