[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - vcl/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 25 07:55:13 UTC 2019


 vcl/source/image/ImplImage.cxx |   32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

New commits:
commit 1808ea351ee62363501e77746601f6669ad6917f
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Sep 24 10:52:23 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Sep 25 09:54:37 2019 +0200

    Fix icon load error & HiDPI icon sizing issue.
    
    Originally by Muhammet Kara.
    
    Fix icon load error for uno commands with params
    
    Change-Id: I31e4c28322a3492a603bce5c7226e2dbcf131173
    Reviewed-on: https://gerrit.libreoffice.org/79447
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx
index 5f75c82845a1..4725e324ea92 100644
--- a/vcl/source/image/ImplImage.cxx
+++ b/vcl/source/image/ImplImage.cxx
@@ -51,13 +51,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;


More information about the Libreoffice-commits mailing list