From 38687821b20dee54bc52718b49b851de5485351d Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 4 Oct 2022 14:02:44 +0100 Subject: [PATCH] skin engine: Remove playlistviewer viewport field We already know the viewport at render time (I think... at least this seems to be the case for themes I tested) so there's no need to store a pointer to the viewport. Change-Id: I75fa2262e96c6f735e6b5da33cd4ca9ac68cd2ee --- apps/gui/skin_engine/skin_parser.c | 1 - apps/gui/skin_engine/skin_render.c | 4 ++-- apps/gui/skin_engine/wps_internals.h | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 6fb1b2a43c..e68d5e4d3c 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -494,7 +494,6 @@ static int parse_playlistview(struct skin_element *element, struct playlistviewer *viewer = skin_buffer_alloc(sizeof(*viewer)); if (!viewer) return WPS_ERROR_INVALID_PARAM; - viewer->vp = PTRTOSKINOFFSET(skin_buffer, &curr_vp->vp); viewer->show_icons = true; viewer->start_offset = get_param(element, 0)->data.number; viewer->line = PTRTOSKINOFFSET(skin_buffer, get_param_code(element, 1)); diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 8184ba8f66..e8f081e7f5 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c @@ -937,7 +937,7 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, struct align_pos * align = &info.align; bool needs_update; int cur_pos, start_item, max; - int nb_lines = viewport_get_nb_lines(SKINOFFSETTOPTR(skin_buffer, viewer->vp)); + int nb_lines = viewport_get_nb_lines(&skin_viewport->vp); #if CONFIG_TUNER if (get_current_activity() == ACTIVITY_FM) { @@ -983,7 +983,7 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, /* only update if the line needs to be, and there is something to write */ if (refresh_type && needs_update) { - struct viewport *vp = SKINOFFSETTOPTR(skin_buffer, viewer->vp); + struct viewport *vp = &skin_viewport->vp; if (!info.force_redraw) display->scroll_stop_viewport_rect(vp, 0, info.line_number*display->getcharheight(), diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index f3e4577cc2..87ccb9ad89 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -244,7 +244,6 @@ struct touchregion_lastpress { #endif struct playlistviewer { - OFFSETTYPE(struct viewport *) vp; bool show_icons; int start_offset; OFFSETTYPE(struct skin_element *) line;