Kaydet (Commit) 3843a568 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

hidpi: Image is reference counted.

No need no schuffle with pointers to avoid copying :-)

Change-Id: I62757214db65af856e0c79f662d15938c0e9a675
üst 56d1b1cb
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment