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 /apps/gui | |
parent | 09d897508454adb6471c5dbc74057c282bfe8446 (diff) |
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
Diffstat (limited to 'apps/gui')
-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, starty = start; } + if (bm->width < startx) + width = 0; + else if (bm->width < startx + width) + width = bm->width - startx; + if (bm->height < starty) + height = 0; + else if (bm->height < starty + height) + height = bm->height - starty; + #if LCD_DEPTH > 1 if (bm->format == FORMAT_MONO) #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) if (pb->have_bitmap_pb) gui_bitmap_scrollbar_draw(display, &pb->bm, - pb->x, y, pb->width, pb->bm.height, + pb->x, y, pb->width, height, length, 0, end, flags); else 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) if (pb->slider) { - int x = pb->x, y = pb->y; - int width = pb->width; - int height = pb->height; + int xoff = 0, yoff = 0; + int w = pb->width, h = height; struct gui_img *img = pb->slider; - - if ((flags&HORIZONTAL) == 0) + + if (flags&HORIZONTAL) { - height = img->bm.height; + w = img->bm.width; + xoff = pb->width * end / length; if (flags&INVERTFILL) - y += pb->height - pb->height*end/length; - else - y += pb->height*end/length; + xoff = pb->width - xoff; #if 0 /* maybe add this in later, make the slider bmp overlap abit */ - if ((flags&INNER_NOFILL) == 0) - y -= img->bm.height/2; + xoff -= w / 2; #endif } else { - width = img->bm.width; + h = img->bm.height; + yoff = height * end / length; if (flags&INVERTFILL) - x += pb->width - pb->width*end/length; - else - x += pb->width*end/length; + yoff = height - yoff; #if 0 /* maybe add this in later, make the slider bmp overlap abit */ - if ((flags&INNER_NOFILL) == 0) - x -= img->bm.width/2; + yoff -= h / 2; #endif } #if LCD_DEPTH > 1 if(img->bm.format == FORMAT_MONO) { #endif display->mono_bitmap_part(img->bm.data, - 0, 0, - img->bm.width, x, - y, width, height); + 0, 0, img->bm.width, + pb->x + xoff, y + yoff, w, h); #if LCD_DEPTH > 1 } else { display->transparent_bitmap_part((fb_data *)img->bm.data, 0, 0, STRIDE(display->screen_type, img->bm.width, img->bm.height), - x, y, width, height); + pb->x + xoff, y + yoff, w, h); } #endif } |