diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-14 15:30:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-15 12:52:53 +0100 |
commit | 88ca1a6f75b1e94136e04e8dc65b98955d0e8aaf (patch) | |
tree | 0ed3651c0dbc571c4e5cda3f629a6a8c69ce0c27 /vcl | |
parent | 74d30155c5067271fb98bacbcb895c215e61678d (diff) |
move ToolboxButtonColorUpdater bitmap update to VirtualDevice
to avoid doing a read-modify-write cycle on the item images on the
toolbar, add an overlay image member to Toolbox items.
part of the process of making Bitmap an internal detail of vcl/
Change-Id: Ie4a886c48484a06694fc4c066ee0845b39d27f0b
Reviewed-on: https://gerrit.libreoffice.org/49649
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/toolbox.h | 1 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 3 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 22 |
3 files changed, 26 insertions, 0 deletions
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h index f908cc5bdf52..9d928ce6a1ba 100644 --- a/vcl/inc/toolbox.h +++ b/vcl/inc/toolbox.h @@ -37,6 +37,7 @@ struct ImplToolItem VclPtr<vcl::Window> mpWindow; //don't dispose mpWindow - we get copied around void* mpUserData; Image maImage; + Image maOverlayImage; long mnImageAngle; bool mbMirrorMode; OUString maText; diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index a2b1400507ce..e8031248714f 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -2793,6 +2793,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si if ( bImage ) { const Image* pImage = &(pItem->maImage); + const Image& rOverlayImage = pItem->maOverlayImage; aImageSize = pImage->GetSizePixel(); // determine drawing flags @@ -2837,6 +2838,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si } } rRenderContext.DrawImage(Point( nImageOffX, nImageOffY ), *pImage, nImageStyle); + if (!!rOverlayImage) + rRenderContext.DrawImage(Point( nImageOffX, nImageOffY ), rOverlayImage, nImageStyle); } // draw the text diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 23d5971518d2..6cdd0edc7fce 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -965,6 +965,28 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) } } +void ToolBox::SetItemOverlayImage( sal_uInt16 nItemId, const Image& rImage ) +{ + ImplToolItems::size_type nPos = GetItemPos( nItemId ); + + if ( nPos != ITEM_NOTFOUND ) + { + ImplToolItem* pItem = &mpData->m_aItems[nPos]; + Size aOldSize = pItem->maOverlayImage.GetSizePixel(); + + pItem->maOverlayImage = rImage; + + // only once all is calculated, do extra work + if (!mbCalc) + { + if (aOldSize != pItem->maOverlayImage.GetSizePixel()) + ImplInvalidate( true ); + else + ImplUpdateItem( nPos ); + } + } +} + static Image ImplRotImage( const Image& rImage, long nAngle10 ) { BitmapEx aRotBitmapEx( rImage.GetBitmapEx() ); |