summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-30 10:49:44 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-03-23 13:12:34 +0100
commitc53afa8a577f58e75cdf22683af52553d292dc16 (patch)
treecb941acf7408aae3839a2d4ce05a8a6fbabe7b51
parent8f062cdae1c71c9dd2a1e3f81617b08ac7463c5d (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) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90880 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-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