1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Karl Kurbjun 2009-10-08 04:52:44 +00:00
parent 573d3f2845
commit 5a435e62d0

View file

@ -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;
}
}