summaryrefslogtreecommitdiff
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
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
-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,
122 int xpos, int ypos, enum themable_icons icon) 122 int xpos, int ypos, enum themable_icons icon)
123{ 123{
124 const void *data; 124 const void *data;
125 int screen = display->screen_type; 125 const int screen = display->screen_type;
126 int width = ICON_WIDTH(screen); 126 const int width = ICON_WIDTH(screen);
127 int height = ICON_HEIGHT(screen); 127 const int height = ICON_HEIGHT(screen);
128 int stride; 128 int stride;
129 const struct bitmap *iconset;
129 screen_bitmap_part_func *draw_func = NULL; 130 screen_bitmap_part_func *draw_func = NULL;
130 131
131 if (icon == Icon_NOICON) 132 if (icon == Icon_NOICON)
@@ -135,24 +136,23 @@ void screen_put_iconxy(struct screen * display,
135 } 136 }
136 else if (icon >= Icon_Last_Themeable) 137 else if (icon >= Icon_Last_Themeable)
137 { 138 {
139 iconset = &viewer_iconset[screen];
138 icon -= Icon_Last_Themeable; 140 icon -= Icon_Last_Themeable;
139 if (!viewer_icons_loaded[screen] || 141 if (!viewer_icons_loaded[screen] ||
140 (global_status.viewer_icon_count*height 142 (global_status.viewer_icon_count * height > iconset->height) ||
141 > viewer_iconset[screen].height) || 143 (icon * height > iconset->height))
142 (icon * height > viewer_iconset[screen].height))
143 { 144 {
144 screen_put_iconxy(display, xpos, ypos, Icon_Questionmark); 145 screen_put_iconxy(display, xpos, ypos, Icon_Questionmark);
145 return; 146 return;
146 } 147 }
147 data = viewer_iconset[screen].data; 148 data = iconset->data;
148 stride = STRIDE( display->screen_type, viewer_iconset[screen].width, 149 stride = STRIDE(display->screen_type, iconset->width, iconset->height);
149 viewer_iconset[screen].height);
150 } 150 }
151 else if (custom_icons_loaded[screen]) 151 else if (custom_icons_loaded[screen])
152 { 152 {
153 data = user_iconset[screen].data; 153 iconset = &user_iconset[screen];
154 stride = STRIDE( display->screen_type, user_iconset[screen].width, 154 data = iconset->data;
155 user_iconset[screen].height); 155 stride = STRIDE(display->screen_type, iconset->width, iconset->height);
156 } 156 }
157 else 157 else
158 { 158 {
@@ -163,7 +163,10 @@ void screen_put_iconxy(struct screen * display,
163 /* add some left padding to the icons if they are on the edge */ 163 /* add some left padding to the icons if they are on the edge */
164 if (xpos == 0) 164 if (xpos == 0)
165 xpos++; 165 xpos++;
166 166
167 if (lang_is_rtl())
168 xpos = display->getwidth() - xpos - width;
169
167#if (LCD_DEPTH == 16) || defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH == 16) 170#if (LCD_DEPTH == 16) || defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH == 16)
168 if (display->depth == 16) 171 if (display->depth == 16)
169 draw_func = display->transparent_bitmap_part; 172 draw_func = display->transparent_bitmap_part;
@@ -171,8 +174,6 @@ void screen_put_iconxy(struct screen * display,
171#endif 174#endif
172 draw_func = display->bitmap_part; 175 draw_func = display->bitmap_part;
173 176
174 if (lang_is_rtl())
175 xpos = display->getwidth() - xpos - width;
176 draw_func(data, 0, height * icon, stride, xpos, ypos, width, height); 177 draw_func(data, 0, height * icon, stride, xpos, ypos, width, height);
177} 178}
178 179