diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2010-02-28 16:39:36 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2010-02-28 16:39:36 +0000 |
commit | c1689ca80d3f43ca079062864fe0d9c2c32ff99b (patch) | |
tree | ca1a1e94d2389b3f621d393f6eb340c4276f7837 | |
parent | af7c5c88427e5ee6b1cffd43b240c35d20b60f8a (diff) | |
download | rockbox-c1689ca80d3f43ca079062864fe0d9c2c32ff99b.tar.gz rockbox-c1689ca80d3f43ca079062864fe0d9c2c32ff99b.zip |
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
-rw-r--r-- | apps/plugins/imageviewer/bmp/bmp.c | 11 |
1 files changed, 11 insertions, 0 deletions
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, | |||
167 | int ds = 1; | 167 | int ds = 1; |
168 | /* check size of image needed to load image. */ | 168 | /* check size of image needed to load image. */ |
169 | size = scaled_read_bmp_fd(fd, &bmp, 0, format | FORMAT_RETURN_SIZE, cformat); | 169 | size = scaled_read_bmp_fd(fd, &bmp, 0, format | FORMAT_RETURN_SIZE, cformat); |
170 | #if (LCD_PIXEL_ASPECT_HEIGHT != 1 || LCD_PIXEL_ASPECT_WIDTH != 1) | ||
171 | if (size <= *buf_size) | ||
172 | { | ||
173 | /* correct aspect */ | ||
174 | format |= FORMAT_RESIZE|FORMAT_KEEP_ASPECT; | ||
175 | bmp.width *= LCD_PIXEL_ASPECT_HEIGHT; | ||
176 | bmp.height *= LCD_PIXEL_ASPECT_WIDTH; | ||
177 | bmp.width /= MAX(LCD_PIXEL_ASPECT_HEIGHT, LCD_PIXEL_ASPECT_WIDTH); | ||
178 | bmp.height /= MAX(LCD_PIXEL_ASPECT_HEIGHT, LCD_PIXEL_ASPECT_WIDTH); | ||
179 | } | ||
180 | #endif | ||
170 | #ifdef USE_PLUG_BUF | 181 | #ifdef USE_PLUG_BUF |
171 | if (!plug_buf) | 182 | if (!plug_buf) |
172 | #endif | 183 | #endif |