vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx |   12 ++++++------
 vcl/source/filter/webp/reader.cxx                  |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 414d58e8fe8ecf545549dc960e1599b1035b7564
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Apr 22 14:52:32 2024 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Apr 22 22:46:14 2024 +0200

    tdf#160431 Inverts webp file image when inserted
    
    regression from
        commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
        Author: Noel Grandin <noelgran...@gmail.com>
        Date:   Fri Apr 16 20:33:10 2021 +0200
        Convert internal vcl bitmap formats transparency->alpha (II)
    
    Change-Id: I3b2959c99a2e18c3972920f8ca86072566d54225
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166450
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit c503b6eef32055f75dc9cf761bd20eda4f161dd4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166434
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx 
b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx
index d3c43f48191f..cbc23315ca30 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx
@@ -141,10 +141,10 @@ void WebpFilterTest::testRoundtrip(bool lossy)
         }
         AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask();
         BitmapScopedReadAccess pAccessAlpha(tmpAlpha);
-        CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 0));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 19));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(19, 0));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt8(64), pAccessAlpha->GetPixelIndex(19, 
19));
+        CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 
0));
+        CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 
19));
+        CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(19, 
0));
+        CPPUNIT_ASSERT_EQUAL(sal_uInt8(191), pAccessAlpha->GetPixelIndex(19, 
19));
     }
 
     aStream.Seek(STREAM_SEEK_TO_BEGIN);
@@ -192,8 +192,8 @@ void WebpFilterTest::testRead(std::u16string_view rName, 
bool lossy, bool alpha)
         {
             AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask();
             BitmapScopedReadAccess pAccessAlpha(tmpAlpha);
-            CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 
0));
-            CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), 
pAccessAlpha->GetPixelIndex(0, 9));
+            CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), 
pAccessAlpha->GetPixelIndex(0, 0));
+            CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 
9));
         }
     }
 }
diff --git a/vcl/source/filter/webp/reader.cxx 
b/vcl/source/filter/webp/reader.cxx
index 1d75ff79e8d1..200331247644 100644
--- a/vcl/source/filter/webp/reader.cxx
+++ b/vcl/source/filter/webp/reader.cxx
@@ -241,7 +241,7 @@ static bool readWebp(SvStream& stream, Graphic& graphic)
                 for (tools::Long x = 0; x < access->Width(); ++x)
                 {
                     memcpy(dstB, src, 3);
-                    *dstA = 255 - *(src + 3);
+                    *dstA = *(src + 3);
                     src += 4;
                     dstB += 3;
                     dstA += 1;
@@ -273,7 +273,7 @@ static bool readWebp(SvStream& stream, Graphic& graphic)
                     for (tools::Long x = 0; x < accessAlpha->Width(); ++x)
                     {
                         sal_uInt8 a = src[3];
-                        accessAlpha->SetPixelIndex(y, x, 255 - a);
+                        accessAlpha->SetPixelIndex(y, x, a);
                         src += 4;
                     }
                 }

Reply via email to