framework/source/uiconfiguration/ImageList.cxx |    9 ++++-----
 framework/source/uiconfiguration/ImageList.hxx |    1 -
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 8ef781e68f66a9bf7501ef82ee5625b3758b6c88
Author:     Maxim Monastirsky <momonas...@gmail.com>
AuthorDate: Mon Sep 7 23:25:50 2020 +0300
Commit:     Maxim Monastirsky <momonas...@gmail.com>
CommitDate: Tue Sep 8 16:47:38 2020 +0200

    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 <momonas...@gmail.com>

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 );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to