[Libreoffice-commits] core.git: vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 6 22:34:56 UTC 2020


 vcl/source/gdi/impgraph.cxx |   40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

New commits:
commit bba0fa96e37f866bba871693bbc6363feb08ea3b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Dec 6 21:01:40 2020 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Dec 6 23:34:13 2020 +0100

    graphic: clean-up and simplify GetChecksum in ImpGraphic
    
    - rearrange the switch statement for GraphicTypes
    - remove the unneeded aRet variable
    
    Change-Id: I1be95db377548cf1a6db430fe66ce06bc7f93d97
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107286
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index b1bab153deff..aed7f2e86772 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1747,36 +1747,32 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
     if (mnChecksum != 0)
         return mnChecksum;
 
-    BitmapChecksum nRet = 0;
-
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !isSwappedOut() )
+    switch (meType)
     {
-        switch( meType )
-        {
-            case GraphicType::Default:
+        case GraphicType::NONE:
+        case GraphicType::Default:
             break;
 
-            case GraphicType::Bitmap:
-            {
-                if(maVectorGraphicData)
-                    nRet = maVectorGraphicData->GetChecksum();
-                else if( mpAnimation )
-                    nRet = mpAnimation->GetChecksum();
-                else
-                    nRet = maBitmapEx.GetChecksum();
-            }
-            break;
+        case GraphicType::Bitmap:
+        {
+            if (maVectorGraphicData)
+                mnChecksum = maVectorGraphicData->GetChecksum();
+            else if (mpAnimation)
+                mnChecksum = mpAnimation->GetChecksum();
+            else
+                mnChecksum = maBitmapEx.GetChecksum();
+        }
+        break;
 
-            default:
-                nRet = maMetaFile.GetChecksum();
-            break;
+        case GraphicType::GdiMetafile:
+        {
+            mnChecksum = maMetaFile.GetChecksum();
         }
+        break;
     }
-
-    mnChecksum = nRet;
-    return nRet;
+    return mnChecksum;
 }
 
 bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const


More information about the Libreoffice-commits mailing list