summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-11-04 12:09:16 -0400
committerFranklin Wei <git@fwei.tk>2017-11-04 12:09:16 -0400
commitd9a55ac8167a9bf9b7cb091ba49db59108a57d41 (patch)
tree953bc961174daf2b91b636d9c3d68c0af9821758 /apps/plugins/puzzles
parent7f1dd6f5930e4f2e02dd194adf9d20024af2122c (diff)
puzzles: fix blitting when zoomed
Both blitter_save() and blitter_load() functioned incorrectly when zoomed in -- blitter_save() would copy from the wrong location, and blitter_load() would ignore the y-coordinate of the destination. Change-Id: I7c85debf5953575f72c4a81e3dbcf514202c3aed
Diffstat (limited to 'apps/plugins/puzzles')
-rw-r--r--apps/plugins/puzzles/rockbox.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 454ccfcaea..44df35027a 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -1196,14 +1196,17 @@ static void rb_blitter_save(void *handle, blitter *bl, int x, int y)
if(bl->bmp.data)
{
int w = bl->bmp.width, h = bl->bmp.height;
+ int screen_w = zoom_enabled ? zoom_w : LCD_WIDTH;
+
trim_rect(&x, &y, &w, &h);
+
fb_data *fb = zoom_enabled ? zoom_fb : rb->lcd_framebuffer;
LOGF("rb_blitter_save(%d, %d, %d, %d)", x, y, w, h);
for(int i = 0; i < h; ++i)
{
/* copy line-by-line */
rb->memcpy(bl->bmp.data + sizeof(fb_data) * i * w,
- fb + (y + i) * LCD_WIDTH + x,
+ fb + (y + i) * screen_w + x,
w * sizeof(fb_data));
}
bl->x = x;
@@ -1236,7 +1239,7 @@ static void rb_blitter_load(void *handle, blitter *bl, int x, int y)
{
for(int i = 0; i < h; ++i)
{
- rb->memcpy(zoom_fb + i * zoom_w + x,
+ rb->memcpy(zoom_fb + (y + i) * zoom_w + x,
bl->bmp.data + sizeof(fb_data) * i * w,
w * sizeof(fb_data));
}