summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-10-08 04:52:44 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-10-08 04:52:44 +0000
commit5a435e62d062c7bc75c27a324e89de06cc4543f9 (patch)
treeef663d866487bb2e58f587d4728bfdd1742c37b8
parent573d3f284587b5c0aa70668e684cac89dc86e560 (diff)
downloadrockbox-5a435e62d062c7bc75c27a324e89de06cc4543f9.tar.gz
rockbox-5a435e62d062c7bc75c27a324e89de06cc4543f9.tar.bz2
rockbox-5a435e62d062c7bc75c27a324e89de06cc4543f9.zip
PPM viewer - initial support for vertical strides - scaler needs to be modified for full support.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23006 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/ppmviewer.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/plugins/ppmviewer.c b/apps/plugins/ppmviewer.c
index 56193b3c47..cc7440de96 100644
--- a/apps/plugins/ppmviewer.c
+++ b/apps/plugins/ppmviewer.c
@@ -193,12 +193,23 @@ void read_ppm_init(int fd,
}
}
+#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
+#define BUFADDR(x, y, width, height) ( buffer + height*(x) + (y))
+#else
+#define BUFADDR(x, y, width, height) ( buffer + width*(y) + (x))
+#endif
+
int read_ppm_row(int fd,
int const row,
int const cols,
+ int const rows,
int const maxval,
int const format)
{
+#if !(defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE)
+ (void) rows;
+#endif
+
int col;
int r, g, b;
switch (format) {
@@ -213,7 +224,7 @@ int read_ppm_row(int fd,
{
return PLUGIN_ERROR;
}
- buffer[(cols * row) + col] = LCD_RGBPACK(
+ *BUFADDR(col, row, cols, rows) = LCD_RGBPACK(
(255 / maxval) * r,
(255 / maxval) * g,
(255 / maxval) * b);
@@ -231,7 +242,7 @@ int read_ppm_row(int fd,
{
return PLUGIN_ERROR;
}
- buffer[(cols * row) + col] = LCD_RGBPACK(
+ *BUFADDR(col, row, cols, rows) = LCD_RGBPACK(
(255 / maxval) * r,
(255 / maxval) * g,
(255 / maxval) * b);
@@ -260,7 +271,7 @@ int read_ppm(int fd,
}
for (row = 0; row < *rows; ++row) {
- if( read_ppm_row(fd, row, *cols, *maxval, format) == PLUGIN_ERROR) {
+ if( read_ppm_row(fd, row, *cols, *rows, *maxval, format) == PLUGIN_ERROR) {
return PLUGIN_ERROR;
}
}