vcl/source/bitmap/BitmapEx.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 1ac602f6ccd75f3b79d6c7a9d40e64677dd5741a
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Thu Jun 27 11:15:52 2024 -0400
Commit:     Patrick Luby <guibomac...@gmail.com>
CommitDate: Thu Jun 27 22:32:09 2024 +0200

    tdf#161498 use COL_ALPHA_OPAQUE for finding opaque pixels
    
    Starting with commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
    pixels now contain an alpha value instead of a transparency
    value.
    
    Change-Id: I07dd39859057bbbbd153a21ee38625049039b106
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169654
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 0d1216bb7095..ebcb7aa1cb9a 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -1286,7 +1286,11 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
             std::unique_ptr<Point[]> pPoints2;
             tools::Long                nX, nY;
             sal_uInt16              nPolyPos = 0;
-            const BitmapColor   aBlack = pAcc->GetBestMatchingColor( COL_BLACK 
);
+            // tdf#161498 use COL_ALPHA_OPAQUE for finding opaque pixels
+            // Starting with commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
+            // pixels now contain an alpha value instead of a transparency
+            // value.
+            const BitmapColor   aTransparencyOpaque = 
pAcc->GetBestMatchingColor( COL_ALPHA_OPAQUE );
 
             pPoints1.reset(new Point[ nHeight ]);
             pPoints2.reset(new Point[ nHeight ]);
@@ -1299,7 +1303,7 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
                 // scan row from left to right
                 while( nX < nEndX1 )
                 {
-                    if( aBlack == pAcc->GetPixelFromData( pScanline, nX ) )
+                    if( aTransparencyOpaque == pAcc->GetPixelFromData( 
pScanline, nX ) )
                     {
                         pPoints1[ nPolyPos ] = Point( nX, nY );
                         nX = nStartX2;
@@ -1307,7 +1311,7 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
                         // this loop always breaks eventually as there is at 
least one pixel
                         while( true )
                         {
-                            if( aBlack == pAcc->GetPixelFromData( pScanline, 
nX ) )
+                            if( aTransparencyOpaque == pAcc->GetPixelFromData( 
pScanline, nX ) )
                             {
                                 pPoints2[ nPolyPos ] = Point( nX, nY );
                                 break;

Reply via email to