vcl/source/window/toolbox2.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
New commits: commit 3843a568fd11ed0f2dac20d6c5e4f9feb7232f2e Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Dec 20 15:13:29 2013 +0100 hidpi: Image is reference counted. No need no schuffle with pointers to avoid copying :-) Change-Id: I62757214db65af856e0c79f662d15938c0e9a675 diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index c4f06dd..b11a918 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1343,18 +1343,17 @@ void* ToolBox::GetItemData( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rInputImage ) +void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { - const Image* pImage = &rInputImage; // Use the pointer to avoid unnecessary copying - Image aImage; // But we still need to keep the modified image alive if created. + Image aImage(rImage); if ( GetDPIScaleFactor() > 1) { - BitmapEx aBitmap = rInputImage.GetBitmapEx(); + BitmapEx aBitmap(aImage.GetBitmapEx()); // Some code calls this twice, so add a sanity check // FIXME find out what that code is & fix accordingly @@ -1362,7 +1361,6 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rInputImage ) { aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor()); aImage = Image(aBitmap); - pImage = &aImage; } } @@ -1371,14 +1369,14 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rInputImage ) if ( !mbCalc ) { Size aOldSize = pItem->maImage.GetSizePixel(); - pItem->maImage = *pImage; + pItem->maImage = aImage; if ( aOldSize != pItem->maImage.GetSizePixel() ) ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } else - pItem->maImage = *pImage; + pItem->maImage = aImage; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits