summaryrefslogtreecommitdiffstats
path: root/apps/gui/icon.c
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-10-05 23:13:01 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-10-05 23:13:01 +0000
commitfa69df3324847b4bac34a54e58ac566dcc51835a (patch)
tree46c7b9375f621f4fea13476b6493708e2393f971 /apps/gui/icon.c
parentff3e3f597440bc7348bf0ee67c1c36fddfce2ae5 (diff)
downloadrockbox-fa69df3324847b4bac34a54e58ac566dcc51835a.tar.gz
rockbox-fa69df3324847b4bac34a54e58ac566dcc51835a.zip
- Use const when possible
- Use pointer to avoid repeated access to array - Move setting xpos up a bit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22975 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/icon.c')
-rw-r--r--apps/gui/icon.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index a473c82872..e57ad29f6d 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -122,10 +122,11 @@ void screen_put_iconxy(struct screen * display,
int xpos, int ypos, enum themable_icons icon)
{
const void *data;
- int screen = display->screen_type;
- int width = ICON_WIDTH(screen);
- int height = ICON_HEIGHT(screen);
+ const int screen = display->screen_type;
+ const int width = ICON_WIDTH(screen);
+ const int height = ICON_HEIGHT(screen);
int stride;
+ const struct bitmap *iconset;
screen_bitmap_part_func *draw_func = NULL;
if (icon == Icon_NOICON)
@@ -135,24 +136,23 @@ void screen_put_iconxy(struct screen * display,
}
else if (icon >= Icon_Last_Themeable)
{
+ iconset = &viewer_iconset[screen];
icon -= Icon_Last_Themeable;
if (!viewer_icons_loaded[screen] ||
- (global_status.viewer_icon_count*height
- > viewer_iconset[screen].height) ||
- (icon * height > viewer_iconset[screen].height))
+ (global_status.viewer_icon_count * height > iconset->height) ||
+ (icon * height > iconset->height))
{
screen_put_iconxy(display, xpos, ypos, Icon_Questionmark);
return;
}
- data = viewer_iconset[screen].data;
- stride = STRIDE( display->screen_type, viewer_iconset[screen].width,
- viewer_iconset[screen].height);
+ data = iconset->data;
+ stride = STRIDE(display->screen_type, iconset->width, iconset->height);
}
else if (custom_icons_loaded[screen])
{
- data = user_iconset[screen].data;
- stride = STRIDE( display->screen_type, user_iconset[screen].width,
- user_iconset[screen].height);
+ iconset = &user_iconset[screen];
+ data = iconset->data;
+ stride = STRIDE(display->screen_type, iconset->width, iconset->height);
}
else
{
@@ -163,7 +163,10 @@ void screen_put_iconxy(struct screen * display,
/* add some left padding to the icons if they are on the edge */
if (xpos == 0)
xpos++;
-
+
+ if (lang_is_rtl())
+ xpos = display->getwidth() - xpos - width;
+
#if (LCD_DEPTH == 16) || defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH == 16)
if (display->depth == 16)
draw_func = display->transparent_bitmap_part;
@@ -171,8 +174,6 @@ void screen_put_iconxy(struct screen * display,
#endif
draw_func = display->bitmap_part;
- if (lang_is_rtl())
- xpos = display->getwidth() - xpos - width;
draw_func(data, 0, height * icon, stride, xpos, ypos, width, height);
}