From d9a55ac8167a9bf9b7cb091ba49db59108a57d41 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sat, 4 Nov 2017 12:09:16 -0400 Subject: 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 --- apps/plugins/puzzles/rockbox.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apps/plugins/puzzles') 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)); } -- cgit v1.2.3