summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-18 16:52:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-18 21:45:50 +0100
commit27a67cd6ad5a66c95f29e0fa143d54c32154dd4c (patch)
tree226d373fb9012b006e602b30d8d884d6fb9c20f0
parentd670d1b601ec84ac14574e5f723d9430c81467ee (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx12
1 files changed, 4 insertions, 8 deletions
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)