summaryrefslogtreecommitdiff
path: root/vcl/source/window/toolbox2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/toolbox2.cxx')
-rw-r--r--vcl/source/window/toolbox2.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 7a3a89b6bfb5..af9f5f908cf9 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1020,6 +1020,7 @@ const Size& ToolBox::GetDefaultImageSize(bool bLarge)
aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE );
}
}
+
return bLarge ? aLargeButtonSize : aSmallButtonSize;
}
@@ -1342,25 +1343,41 @@ void* ToolBox::GetItemData( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
-void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
+void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rInputImage )
{
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.
+
+ if ( GetDPIScaleFactor() > 1)
+ {
+ BitmapEx aBitmap = rInputImage.GetBitmapEx();
+
+ //Some code calls this twice, so add a sanity check
+ if (aBitmap.GetSizePixel().Width() < 32)
+ {
+ aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST);
+ aImage = Image(aBitmap);
+ pImage = &aImage;
+ }
+ }
+
ImplToolItem* pItem = &mpData->m_aItems[nPos];
// Nur wenn alles berechnet ist, mehr Aufwand treiben
if ( !mbCalc )
{
Size aOldSize = pItem->maImage.GetSizePixel();
- pItem->maImage = rImage;
+ pItem->maImage = *pImage;
if ( aOldSize != pItem->maImage.GetSizePixel() )
ImplInvalidate( sal_True );
else
ImplUpdateItem( nPos );
}
else
- pItem->maImage = rImage;
+ pItem->maImage = *pImage;
}
}