diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-04-12 14:46:49 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-04-13 10:03:07 +0200 |
commit | f8072cc8e43b42e2bfa227bb33aa06be69233e46 (patch) | |
tree | 24fd566c607433c9d2cccf5d7912981055967e7f /vcl | |
parent | 2b2fe50f33f7d677098f3ebafa8357aea848c0ea (diff) |
Don't abuse loading of a Graphic to actually load an Image
Change-Id: I816c46542088f36ef69b127cc13080e3bc8cdfc2
Reviewed-on: https://gerrit.libreoffice.org/52806
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/image/Image.cxx | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index e99cccd0f256..e9e105c10bf0 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -54,13 +54,25 @@ Image::Image(const css::uno::Reference< css::graphic::XGraphic >& rxGraphic) Image::Image(const OUString & rFileUrl) { - OUString aPath; - osl::FileBase::getSystemPathFromFileURL(rFileUrl, aPath); - Graphic aGraphic; - const OUString aFilterName(IMP_PNG); - if (ERRCODE_NONE == GraphicFilter::LoadGraphic(aPath, aFilterName, aGraphic)) + sal_Int32 nIndex = 0; + if (rFileUrl.getToken( 0, '/', nIndex ) == "private:graphicrepository") { - ImplInit(aGraphic.GetBitmapEx()); + OUString sPathName(rFileUrl.copy(nIndex)); + BitmapEx aBitmapEx; + if (vcl::ImageRepository::loadImage(sPathName, aBitmapEx)) + { + ImplInit(aBitmapEx); + } + } + else + { + OUString aPath; + osl::FileBase::getSystemPathFromFileURL(rFileUrl, aPath); + Graphic aGraphic; + if (ERRCODE_NONE == GraphicFilter::LoadGraphic(aPath, IMP_PNG, aGraphic)) + { + ImplInit(aGraphic.GetBitmapEx()); + } } } |