[Libreoffice-commits] core.git: vcl/unx
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 18 16:40:34 UTC 2019
vcl/unx/gtk3/gtk3gtkinst.cxx | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
New commits:
commit 9e5cbcf90f15f46f84900a58bcaee437b98587f6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 18 15:35:19 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 18 17:39:01 2019 +0100
load images by explicit type
speed ups dialog load time a little (10%)
Change-Id: Id64c50c27ffc5971049313a3b9105e4e36fc0b69
Reviewed-on: https://gerrit.libreoffice.org/85388
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c75eb8b68858..71022de91bd6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2892,9 +2892,15 @@ namespace
namespace
{
- GdkPixbuf* load_icon_from_stream(SvMemoryStream& rStream)
+ GdkPixbuf* load_icon_from_stream(SvMemoryStream& rStream, const char* image_type)
{
- GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new();
+ // 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();
gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(rStream.GetData()),
rStream.TellEnd(), nullptr);
gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
@@ -2910,7 +2916,8 @@ namespace
auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang);
if (!xMemStm)
return nullptr;
- return load_icon_from_stream(*xMemStm);
+ OUString sImageType = rIconName.copy(rIconName.lastIndexOf('.')+1).toAsciiLowerCase();
+ return load_icon_from_stream(*xMemStm, sImageType.toUtf8().getStr());
}
}
@@ -2941,7 +2948,7 @@ namespace
vcl::PNGWriter aWriter(aImage.GetBitmapEx(), &aFilterData);
aWriter.Write(*xMemStm);
- return load_icon_from_stream(*xMemStm);
+ return load_icon_from_stream(*xMemStm, nullptr);
}
GdkPixbuf* getPixbuf(const VirtualDevice& rDevice)
More information about the Libreoffice-commits
mailing list