dev/null                                           |binary
 vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx |   51 ---------------------
 vcl/source/filter/itiff/itiff.cxx                  |    7 +-
 3 files changed, 3 insertions(+), 55 deletions(-)

New commits:
commit 1f81dd9b05c4eaa3e4caae8fe38ef2ee7eb1db49
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Apr 29 13:16:22 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Apr 30 11:49:06 2022 +0200

    ofz#47104 Revert "tdf#74331: 16bit "min-is-black" tiff not loaded correctly"
    
    This reverts commit bd1d0967920655ef85a2352259332f99fef6876e.
    
    Change-Id: I4f4c0aa7d779487b9f3b1da46e7b2e1070f2dba3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133637
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/qa/cppunit/graphicfilter/data/tiff/tdf74331.tif 
b/vcl/qa/cppunit/graphicfilter/data/tiff/tdf74331.tif
deleted file mode 100644
index 702b8218ca5f..000000000000
Binary files a/vcl/qa/cppunit/graphicfilter/data/tiff/tdf74331.tif and 
/dev/null differ
diff --git a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx 
b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
index 72f12ca565f5..5842acf9ae8d 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx
@@ -45,7 +45,6 @@ public:
     void testTdf126460();
     void testTdf115863();
     void testTdf138818();
-    void testTdf74331();
     void testRoundtrip();
     void testRGB8bits();
     void testRGB16bits();
@@ -55,7 +54,6 @@ public:
     CPPUNIT_TEST(testTdf126460);
     CPPUNIT_TEST(testTdf115863);
     CPPUNIT_TEST(testTdf138818);
-    CPPUNIT_TEST(testTdf74331);
     CPPUNIT_TEST(testRoundtrip);
     CPPUNIT_TEST(testRGB8bits);
     CPPUNIT_TEST(testRGB16bits);
@@ -130,55 +128,6 @@ void TiffFilterTest::testTdf138818()
     CPPUNIT_ASSERT_EQUAL(sal_uInt32(46428), 
aGraphic.GetGfxLink().GetDataSize());
 }
 
-void TiffFilterTest::testTdf74331()
-{
-    OUString aURL = getUrl() + "tdf74331.tif";
-    SvFileStream aFileStream(aURL, StreamMode::READ);
-    Graphic aGraphic;
-    GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
-
-    ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream);
-
-    CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
-
-    Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
-    Size aSize = aBitmap.GetSizePixel();
-    CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Width());
-    CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Height());
-
-    Bitmap::ScopedReadAccess pReadAccess(aBitmap);
-
-    // Check the image contains different kinds of grays
-    int nGrayCount = 0;
-    int nGray3Count = 0;
-    int nGray7Count = 0;
-    int nLightGrayCount = 0;
-
-    for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
-    {
-        for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
-        {
-            const Color aColor = pReadAccess->GetColor(nY, nX);
-            if (aColor == COL_GRAY)
-                ++nGrayCount;
-            else if (aColor == COL_GRAY3)
-                ++nGray3Count;
-            else if (aColor == COL_GRAY7)
-                ++nGray7Count;
-            else if (aColor == COL_LIGHTGRAY)
-                ++nLightGrayCount;
-        }
-    }
-
-    // Without the fix in place, this test would have failed with
-    // - Expected: 313
-    // - Actual  : 0
-    CPPUNIT_ASSERT_EQUAL(313, nGrayCount);
-    CPPUNIT_ASSERT_EQUAL(71, nGray3Count);
-    CPPUNIT_ASSERT_EQUAL(227, nGray7Count);
-    CPPUNIT_ASSERT_EQUAL(165, nLightGrayCount);
-}
-
 void TiffFilterTest::testRoundtrip()
 {
     Bitmap aBitmap(Size(2, 2), vcl::PixelFormat::N24_BPP);
diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index c9f73a742875..7fa66b746c5d 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -859,7 +859,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
     sal_uInt32  nRed, nGreen, nBlue, ns, nVal;
     sal_uInt8   nByteVal;
 
-    if ( nDstBitsPerPixel == 24 || (nDstBitsPerPixel == 8 && 
nPhotometricInterpretation <= 1 && nSamplesPerPixel == 1) )
+    if ( nDstBitsPerPixel == 24 )
     {
         if ( nBitsPerSample == 8 && nSamplesPerPixel >= 3 &&
              nPlanes == 1 && nPhotometricInterpretation == 2 )
@@ -904,8 +904,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
         }
         else if (
                ( nPhotometricInterpretation == 2 && nSamplesPerPixel >= 3 ) ||
-               ( nPhotometricInterpretation == 5 && nSamplesPerPixel == 3 ) ||
-               ( nPhotometricInterpretation <= 1 && nSamplesPerPixel == 1 )
+               ( nPhotometricInterpretation == 5 && nSamplesPerPixel == 3 )
         )
         {
             if ( nMaxSampleValue > nMinSampleValue )
@@ -925,7 +924,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
                         nGreen = GetBits( getMapData(1), nx * nBitsPerSample, 
nBitsPerSample );
                         nBlue = GetBits( getMapData(2), nx * nBitsPerSample, 
nBitsPerSample );
                     }
-                    if (nPhotometricInterpretation == 1 || 
nPhotometricInterpretation == 2)
+                    if (nPhotometricInterpretation == 2)
                         SetPixel(nY, nx, Color(static_cast<sal_uInt8>(nRed - 
nMinMax), static_cast<sal_uInt8>(nGreen - nMinMax), 
static_cast<sal_uInt8>(nBlue - nMinMax)));
                     else
                         SetPixel(nY, nx, Color(255 - 
static_cast<sal_uInt8>(nRed - nMinMax), 255 - static_cast<sal_uInt8>(nGreen - 
nMinMax), 255 - static_cast<sal_uInt8>(nBlue - nMinMax)));

Reply via email to