diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-09-30 14:55:18 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-10-05 17:15:31 +0200 |
commit | 86186de42e13426305cf3dc8dfb076aff6a5e4ae (patch) | |
tree | 32620845af6969c54c4c06bb9560208928daed51 /vcl | |
parent | a6ef5718475ba35b52d9de474741b640316502eb (diff) |
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.
Change-Id: I6ed2d08c64fee028b479fedb35e4384f112e98e2
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/image.h | 2 | ||||
-rw-r--r-- | vcl/source/gdi/impimage.cxx | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/vcl/inc/image.h b/vcl/inc/image.h index 5b8e92d6bee2..00861670abba 100644 --- a/vcl/inc/image.h +++ b/vcl/inc/image.h @@ -39,6 +39,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 ef4410dba3b1..44720b12709b 100644 --- a/vcl/source/gdi/impimage.cxx +++ b/vcl/source/gdi/impimage.cxx @@ -182,7 +182,12 @@ void ImplImageBmp::Draw( OutputDevice* pOutDev, if( nStyle & DrawImageFlags::Disable ) { - ImplUpdateDisabledBmpEx(); + BitmapChecksum aChecksum = maBmpEx.GetChecksum(); + if (maBitmapChecksum != aChecksum) + { + maBitmapChecksum = aChecksum; + ImplUpdateDisabledBmpEx(); + } pOutDev->DrawBitmapEx( rPos, aOutSize, aSrcPos, maSize, maDisabledBmpEx ); } else |