vcl/source/gdi/pngread.cxx |   26 +++++++++++++-------------
 vcl/workben/fftester.cxx   |    1 +
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit b22ddf60d5c42f39b39214134e819c582b58ad3d
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Nov 6 09:51:29 2017 +0000

    mbIDAT is actually set when mbIDAT is complete, not when started
    
    Change-Id: I8d733ab07b6e989c05f131b61441da7e6d124772

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 0752d52ff6f7..a29ed669d048 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -126,7 +126,7 @@ private:
     bool                mbGrayScale : 1;
     bool                mbzCodecInUse : 1;
     bool                mbStatus : 1;
-    bool                mbIDAT : 1;         // true if finished with enough 
IDAT chunks
+    bool                mbIDATComplete : 1; // true if finished with enough 
IDAT chunks
     bool                mbpHYs : 1;         // true if physical size of pixel 
available
     bool                mbIgnoreGammaChunk : 1;
 
@@ -205,7 +205,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
     mbGrayScale( false ),
     mbzCodecInUse   ( false ),
     mbStatus( true ),
-    mbIDAT( false ),
+    mbIDATComplete( false ),
     mbpHYs              ( false ),
     mbIgnoreGammaChunk  ( false ),
 #if OSL_DEBUG_LEVEL > 0
@@ -341,7 +341,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
     }
 
     // parse the remaining chunks
-    while (mbStatus && !mbIDAT && ReadNextChunk())
+    while (mbStatus && !mbIDATComplete && ReadNextChunk())
     {
         switch( mnChunkType )
         {
@@ -353,7 +353,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 
             case PNGCHUNK_gAMA :                                // the gamma 
chunk must precede
             {                                                   // the 'IDAT' 
and also the 'PLTE'(if available )
-                if ( !mbIgnoreGammaChunk && !mbIDAT )
+                if (!mbIgnoreGammaChunk && !mbIDATComplete)
                     ImplGetGamma();
             }
             break;
@@ -367,14 +367,14 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 
             case PNGCHUNK_tRNS :
             {
-                if ( !mbIDAT )                                  // the tRNS 
chunk must precede the IDAT
+                if (!mbIDATComplete)                            // the tRNS 
chunk must precede the IDAT
                     mbStatus = ImplReadTransparent();
             }
             break;
 
             case PNGCHUNK_bKGD :                                // the 
background chunk must appear
             {
-                if ( !mbIDAT && mbPalette )         // before the 'IDAT' and 
after the
+                if (!mbIDATComplete && mbPalette)               // before the 
'IDAT' and after the
                     ImplGetBackground();                        // PLTE(if 
available ) chunk.
             }
             break;
@@ -383,14 +383,14 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
             {
                 if ( !mpInflateInBuf )  // taking care that the header has 
properly been read
                     mbStatus = false;
-                else if ( !mbIDAT )     // the gfx is finished, but there may 
be left a zlibCRC of about 4Bytes
+                else if (!mbIDATComplete) // the gfx is finished, but there 
may be left a zlibCRC of about 4Bytes
                     ImplReadIDAT();
             }
             break;
 
             case PNGCHUNK_pHYs :
             {
-                if ( !mbIDAT && mnChunkLen == 9 )
+                if (!mbIDATComplete && mnChunkLen == 9)
                 {
                     sal_uInt32 nXPixelPerMeter = ImplReadsal_uInt32();
                     sal_uInt32 nYPixelPerMeter = ImplReadsal_uInt32();
@@ -409,7 +409,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
             break;
 
             case PNGCHUNK_IEND:
-                mbStatus = mbIDAT;  // there is a problem if the image is not 
complete yet
+                mbStatus = mbIDATComplete;  // there is a problem if the image 
is not complete yet
             break;
         }
     }
@@ -423,7 +423,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
     // return the resulting BitmapEx
     BitmapEx aRet;
 
-    if( !mbStatus || !mbIDAT )
+    if (!mbStatus || !mbIDATComplete)
         aRet.Clear();
     else
     {
@@ -479,7 +479,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& 
rPreviewSizeHint )
     }
 
     mbPalette = true;
-    mbIDAT = mbAlphaChannel = mbTransparent = false;
+    mbIDATComplete = mbAlphaChannel = mbTransparent = false;
     mbGrayScale = mbRGBTriple = false;
     mnTargetDepth = mnPngDepth;
     sal_uInt64 nScansize64 = ( ( static_cast< sal_uInt64 >( maOrigSize.Width() 
) * mnPngDepth ) + 7 ) >> 3;
@@ -929,13 +929,13 @@ void PNGReaderImpl::ImplReadIDAT()
                 if( (mnPass < 7) && mnInterlaceType )
                     if( ImplPreparePass() )
                         continue;
-                mbIDAT = true;
+                mbIDATComplete = true;
                 break;
             }
         }
     }
 
-    if( mbIDAT )
+    if (mbIDATComplete)
     {
         mpZCodec.EndCompression();
         mbzCodecInUse = false;
commit cf5088018057ad44ba52139a3bafbb2f0504389d
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Nov 6 09:20:31 2017 +0000

    fix png fftester path
    
    Change-Id: Ia25bc32dda97ef3413b468142176c1197bd5e8c7

diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index de87da8c476c..40dea13576b5 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -124,6 +124,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         {
             SvFileStream aFileStream(out, StreamMode::READ);
             vcl::PNGReader aReader(aFileStream);
+            ret = !!aReader.Read();
         }
         else if (strcmp(argv[2], "bmp") == 0)
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to