[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 23 12:13:04 UTC 2020


 vcl/source/gdi/bitmapex.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit c53afa8a577f58e75cdf22683af52553d292dc16
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 30 10:49:44 2019 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Mar 23 13:12:34 2020 +0100

    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 at collabora.co.uk>
    (cherry picked from commit 36f306d8891ef8cba53676e4a2a30434718228e4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90880
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

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


More information about the Libreoffice-commits mailing list