summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2013-12-20 15:13:29 +0100
committerJan Holesovsky <kendy@collabora.com>2013-12-20 15:13:29 +0100
commit3843a568fd11ed0f2dac20d6c5e4f9feb7232f2e (patch)
tree2db64a552633a3bd9bffa70e5f9fe2ec91ab39df
parent56d1b1cb7b0e1db8b4eee8e7f53814b107f9b80c (diff)
hidpi: Image is reference counted.
No need no schuffle with pointers to avoid copying :-) Change-Id: I62757214db65af856e0c79f662d15938c0e9a675
-rw-r--r--vcl/source/window/toolbox2.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index c4f06ddbaf8f..b11a918dcb4b 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;
}
}