From 642470fb74c4a3c9e5dd222a64a19da75b807537 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 10 Aug 2012 20:28:23 +0100 Subject: Avoid two duplicate lines. --- image/jpeg.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'image/jpeg.c') 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); -- cgit v1.2.3