diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-04-12 11:11:13 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-04-12 13:56:53 +0200 |
commit | 812f0a83d223cddf00b121db40ca7ff91c22ccfa (patch) | |
tree | 8137fdfbac1f3c50bcd5b55ef66cd036aef0e455 /svtools | |
parent | ed437865a0db175e45ff421d50f429dff421d0cf (diff) |
internally resize image instead of scaling bitmaps outside
When we want a different size Image, we can now set that as a
parameter at construction of the Image. Previously we needed to
create an Image, forcefully take the bitmap out, resize the bitmap
and create a new Image out of that.
Doing it internally gives us the benefit to have a more control
over the scaling process, especially when dealing with HiDPI
images.
Change-Id: I104118f4d863d519cc7aad1a17ca0289c01ed9ff
Reviewed-on: https://gerrit.libreoffice.org/70617
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/misc/imagemgr.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index fdb556d6184c..5e688394e4dd 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -686,11 +686,11 @@ static OUString GetImageNameFromList_Impl( SvImageId nImageId, bool bBig ) return OUString(); } -static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig ) +static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig, Size aSize = Size()) { OUString sImageName(GetImageNameFromList_Impl(nImageId, bBig)); if (!sImageName.isEmpty()) - return Image(StockImage::Yes, sImageName); + return Image(StockImage::Yes, sImageName, aSize); return Image(); } @@ -766,11 +766,11 @@ OUString SvFileInformationManager::GetImageId(const INetURLObject& rObject, bool return GetImageNameFromList_Impl(nImage, bBig); } -Image SvFileInformationManager::GetImage( const INetURLObject& rObject, bool bBig ) +Image SvFileInformationManager::GetImage(const INetURLObject& rObject, bool bBig, Size const & rPreferredSize) { SvImageId nImage = GetImageId_Impl( rObject, true ); DBG_ASSERT( nImage != SvImageId::NONE, "invalid ImageId" ); - return GetImageFromList_Impl( nImage, bBig ); + return GetImageFromList_Impl(nImage, bBig, rPreferredSize); } OUString SvFileInformationManager::GetFileImageId(const INetURLObject& rObject) @@ -787,15 +787,15 @@ Image SvFileInformationManager::GetFileImage( const INetURLObject& rObject ) return GetImageFromList_Impl( nImage, false/*bBig*/ ); } -Image SvFileInformationManager::GetImageNoDefault( const INetURLObject& rObject, bool bBig ) +Image SvFileInformationManager::GetImageNoDefault(const INetURLObject& rObject, bool bBig, Size const & rPreferredSize) { - SvImageId nImage = GetImageId_Impl( rObject, true ); + SvImageId nImage = GetImageId_Impl(rObject, true); DBG_ASSERT( nImage != SvImageId::NONE, "invalid ImageId" ); if ( nImage == SvImageId::File ) return Image(); - return GetImageFromList_Impl( nImage, bBig ); + return GetImageFromList_Impl(nImage, bBig, rPreferredSize); } Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo ) |