diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-11-09 21:30:34 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-11-10 09:40:47 +0100 |
commit | 397f5daa850e59f0f4d3881cb99d110b50e34e3d (patch) | |
tree | 487beb6a38c22094d4cbe8857918b92cee64c2ee /vcl/source | |
parent | 2a26f136a36791c06caa895d5a25f4633fd10651 (diff) |
tdf#151898 if svgs are used in hidpi get a high quality GtkImage
this gets nice sidebar icons in this case
as far as I can see only gtk_image_new_from_file (or
gtk_image_new_from_resource) can support the use of a scaleable input
format to create a hidpi GtkImage, rather than an upscaled lodpi one so
forced to go via a file here
Change-Id: I665cd5be2c87f6fe8e264640be228263cdfc1fba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142504
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/image/ImageTree.cxx | 5 | ||||
-rw-r--r-- | vcl/source/image/ImplImageTree.cxx | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/vcl/source/image/ImageTree.cxx b/vcl/source/image/ImageTree.cxx index 83e2962cbf8e..fdc47cbfe700 100644 --- a/vcl/source/image/ImageTree.cxx +++ b/vcl/source/image/ImageTree.cxx @@ -34,6 +34,11 @@ std::shared_ptr<SvMemoryStream> ImageTree::getImageStream(OUString const & rName return mpImplImageTree->getImageStream(rName, rStyle, rLang); } +css::uno::Reference<css::io::XInputStream> ImageTree::getImageXInputStream(OUString const & rName, OUString const & rStyle, OUString const & rLang) +{ + return mpImplImageTree->getImageXInputStream(rName, rStyle, rLang); +} + bool ImageTree::loadImage(OUString const & rName, OUString const & rStyle, BitmapEx & rBitmap, bool bLocalized, sal_Int32 nScalePercentage, diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 7294d82e74e2..549d0739139b 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -275,7 +275,7 @@ OUString ImplImageTree::getImageUrl(OUString const & rName, OUString const & rSt return OUString(); } -std::shared_ptr<SvMemoryStream> ImplImageTree::getImageStream(OUString const & rName, OUString const & rStyle, OUString const & rLang) +uno::Reference<io::XInputStream> ImplImageTree::getImageXInputStream(OUString const & rName, OUString const & rStyle, OUString const & rLang) { OUString aStyle(rStyle); @@ -300,7 +300,7 @@ std::shared_ptr<SvMemoryStream> ImplImageTree::getImageStream(OUString const & r bool ok = rNameAccess->getByName(rPath) >>= aStream; assert(ok); (void)ok; // prevent unused warning in release build - return wrapStream(aStream); + return aStream; } } } @@ -312,6 +312,14 @@ std::shared_ptr<SvMemoryStream> ImplImageTree::getImageStream(OUString const & r aStyle = fallbackStyle(aStyle); } + return nullptr; +} + +std::shared_ptr<SvMemoryStream> ImplImageTree::getImageStream(OUString const & rName, OUString const & rStyle, OUString const & rLang) +{ + uno::Reference<io::XInputStream> xStream = getImageXInputStream(rName, rStyle, rLang); + if (xStream) + return wrapStream(xStream); return std::shared_ptr<SvMemoryStream>(); } |