[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - framework/source

Maxim Monastirsky (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 30 02:34:24 UTC 2020


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

New commits:
commit 80e3ad82b1cfaa9e8de24cea6f118193d5a59621
Author:     Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Mon Sep 7 23:25:50 2020 +0300
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Wed Sep 30 04:33:52 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 <momonasmon at gmail.com>
    (cherry picked from commit 8ef781e68f66a9bf7501ef82ee5625b3758b6c88)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103621
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.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 );


More information about the Libreoffice-commits mailing list