diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-09-07 23:25:50 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-09-08 16:47:38 +0200 |
commit | 8ef781e68f66a9bf7501ef82ee5625b3758b6c88 (patch) | |
tree | e656820bce329f021f93e6682c3ffbd7bf41b5e8 /framework | |
parent | 271297d4fa4a8e045b6dc04942966a1058bed45c (diff) |
tdf#130445 Use actual icon size
maImageSize was always 0x0, unless the image list was
first loaded from a correctly saved file. Just drop it,
and use the actual size of the first icon of the list.
Change-Id: Ifcda130ed1acdde7ce53dda6f4e1b3636be2bb03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102224
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uiconfiguration/ImageList.cxx | 9 | ||||
-rw-r--r-- | framework/source/uiconfiguration/ImageList.hxx | 1 |
2 files changed, 4 insertions, 6 deletions
diff --git a/framework/source/uiconfiguration/ImageList.cxx b/framework/source/uiconfiguration/ImageList.cxx index dfe936b50abd..8e775aeda62d 100644 --- a/framework/source/uiconfiguration/ImageList.cxx +++ b/framework/source/uiconfiguration/ImageList.cxx @@ -44,16 +44,16 @@ BitmapEx ImageList::GetAsHorizontalStrip() const sal_uInt16 nCount = maImages.size(); if( !nCount ) return BitmapEx(); - Size aSize( maImageSize.Width() * nCount, maImageSize.Height() ); BitmapEx aTempl = maImages[ 0 ]->maImage.GetBitmapEx(); + Size aImageSize(aTempl.GetSizePixel()); + Size aSize(aImageSize.Width() * nCount, aImageSize.Height()); BitmapEx aResult( aTempl, Point(), aSize ); - tools::Rectangle aSrcRect( Point( 0, 0 ), maImageSize ); + tools::Rectangle aSrcRect( Point( 0, 0 ), aImageSize ); for (sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++) { - tools::Rectangle aDestRect( Point( nIdx * maImageSize.Width(), 0 ), - maImageSize ); + tools::Rectangle aDestRect( Point( nIdx * aImageSize.Width(), 0 ), aImageSize ); ImageAryData *pData = maImages[ nIdx ].get(); BitmapEx aTmp = pData->maImage.GetBitmapEx(); aResult.CopyPixel( aDestRect, aSrcRect, &aTmp); @@ -77,7 +77,6 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, maImages.clear(); maNameHash.clear(); maImages.reserve( nItems ); - maImageSize = aSize; maPrefix.clear(); for (sal_uInt16 nIdx = 0; nIdx < nItems; nIdx++) diff --git a/framework/source/uiconfiguration/ImageList.hxx b/framework/source/uiconfiguration/ImageList.hxx index 7a7af3d1bb63..946805f6cdd2 100644 --- a/framework/source/uiconfiguration/ImageList.hxx +++ b/framework/source/uiconfiguration/ImageList.hxx @@ -65,7 +65,6 @@ private: std::vector< std::unique_ptr<ImageAryData> > maImages; std::unordered_map< OUString, ImageAryData * > maNameHash; OUString maPrefix; - Size maImageSize; sal_uInt16 ImplGetImageId( const OUString& rImageName ) const; void ImplAddImage( const OUString &aPrefix, const OUString &aName, sal_uInt16 nId, const Image &aImage ); |