summaryrefslogtreecommitdiff
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)
207 /* clear the slider */ 207 /* clear the slider */
208 screen_clear_area(display, x, y, width, height); 208 screen_clear_area(display, x, y, width, height);
209 209
210 /* shrink the bar so the slider is inside bounds */ 210 /* account for the sliders width in the progressbar */
211 if (flags&HORIZONTAL) 211 if (flags&HORIZONTAL)
212 { 212 {
213 width -= img->bm.width; 213 width -= img->bm.width;
214 x += img->bm.width / 2;
215 } 214 }
216 else 215 else
217 { 216 {
218 height -= img->bm.height; 217 height -= img->bm.height;
219 y += img->bm.height / 2;
220 } 218 }
221 } 219 }
222 220
223 if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->backdrop)) 221 if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->backdrop))
224 { 222 {
225 struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->backdrop); 223 struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->backdrop);
226 img->bm.data = core_get_data(img->buflib_handle); 224 img->bm.data = core_get_data(img->buflib_handle);
227 display->bmp_part(&img->bm, 0, 0, x, y, width, height); 225 display->bmp_part(&img->bm, 0, 0, x, y, pb->width, height);
228 flags |= DONT_CLEAR_EXCESS; 226 flags |= DONT_CLEAR_EXCESS;
229 } 227 }
230 228
231 if (!pb->nobar) 229 if (!pb->nobar)
232 { 230 {
233 struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->image); 231 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)
257 xoff = width * end / length; 255 xoff = width * end / length;
258 if (flags&INVERTFILL) 256 if (flags&INVERTFILL)
259 xoff = width - xoff; 257 xoff = width - xoff;
260 xoff -= w / 2;
261 } 258 }
262 else 259 else
263 { 260 {
@@ -265,7 +262,6 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
265 yoff = height * end / length; 262 yoff = height * end / length;
266 if (flags&INVERTFILL) 263 if (flags&INVERTFILL)
267 yoff = height - yoff; 264 yoff = height - yoff;
268 yoff -= h / 2;
269 } 265 }
270 display->bmp_part(&img->bm, 0, 0, x + xoff, y + yoff, w, h); 266 display->bmp_part(&img->bm, 0, 0, x + xoff, y + yoff, w, h);
271 } 267 }