summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-30 10:49:44 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-04-08 22:29:40 +0200
commit45e98962327d2919d94a2190ee540a1043a75b82 (patch)
tree06c742057fff92ee363f6632154c5e6a5e5dcc88
parent59e239eb6210e10b75b097810c02f90ab7e0715b (diff)
fix bug in BitmapEx::operator==
Just because this image is transparent, does not mean it is equal to the other image. Similarly, just because this image has transparency color, does not mean the other image has valid transparency color. Also move the cheaper mbAlpha check before the more expensive ShallowEquals check. there since commit 8ab086b6cc054501bfbf7ef6fa509c393691e860 Date: Mon Sep 18 16:07:07 2000 +0000 initial import Change-Id: I63033bc8e7fed991513a171e637768e826eafad9 Reviewed-on: https://gerrit.libreoffice.org/71572 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 36f306d8891ef8cba53676e4a2a30434718228e4)
-rw-r--r--vcl/source/gdi/bitmapex.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index b89719c70b42..ccf70a6c4dca 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -187,13 +187,17 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
if (GetSizePixel() != rBitmapEx.GetSizePixel())
return false;
- if (meTransparent == TransparentType::NONE)
- return true;
+ if (meTransparent != rBitmapEx.meTransparent)
+ return false;
- if (meTransparent == TransparentType::Color)
- return maTransparentColor == rBitmapEx.maTransparentColor;
+ if (meTransparent == TransparentType::Color
+ && maTransparentColor != rBitmapEx.maTransparentColor)
+ return false;
+
+ if (mbAlpha != rBitmapEx.mbAlpha)
+ return false;
- return maMask.ShallowEquals(rBitmapEx.maMask) && mbAlpha == rBitmapEx.mbAlpha;
+ return maMask.ShallowEquals(rBitmapEx.maMask);
}
bool BitmapEx::IsEmpty() const