[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Thu Mar 16 08:56:02 UTC 2017


 vcl/source/filter/jpeg/jpegc.cxx |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

New commits:
commit ceb53ad9f34ae05d09f61845d581546eac0c6d60
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 15 13:58:18 2017 +0000

    can set the out_color_space after jpeg_start_decompress
    
    Change-Id: I8432f5147a3e73f0a4eafefceab7fbf715f58acf
    Reviewed-on: https://gerrit.libreoffice.org/35228
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index 1eb290f..8b5b483 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -93,20 +93,6 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
     cinfo.output_gamma = 1.0;
     cinfo.raw_data_out = FALSE;
     cinfo.quantize_colors = FALSE;
-    ScanlineFormat eScanlineFormat = ScanlineFormat::N24BitTcRgb;
-    int nPixelSize = 3;
-    if ( cinfo.jpeg_color_space == JCS_YCbCr )
-        cinfo.out_color_space = JCS_RGB;
-    else if ( cinfo.jpeg_color_space == JCS_YCCK )
-        cinfo.out_color_space = JCS_CMYK;
-
-    if (cinfo.out_color_space != JCS_CMYK &&
-        cinfo.out_color_space != JCS_GRAYSCALE &&
-        cinfo.out_color_space != JCS_RGB)
-    {
-        SAL_WARN("vcl.filter", "jpg with unknown out color space, forcing to rgb");
-        cinfo.out_color_space = JCS_RGB;
-    }
 
     /* change scale for preview import */
     long nPreviewWidth = previewSize.Width();
@@ -171,6 +157,21 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
 
         if (pAccess)
         {
+            ScanlineFormat eScanlineFormat = ScanlineFormat::N24BitTcRgb;
+            int nPixelSize = 3;
+            if ( cinfo.jpeg_color_space == JCS_YCbCr )
+                cinfo.out_color_space = JCS_RGB;
+            else if ( cinfo.jpeg_color_space == JCS_YCCK )
+                cinfo.out_color_space = JCS_CMYK;
+
+            if (cinfo.out_color_space != JCS_CMYK &&
+                cinfo.out_color_space != JCS_GRAYSCALE &&
+                cinfo.out_color_space != JCS_RGB)
+            {
+                SAL_WARN("vcl.filter", "jpg with unknown out color space, forcing to rgb");
+                cinfo.out_color_space = JCS_RGB;
+            }
+
             JSAMPLE* aRangeLimit = cinfo.sample_range_limit;
 
             std::vector<sal_uInt8> pScanLineBuffer(nWidth * (bGray ? 1 : nPixelSize));


More information about the Libreoffice-commits mailing list