From ee758c5a97f8755e5f2ae2583ce757201450c106 Mon Sep 17 00:00:00 2001 From: Alex Mayer Date: Tue, 22 Jan 2013 20:44:18 -0500 Subject: Theme Engine: Fix progress bar slider (FS#12823) Fix the need to resize progress bar when using a slider. Slider stays in bounds. Progress bar is not resized. Works well with square sliders that should not overlap edge of progress bar. also works with rounded sliders. You can also make progress bar the full width of screen while using a slider. Before if you would make the progress bar the full width of the screen and add a slider the progress bar would look like it was padded on both ends. This fixes FS#12823 Change-Id: I60345efc5cd0f46286f2591ed032f0d9320d1c3e Reviewed-on: http://gerrit.rockbox.org/402 Reviewed-by: Hayden Pearce Tested-by: Hayden Pearce Reviewed-by: Jonathan Gordon --- apps/gui/skin_engine/skin_display.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) mode change 100644 => 100755 apps/gui/skin_engine/skin_display.c (limited to 'apps/gui/skin_engine/skin_display.c') diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c old mode 100644 new mode 100755 index 24958a46f2..c33e38392d --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -207,27 +207,25 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) /* clear the slider */ screen_clear_area(display, x, y, width, height); - /* shrink the bar so the slider is inside bounds */ + /* account for the sliders width in the progressbar */ if (flags&HORIZONTAL) { width -= img->bm.width; - x += img->bm.width / 2; } else { height -= img->bm.height; - y += img->bm.height / 2; } } - + if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->backdrop)) { struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->backdrop); img->bm.data = core_get_data(img->buflib_handle); - display->bmp_part(&img->bm, 0, 0, x, y, width, height); + display->bmp_part(&img->bm, 0, 0, x, y, pb->width, height); flags |= DONT_CLEAR_EXCESS; } - + if (!pb->nobar) { struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->image); @@ -257,7 +255,6 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) xoff = width * end / length; if (flags&INVERTFILL) xoff = width - xoff; - xoff -= w / 2; } else { @@ -265,7 +262,6 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) yoff = height * end / length; if (flags&INVERTFILL) yoff = height - yoff; - yoff -= h / 2; } display->bmp_part(&img->bm, 0, 0, x + xoff, y + yoff, w, h); } -- cgit