[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 18 20:47:21 UTC 2019


 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 27a67cd6ad5a66c95f29e0fa143d54c32154dd4c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 18 16:52:52 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 18 21:45:50 2019 +0100

    only 'null' case is known to be png
    
    Change-Id: I449eb008a34ee1d9f4df748f6e48d2cb62651bef
    Reviewed-on: https://gerrit.libreoffice.org/85409
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 71022de91bd6..08b5ca51be04 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2892,15 +2892,11 @@ namespace
 
 namespace
 {
-    GdkPixbuf* load_icon_from_stream(SvMemoryStream& rStream, const char* image_type)
+    GdkPixbuf* load_icon_from_stream(SvMemoryStream& rStream, const OString& image_type)
     {
         // if we know the image type, it's a little faster to hand the type over and skip the type
         // detection.
-        GdkPixbufLoader *pixbuf_loader;
-        if (image_type != nullptr)
-            pixbuf_loader = gdk_pixbuf_loader_new_with_type(image_type, nullptr);
-        else
-            pixbuf_loader = gdk_pixbuf_loader_new();
+        GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new_with_type(image_type.getStr(), nullptr);
         gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(rStream.GetData()),
                                 rStream.TellEnd(), nullptr);
         gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
@@ -2917,7 +2913,7 @@ namespace
         if (!xMemStm)
             return nullptr;
         OUString sImageType = rIconName.copy(rIconName.lastIndexOf('.')+1).toAsciiLowerCase();
-        return load_icon_from_stream(*xMemStm, sImageType.toUtf8().getStr());
+        return load_icon_from_stream(*xMemStm, sImageType.toUtf8());
     }
 }
 
@@ -2948,7 +2944,7 @@ namespace
         vcl::PNGWriter aWriter(aImage.GetBitmapEx(), &aFilterData);
         aWriter.Write(*xMemStm);
 
-        return load_icon_from_stream(*xMemStm, nullptr);
+        return load_icon_from_stream(*xMemStm, "png");
     }
 
     GdkPixbuf* getPixbuf(const VirtualDevice& rDevice)


More information about the Libreoffice-commits mailing list