diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2008-12-12 02:44:13 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2008-12-12 02:44:13 +0000 |
commit | 66b0d8198e80d85c5c0cf26c9e462309e57c6df6 (patch) | |
tree | 39c50c01b3ff1cc9f077ca938958290adb48b347 /apps | |
parent | ea5457ca90e19ab8b77dca4d61dcf2be27d65444 (diff) | |
download | rockbox-66b0d8198e80d85c5c0cf26c9e462309e57c6df6.tar.gz rockbox-66b0d8198e80d85c5c0cf26c9e462309e57c6df6.zip |
fix broken greyscale upscaling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19393 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/recorder/resize.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index 46c57bcb03..c11a8d6ace 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c @@ -456,7 +456,7 @@ static inline bool scale_nearest(struct bitmap *bm, const int fb_width = get_fb_width(bm, false); long last_tick = current_tick; int ix, ox, lx, xe, iy, oy, ly, ye, yet, oyt; - int ixls, xels, iyls, yelsi, oyls, yelso, p; + int xelim, ixls, xels, yelim, iyls, yels, oyls, p; struct img_part *cur_part; #ifndef HAVE_LCD_COLOR fb_data *dest = dest, *dest_t; @@ -470,12 +470,12 @@ static inline bool scale_nearest(struct bitmap *bm, ly = 0; iy = 0; ye = 0; - ixls = (sw > (dw - 1) && dw > 1) ? sw / (dw - 1) : 1; - xels = sw - ixls * (dw - 1) + (dw == 1 ? 1 : 0); - iyls = (sh > (dh - 1) && dh > 1) ? sh / (dh - 1) : 1; - oyls = dh > sh ? dh / sh : 1; - yelsi = iyls * (dh - 1) + (dh == 1 ? 1 : 0); - yelso = oyls * sh; + xelim = sw == dw - 1 ? dw : dw - 1; + ixls = xelim ? sw / xelim : 1; + xels = sw - ixls * (xelim ? xelim : 1); + yelim = sh == dh - 1 ? dh : dh - 1; + iyls = yelim ? sh / yelim : 1; + yels = iyls * (yelim ? yelim : 1); oyls *= rowstep; int delta = 127; #if LCD_PIXELFORMAT == HORIZONTAL_PACKING || \ @@ -563,7 +563,7 @@ static inline bool scale_nearest(struct bitmap *bm, *dest_t = data; dest_t += rowstep * fb_width; yet += sh; - oyt += 1; + oyt += rowstep; } } #elif LCD_PIXELFORMAT == VERTICAL_PACKING @@ -583,7 +583,7 @@ static inline bool scale_nearest(struct bitmap *bm, if ((rowstep > 0 && shift == 6) || shift == 0) dest_t += rowstep * fb_width; yet += sh; - oyt += 1; + oyt += rowstep; } #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED bright = brightness(*(cur_part->buf)); @@ -601,7 +601,7 @@ static inline bool scale_nearest(struct bitmap *bm, if ((rowstep > 0 && shift == 7) || shift == 0) dest_t += rowstep * fb_width; yet += sh; - oyt += 1; + oyt += rowstep; } #endif /* LCD_PIXELFORMAT */ #ifdef HAVE_REMOTE_LCD @@ -625,7 +625,7 @@ static inline bool scale_nearest(struct bitmap *bm, if ((rowstep > 0 && shift == 7) || shift == 0) rdest_t += rowstep * fb_width; yet += sh; - oyt += 1; + oyt += rowstep; } #else bright = brightness(*(cur_part->buf)); @@ -642,31 +642,25 @@ static inline bool scale_nearest(struct bitmap *bm, if ((rowstep > 0 && shift == 7) || shift == 0) rdest_t += rowstep * fb_width; yet += sh; - oyt += 1; + oyt += rowstep; } #endif } #endif xe += xels; ix += ixls; - while (xe >= dw) + while (xe > xelim) { - xe -= dw - 1; + xe -= xelim; ix += 1; } } - oy += oyls; - ye += yelso; - while (ye < dh) - { - ye += sh; - oy += rowstep; - } + oy = oyt; + ye = yet - yels; iy += iyls; - ye -= yelsi; - while (ye >= dh) + while (ye > yelim) { - ye -= dh - 1; + ye -= yelim; iy += 1; } } |