summaryrefslogtreecommitdiff
path: root/image/jpeg.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-08-10 20:28:23 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-08-10 20:28:23 +0100
commit642470fb74c4a3c9e5dd222a64a19da75b807537 (patch)
tree3bd0ee05e1afc07be56c1a52900497adcc396133 /image/jpeg.c
parent53a379ea45a3dd497c5471acc692addfe3f5297e (diff)
downloadnetsurf-642470fb74c4a3c9e5dd222a64a19da75b807537.tar.gz
netsurf-642470fb74c4a3c9e5dd222a64a19da75b807537.tar.bz2
Avoid two duplicate lines.
Diffstat (limited to 'image/jpeg.c')
-rw-r--r--image/jpeg.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/image/jpeg.c b/image/jpeg.c
index 92443bd0e..27d79bb11 100644
--- a/image/jpeg.c
+++ b/image/jpeg.c
@@ -245,14 +245,16 @@ jpeg_cache_convert(struct content *c)
rowstride = bitmap_get_rowstride(bitmap);
do {
JSAMPROW scanlines[1];
-#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
- int i;
scanlines[0] = (JSAMPROW) (pixels +
rowstride * cinfo.output_scanline);
jpeg_read_scanlines(&cinfo, scanlines, 1);
- /* expand to RGBA */
+#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
+{
+ /* Missmatch between configured libjpeg pixel format and
+ * NetSurf pixel format. Convert to RGBA */
+ int i;
for (i = width - 1; 0 <= i; i--) {
int r = scanlines[0][i * RGB_PIXELSIZE + RGB_RED];
int g = scanlines[0][i * RGB_PIXELSIZE + RGB_GREEN];
@@ -262,11 +264,7 @@ jpeg_cache_convert(struct content *c)
scanlines[0][i * 4 + 2] = b;
scanlines[0][i * 4 + 3] = 0xff;
}
-#else
- scanlines[0] = (JSAMPROW) (pixels +
- rowstride * cinfo.output_scanline);
- jpeg_read_scanlines(&cinfo, scanlines, 1);
-
+}
#endif
} while (cinfo.output_scanline != cinfo.output_height);
bitmap_modified(bitmap);