[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/inc vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Tue Oct 6 02:15:36 PDT 2015


 vcl/inc/image.h             |    2 ++
 vcl/source/gdi/impimage.cxx |    7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit c34cb60b230cab567c1a45236bf2e33290b25b72
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 30 14:55:18 2015 +0200

    create "disabled" image (icon) only if the original changes
    
    Currently we create a "disabled" version of  bitmaps in "Image"
    class (used for toolbar icons for example) in every draw call.
    This is not really optimal. The solution is to calculate the
    checksum of the original and create a "disabled" version only if
    the checksum changes.
    
    (cherry picked from commit 86186de42e13426305cf3dc8dfb076aff6a5e4ae)
    
    Conflicts:
    	vcl/source/gdi/impimage.cxx
    
    Change-Id: I6ed2d08c64fee028b479fedb35e4384f112e98e2
    Reviewed-on: https://gerrit.libreoffice.org/19160
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/vcl/inc/image.h b/vcl/inc/image.h
index 3aa9424..0dcc14e 100644
--- a/vcl/inc/image.h
+++ b/vcl/inc/image.h
@@ -40,6 +40,8 @@ public:
 private:
 
     BitmapEx    maBmpEx;
+    BitmapChecksum maBitmapChecksum;
+
     BitmapEx    maDisabledBmpEx;
     BitmapEx*   mpDisplayBmp;
     Size        maSize;
diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx
index 067b6e8..8ea787e 100644
--- a/vcl/source/gdi/impimage.cxx
+++ b/vcl/source/gdi/impimage.cxx
@@ -182,7 +182,12 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev,
 
         if( nStyle & DrawImageFlags::Disable )
         {
-            ImplUpdateDisabledBmpEx( nPos);
+            BitmapChecksum aChecksum = maBmpEx.GetChecksum();
+            if (maBitmapChecksum != aChecksum)
+            {
+                maBitmapChecksum = aChecksum;
+                ImplUpdateDisabledBmpEx(nPos);
+            }
             pOutDev->DrawBitmapEx( rPos, aOutSize, aSrcPos, maSize, maDisabledBmpEx );
         }
         else


More information about the Libreoffice-commits mailing list