summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-12-31 01:53:20 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2024-12-31 01:53:20 -0500
commit727d2ab749cfe720226948650e73cd0f74c3b340 (patch)
tree7662f2d80c9d468fc8c0404e32e0bc26ed4103a8
parentea5ca58dc6e4fc68d2c5656443ae12db06720bd2 (diff)
downloadrockbox-727d2ab749.tar.gz
rockbox-727d2ab749.zip
wps skin_parser free up skin ram with int16_t
change ints to int16_t especially image and rect sizes ditto font_ids frees ~250 bytes in cabbie Change-Id: I271be05a26e2090f6e1b11d809afd1c4bee32803
-rw-r--r--apps/gui/skin_engine/skin_parser.c8
-rw-r--r--apps/gui/skin_engine/wps_internals.h74
2 files changed, 40 insertions, 42 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index fcadc0051b..740885accb 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1974,7 +1974,7 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data)
goto abort;
struct skin_token_list *list = SKINOFFSETTOPTR(skin_buffer, wps_data->images);
- int *font_ids = SKINOFFSETTOPTR(skin_buffer, wps_data->font_ids);
+ int16_t *font_ids = SKINOFFSETTOPTR(skin_buffer, wps_data->font_ids);
while (list)
{
struct wps_token *token = SKINOFFSETTOPTR(skin_buffer, list->token);
@@ -2192,7 +2192,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
static bool skin_load_fonts(struct wps_data *data)
{
/* don't spit out after the first failue to aid debugging */
- int id_array[MAXUSERFONTS];
+ int16_t id_array[MAXUSERFONTS];
int font_count = 0;
bool success = true;
struct skin_element *vp_list;
@@ -2262,7 +2262,7 @@ static bool skin_load_fonts(struct wps_data *data)
}
if (font_count)
{
- int *font_ids = skin_buffer_alloc(font_count * sizeof(int));
+ int16_t *font_ids = skin_buffer_alloc(font_count * sizeof(font_ids[0]));
if (!success || font_ids == NULL)
{
while (font_count > 0)
@@ -2273,7 +2273,7 @@ static bool skin_load_fonts(struct wps_data *data)
data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL);
return false;
}
- memcpy(font_ids, id_array, sizeof(int)*font_count);
+ memcpy(font_ids, id_array, sizeof(font_ids[0])*font_count);
data->font_count = font_count;
data->font_ids = PTRTOSKINOFFSET(skin_buffer, font_ids);
}
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 76b9d48b1c..67fc711eee 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -96,10 +96,10 @@ struct skin_token_list {
};
struct gui_img {
- short int x; /* x-pos */
- short int y; /* y-pos */
- short int num_subimages; /* number of sub-images */
- short int subimage_height; /* height of each sub-image */
+ int16_t x; /* x-pos */
+ int16_t y; /* y-pos */
+ int16_t num_subimages; /* number of sub-images */
+ int16_t subimage_height; /* height of each sub-image */
struct bitmap bm;
int buflib_handle;
OFFSETTYPE(char*) label;
@@ -112,9 +112,9 @@ struct gui_img {
struct image_display {
OFFSETTYPE(char*) label;
- int subimage;
OFFSETTYPE(struct wps_token*) token; /* the token to get the subimage number from */
- int offset; /* offset into the bitmap strip to start */
+ int16_t subimage;
+ int16_t offset; /* offset into the bitmap strip to start */
};
struct progressbar {
@@ -123,13 +123,13 @@ struct progressbar {
bool horizontal;
char setting_offset;
/* regular pb */
- short x;
+ int16_t x;
/* >=0: explicitly set in the tag -> y-coord within the viewport
<0 : not set in the tag -> negated 1-based line number within
the viewport. y-coord will be computed based on the font height */
- short y;
- short width;
- short height;
+ int16_t y;
+ int16_t width;
+ int16_t height;
OFFSETTYPE(struct gui_img *) image;
bool invert_fill_direction;
@@ -143,10 +143,10 @@ struct progressbar {
};
struct draw_rectangle {
- int x;
- int y;
- int width;
- int height;
+ int16_t x;
+ int16_t y;
+ int16_t width;
+ int16_t height;
unsigned start_colour;
unsigned end_colour;
};
@@ -191,7 +191,7 @@ struct skin_viewport {
struct viewport vp; /* The LCD viewport struct */
struct frame_buffer_t framebuf; /* holds reference to current framebuffer */
OFFSETTYPE(char*) label;
- int parsed_fontid;
+ int16_t parsed_fontid;
char hidden_flags;
bool is_infovp;
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
@@ -210,12 +210,12 @@ struct viewport_colour {
struct touchregion {
OFFSETTYPE(char*) label; /* label to identify this region */
OFFSETTYPE(struct skin_viewport*) wvp;/* The viewport this region is in */
- short int x; /* x-pos */
- short int y; /* y-pos */
- short int width; /* width */
- short int height; /* height */
- short int wpad; /* padding to width */
- short int hpad; /* padding to height */
+ int16_t x; /* x-pos */
+ int16_t y; /* y-pos */
+ int16_t width; /* width */
+ int16_t height; /* height */
+ int16_t wpad; /* padding to width */
+ int16_t hpad; /* padding to height */
bool reverse_bar; /* if true 0% is the left or top */
bool allow_while_locked;
bool armed; /* A region is armed on press. Only armed regions are triggered
@@ -241,8 +241,6 @@ struct touchregion {
OFFSETTYPE(struct progressbar*) bar;
};
-
-
struct touchregion_lastpress {
OFFSETTYPE(struct touchregion *) region;
long timeout;
@@ -271,10 +269,10 @@ struct playlistviewer {
struct skin_albumart {
/* Album art support */
- int x;
- int y;
- int width;
- int height;
+ int16_t x;
+ int16_t y;
+ int16_t width;
+ int16_t height;
unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
@@ -314,24 +312,24 @@ struct logical_if {
};
struct substring {
- int start;
- int length;
+ int16_t start;
+ int16_t length;
bool expect_number;
OFFSETTYPE(struct wps_token *) token;
};
struct listitem {
bool wrap;
- short offset;
+ int16_t offset;
};
struct listitem_viewport_cfg {
struct wps_data *data;
OFFSETTYPE(char *) label;
- int width;
- int height;
- int xmargin;
- int ymargin;
+ int16_t width;
+ int16_t height;
+ int16_t xmargin;
+ int16_t ymargin;
bool tile;
struct skin_viewport selected_item_vp;
};
@@ -363,10 +361,10 @@ struct wps_data
OFFSETTYPE(struct skin_element *) tree;
OFFSETTYPE(struct skin_token_list *) images;
- OFFSETTYPE(int *) font_ids;
- int font_count;
+ OFFSETTYPE(int16_t *) font_ids;
+ int16_t font_count;
#ifdef HAVE_BACKDROP_IMAGE
- int backdrop_id;
+ int16_t backdrop_id;
bool use_extra_framebuffer;
#endif
@@ -379,7 +377,7 @@ struct wps_data
int playback_aa_slot;
/* copy of albumart to survive skin resets, used to check if albumart
* dimensions changed on skin change */
- short last_albumart_width, last_albumart_height;
+ int16_t last_albumart_width, last_albumart_height;
#endif
#ifdef HAVE_SKIN_VARIABLES