diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2010-10-08 14:26:36 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2010-10-08 14:26:36 +0000 |
commit | cc8918e909acf3eee6011b78ed9b6e200cfc1d0b (patch) | |
tree | 68094aa44573038f3ce66fba33cc00429719f50b | |
parent | 09d897508454adb6471c5dbc74057c282bfe8446 (diff) | |
download | rockbox-cc8918e909acf3eee6011b78ed9b6e200cfc1d0b.tar.gz rockbox-cc8918e909acf3eee6011b78ed9b6e200cfc1d0b.zip |
fix displaying of the slider when default is used for pb->y and pb->height.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28220 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/scrollbar.c | 9 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 38 |
2 files changed, 25 insertions, 22 deletions
diff --git a/apps/gui/scrollbar.c b/apps/gui/scrollbar.c index 17d280b1ca..83e86c1527 100644 --- a/apps/gui/scrollbar.c +++ b/apps/gui/scrollbar.c | |||
@@ -224,6 +224,15 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap *bm, int x, | |||
224 | starty = start; | 224 | starty = start; |
225 | } | 225 | } |
226 | 226 | ||
227 | if (bm->width < startx) | ||
228 | width = 0; | ||
229 | else if (bm->width < startx + width) | ||
230 | width = bm->width - startx; | ||
231 | if (bm->height < starty) | ||
232 | height = 0; | ||
233 | else if (bm->height < starty + height) | ||
234 | height = bm->height - starty; | ||
235 | |||
227 | #if LCD_DEPTH > 1 | 236 | #if LCD_DEPTH > 1 |
228 | if (bm->format == FORMAT_MONO) | 237 | if (bm->format == FORMAT_MONO) |
229 | #endif | 238 | #endif |
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index a4588bb861..8638d2c902 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -196,7 +196,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | |||
196 | 196 | ||
197 | if (pb->have_bitmap_pb) | 197 | if (pb->have_bitmap_pb) |
198 | gui_bitmap_scrollbar_draw(display, &pb->bm, | 198 | gui_bitmap_scrollbar_draw(display, &pb->bm, |
199 | pb->x, y, pb->width, pb->bm.height, | 199 | pb->x, y, pb->width, height, |
200 | length, 0, end, flags); | 200 | length, 0, end, flags); |
201 | else | 201 | else |
202 | gui_scrollbar_draw(display, pb->x, y, pb->width, height, | 202 | gui_scrollbar_draw(display, pb->x, y, pb->width, height, |
@@ -204,49 +204,43 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | |||
204 | 204 | ||
205 | if (pb->slider) | 205 | if (pb->slider) |
206 | { | 206 | { |
207 | int x = pb->x, y = pb->y; | 207 | int xoff = 0, yoff = 0; |
208 | int width = pb->width; | 208 | int w = pb->width, h = height; |
209 | int height = pb->height; | ||
210 | struct gui_img *img = pb->slider; | 209 | struct gui_img *img = pb->slider; |
211 | 210 | ||
212 | if ((flags&HORIZONTAL) == 0) | 211 | if (flags&HORIZONTAL) |
213 | { | 212 | { |
214 | height = img->bm.height; | 213 | w = img->bm.width; |
214 | xoff = pb->width * end / length; | ||
215 | if (flags&INVERTFILL) | 215 | if (flags&INVERTFILL) |
216 | y += pb->height - pb->height*end/length; | 216 | xoff = pb->width - xoff; |
217 | else | ||
218 | y += pb->height*end/length; | ||
219 | #if 0 /* maybe add this in later, make the slider bmp overlap abit */ | 217 | #if 0 /* maybe add this in later, make the slider bmp overlap abit */ |
220 | if ((flags&INNER_NOFILL) == 0) | 218 | xoff -= w / 2; |
221 | y -= img->bm.height/2; | ||
222 | #endif | 219 | #endif |
223 | } | 220 | } |
224 | else | 221 | else |
225 | { | 222 | { |
226 | width = img->bm.width; | 223 | h = img->bm.height; |
224 | yoff = height * end / length; | ||
227 | if (flags&INVERTFILL) | 225 | if (flags&INVERTFILL) |
228 | x += pb->width - pb->width*end/length; | 226 | yoff = height - yoff; |
229 | else | ||
230 | x += pb->width*end/length; | ||
231 | #if 0 /* maybe add this in later, make the slider bmp overlap abit */ | 227 | #if 0 /* maybe add this in later, make the slider bmp overlap abit */ |
232 | if ((flags&INNER_NOFILL) == 0) | 228 | yoff -= h / 2; |
233 | x -= img->bm.width/2; | ||
234 | #endif | 229 | #endif |
235 | } | 230 | } |
236 | #if LCD_DEPTH > 1 | 231 | #if LCD_DEPTH > 1 |
237 | if(img->bm.format == FORMAT_MONO) { | 232 | if(img->bm.format == FORMAT_MONO) { |
238 | #endif | 233 | #endif |
239 | display->mono_bitmap_part(img->bm.data, | 234 | display->mono_bitmap_part(img->bm.data, |
240 | 0, 0, | 235 | 0, 0, img->bm.width, |
241 | img->bm.width, x, | 236 | pb->x + xoff, y + yoff, w, h); |
242 | y, width, height); | ||
243 | #if LCD_DEPTH > 1 | 237 | #if LCD_DEPTH > 1 |
244 | } else { | 238 | } else { |
245 | display->transparent_bitmap_part((fb_data *)img->bm.data, | 239 | display->transparent_bitmap_part((fb_data *)img->bm.data, |
246 | 0, 0, | 240 | 0, 0, |
247 | STRIDE(display->screen_type, | 241 | STRIDE(display->screen_type, |
248 | img->bm.width, img->bm.height), | 242 | img->bm.width, img->bm.height), |
249 | x, y, width, height); | 243 | pb->x + xoff, y + yoff, w, h); |
250 | } | 244 | } |
251 | #endif | 245 | #endif |
252 | } | 246 | } |