diff options
Diffstat (limited to 'vcl/source/image/ImplImage.cxx')
-rw-r--r-- | vcl/source/image/ImplImage.cxx | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx index 95d605e47173..dc5f12ab8b59 100644 --- a/vcl/source/image/ImplImage.cxx +++ b/vcl/source/image/ImplImage.cxx @@ -53,13 +53,37 @@ ImplImage::ImplImage(const OUString &aStockName) bool ImplImage::loadStockAtScale(double fScale, BitmapEx &rBitmapEx) { BitmapEx aBitmapEx; + + ImageLoadFlags eScalingFlags = ImageLoadFlags::NONE; + sal_Int32 nScalePercentage = -1; + + if (comphelper::LibreOfficeKit::isActive()) // scale at the surface + { + nScalePercentage = fScale * 100.0; + eScalingFlags = ImageLoadFlags::IgnoreScalingFactor; + } + OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); if (!ImageTree::get().loadImage(maStockName, aIconTheme, aBitmapEx, true, - fScale * 100.0, - ImageLoadFlags::IgnoreScalingFactor)) + nScalePercentage, eScalingFlags)) { - SAL_WARN("vcl", "Failed to load scaled image from " << maStockName << " at " << fScale); - return false; + /* If the uno command has parameters, passed in from a toolbar, + * recover from failure by removing the parameters from the file name + */ + if (maStockName.indexOf("%3f") > 0) + { + sal_Int32 nStart = maStockName.indexOf("%3f"); + sal_Int32 nEnd = maStockName.lastIndexOf("."); + + OUString aFileName = maStockName.replaceAt(nStart, nEnd - nStart, ""); + if (!ImageTree::get().loadImage(aFileName, aIconTheme, aBitmapEx, true, + nScalePercentage, eScalingFlags)) + { + SAL_WARN("vcl", "Failed to load scaled image from " << maStockName << + " and " << aFileName << " at " << fScale); + return false; + } + } } rBitmapEx = aBitmapEx; return true; @@ -123,7 +147,7 @@ BitmapEx ImplImage::getBitmapExForHiDPI(bool bDisabled) // FIXME: DPI scaling should be tied to the outdev really ... double fScale = comphelper::LibreOfficeKit::getDPIScale(); Size aTarget(maSizePixel.Width()*fScale, - maSizePixel.Height()*fScale); + maSizePixel.Height()*fScale); if (maBitmapEx.GetSizePixel() != aTarget) loadStockAtScale(fScale, maBitmapEx); } |