summaryrefslogtreecommitdiffstats
path: root/apps/plugins/imageviewer
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/imageviewer')
-rw-r--r--apps/plugins/imageviewer/imageviewer.c11
-rw-r--r--apps/plugins/imageviewer/jpeg/yuv2rgb.c12
2 files changed, 18 insertions, 5 deletions
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c
index 37c5838d73..4b1a982438 100644
--- a/apps/plugins/imageviewer/imageviewer.c
+++ b/apps/plugins/imageviewer/imageviewer.c
@@ -509,6 +509,13 @@ static void pan_view_up(struct image_info *info)
the bottom */
static void pan_view_down(struct image_info *info)
{
+ static fb_data *lcd_fb = NULL;
+ if (!lcd_fb)
+ {
+ struct viewport *vp_main = *(rb->screens[SCREEN_MAIN]->current_viewport);
+ lcd_fb = vp_main->buffer->fb_ptr;
+ }
+
int move;
move = MIN(VSCROLL, info->height - info->y - LCD_HEIGHT);
@@ -526,7 +533,7 @@ static void pan_view_down(struct image_info *info)
*/
move++, info->y--;
rb->memcpy(rgb_linebuf,
- *rb->lcd_framebuffer + (LCD_HEIGHT - move)*LCD_WIDTH,
+ lcd_fb + (LCD_HEIGHT - move)*LCD_WIDTH,
LCD_WIDTH*sizeof (fb_data));
}
#endif
@@ -539,7 +546,7 @@ static void pan_view_down(struct image_info *info)
&& settings.jpeg_dither_mode == DITHER_DIFFUSION)
{
/* Cover the first row drawn with previous image data. */
- rb->memcpy(*rb->lcd_framebuffer + (LCD_HEIGHT - move)*LCD_WIDTH,
+ rb->memcpy(lcd_fb + (LCD_HEIGHT - move)*LCD_WIDTH,
rgb_linebuf, LCD_WIDTH*sizeof (fb_data));
info->y++;
}
diff --git a/apps/plugins/imageviewer/jpeg/yuv2rgb.c b/apps/plugins/imageviewer/jpeg/yuv2rgb.c
index 5504e425e6..d0d5cb683b 100644
--- a/apps/plugins/imageviewer/jpeg/yuv2rgb.c
+++ b/apps/plugins/imageviewer/jpeg/yuv2rgb.c
@@ -236,15 +236,15 @@ static fb_data (* const pixel_funcs[COLOUR_NUM_MODES][DITHER_NUM_MODES])(void) =
[DITHER_DIFFUSION] = pixel_fsdither_to_lcd,
},
};
-
+static fb_data *lcd_fb = NULL;
/* These defines are used fornormal horizontal strides and vertical strides. */
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
-#define LCDADDR(x, y) (*rb->lcd_framebuffer + LCD_HEIGHT*(x) + (y))
+#define LCDADDR(x, y) (lcd_fb + LCD_HEIGHT*(x) + (y))
#define ROWENDOFFSET (width*LCD_HEIGHT)
#define ROWOFFSET (1)
#define COLOFFSET (LCD_HEIGHT)
#else
-#define LCDADDR(x, y) (*rb->lcd_framebuffer + LCD_WIDTH*(y) + (x))
+#define LCDADDR(x, y) (lcd_fb + LCD_WIDTH*(y) + (x))
#define ROWENDOFFSET (width)
#define ROWOFFSET (LCD_WIDTH)
#define COLOFFSET (1)
@@ -261,6 +261,12 @@ void yuv_bitmap_part(unsigned char *src[3], int csub_x, int csub_y,
int x, int y, int width, int height,
int colour_mode, int dither_mode)
{
+ if (!lcd_fb)
+ {
+ struct viewport *vp_main = *(rb->screens[SCREEN_MAIN]->current_viewport);
+ lcd_fb = vp_main->buffer->fb_ptr;
+ }
+
fb_data *dst, *dst_end;
fb_data (*pixel_func)(void);
struct rgb_pixel px;