1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Teruaki Kawashima 2010-10-08 14:26:36 +00:00
parent 09d8975084
commit cc8918e909
2 changed files with 25 additions and 22 deletions

View file

@ -224,6 +224,15 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap *bm, int x,
starty = start; 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 LCD_DEPTH > 1
if (bm->format == FORMAT_MONO) if (bm->format == FORMAT_MONO)
#endif #endif

View file

@ -196,7 +196,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
if (pb->have_bitmap_pb) if (pb->have_bitmap_pb)
gui_bitmap_scrollbar_draw(display, &pb->bm, 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); length, 0, end, flags);
else else
gui_scrollbar_draw(display, pb->x, y, pb->width, height, 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) if (pb->slider)
{ {
int x = pb->x, y = pb->y; int xoff = 0, yoff = 0;
int width = pb->width; int w = pb->width, h = height;
int height = pb->height;
struct gui_img *img = pb->slider; 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) if (flags&INVERTFILL)
y += pb->height - pb->height*end/length; xoff = pb->width - xoff;
else
y += pb->height*end/length;
#if 0 /* maybe add this in later, make the slider bmp overlap abit */ #if 0 /* maybe add this in later, make the slider bmp overlap abit */
if ((flags&INNER_NOFILL) == 0) xoff -= w / 2;
y -= img->bm.height/2;
#endif #endif
} }
else else
{ {
width = img->bm.width; h = img->bm.height;
yoff = height * end / length;
if (flags&INVERTFILL) if (flags&INVERTFILL)
x += pb->width - pb->width*end/length; yoff = height - yoff;
else
x += pb->width*end/length;
#if 0 /* maybe add this in later, make the slider bmp overlap abit */ #if 0 /* maybe add this in later, make the slider bmp overlap abit */
if ((flags&INNER_NOFILL) == 0) yoff -= h / 2;
x -= img->bm.width/2;
#endif #endif
} }
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if(img->bm.format == FORMAT_MONO) { if(img->bm.format == FORMAT_MONO) {
#endif #endif
display->mono_bitmap_part(img->bm.data, display->mono_bitmap_part(img->bm.data,
0, 0, 0, 0, img->bm.width,
img->bm.width, x, pb->x + xoff, y + yoff, w, h);
y, width, height);
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
} else { } else {
display->transparent_bitmap_part((fb_data *)img->bm.data, display->transparent_bitmap_part((fb_data *)img->bm.data,
0, 0, 0, 0,
STRIDE(display->screen_type, STRIDE(display->screen_type,
img->bm.width, img->bm.height), img->bm.width, img->bm.height),
x, y, width, height); pb->x + xoff, y + yoff, w, h);
} }
#endif #endif
} }