diff options
author | Patrick Luby <guibmacdev@gmail.com> | 2024-06-27 11:15:52 -0400 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2024-06-28 00:33:49 +0200 |
commit | 8590499c1f382244155624cd3f712d0894faaa2b (patch) | |
tree | 6b70ac0b80ae9de04e569e708b15bb442e463aec | |
parent | ef201bb390aca42a3d8c1c6018c4d3e6201a64c5 (diff) |
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.grandin@collabora.co.uk>
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
(cherry picked from commit 1ac602f6ccd75f3b79d6c7a9d40e64677dd5741a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169667
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | vcl/source/bitmap/BitmapEx.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index 07e25f177180..571f8d700836 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1304,7 +1304,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 ]); @@ -1317,7 +1321,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; @@ -1325,7 +1329,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; |