summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine/skin_display.c
diff options
context:
space:
mode:
authorAlex Mayer <magictrick4906@aim.com>2013-01-22 20:44:18 -0500
committerJonathan Gordon <rockbox@jdgordon.info>2013-02-19 07:27:54 +0100
commitee758c5a97f8755e5f2ae2583ce757201450c106 (patch)
tree2fa923bddf4ab2026127951a92fd622e1a5ebbf8 /apps/gui/skin_engine/skin_display.c
parentbc0524251796b882705f37f1f270145530ef63fa (diff)
downloadrockbox-ee758c5a97f8755e5f2ae2583ce757201450c106.tar.gz
rockbox-ee758c5a97f8755e5f2ae2583ce757201450c106.zip
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 <saint.lascivious@gmail.com> Tested-by: Hayden Pearce <saint.lascivious@gmail.com> Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
Diffstat (limited to 'apps/gui/skin_engine/skin_display.c')
-rwxr-xr-x[-rw-r--r--]apps/gui/skin_engine/skin_display.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 24958a46f2..c33e38392d 100644..100755
--- 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);
}