From c1689ca80d3f43ca079062864fe0d9c2c32ff99b Mon Sep 17 00:00:00 2001 From: Teruaki Kawashima Date: Sun, 28 Feb 2010 16:39:36 +0000 Subject: bmpviewer: do aspect ratio correction. it might be better to not change the message "loading width x height"? git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24976 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/imageviewer/bmp/bmp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'apps') diff --git a/apps/plugins/imageviewer/bmp/bmp.c b/apps/plugins/imageviewer/bmp/bmp.c index 73a4d738ac..1229ac3d35 100644 --- a/apps/plugins/imageviewer/bmp/bmp.c +++ b/apps/plugins/imageviewer/bmp/bmp.c @@ -167,6 +167,17 @@ int load_image(char *filename, struct image_info *info, int ds = 1; /* check size of image needed to load image. */ size = scaled_read_bmp_fd(fd, &bmp, 0, format | FORMAT_RETURN_SIZE, cformat); +#if (LCD_PIXEL_ASPECT_HEIGHT != 1 || LCD_PIXEL_ASPECT_WIDTH != 1) + if (size <= *buf_size) + { + /* correct aspect */ + format |= FORMAT_RESIZE|FORMAT_KEEP_ASPECT; + bmp.width *= LCD_PIXEL_ASPECT_HEIGHT; + bmp.height *= LCD_PIXEL_ASPECT_WIDTH; + bmp.width /= MAX(LCD_PIXEL_ASPECT_HEIGHT, LCD_PIXEL_ASPECT_WIDTH); + bmp.height /= MAX(LCD_PIXEL_ASPECT_HEIGHT, LCD_PIXEL_ASPECT_WIDTH); + } +#endif #ifdef USE_PLUG_BUF if (!plug_buf) #endif -- cgit v1.2.3