framework/source/uiconfiguration/ImageList.cxx | 8 ++++---- framework/source/uiconfiguration/ImageList.hxx | 2 +- include/vcl/bitmap.hxx | 1 + sc/source/ui/inc/viewfunc.hxx | 2 +- sc/source/ui/view/viewfun5.cxx | 2 +- sc/source/ui/view/viewfun7.cxx | 4 ++-- vcl/source/bitmap/bitmap.cxx | 12 ++++++++++++ 7 files changed, 22 insertions(+), 9 deletions(-)
New commits: commit 7a6f3cabcb3a028406b810aef7af76f348ff8b02 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Aug 27 21:11:46 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Thu Aug 28 08:00:01 2025 +0200 BitmapEx->Bitmap in ScViewFunc::PasteBitmap now that Bitmap supports transparency Change-Id: Ic699b240267b6879cde10cb0fc7a1c978109d913 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190305 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 5a3b89db9af5..0d7187d901b5 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -149,7 +149,7 @@ public: bool PasteFile( const Point&, const OUString&, bool bLink ); bool PasteObject( const Point&, const css::uno::Reference < css::embed::XEmbeddedObject >&, const Size*, const Graphic* = nullptr, const OUString& = OUString(), sal_Int64 nAspect = css::embed::Aspects::MSOLE_CONTENT ); - bool PasteBitmapEx( const Point&, const BitmapEx& ); + bool PasteBitmap( const Point&, const Bitmap& ); bool PasteMetaFile( const Point&, const GDIMetaFile& ); bool PasteGraphic( const Point& rPos, const Graphic& rGraphic, const OUString& rFile ); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 968df102dac6..e7ffd3cf2027 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -230,7 +230,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, { Bitmap aBmp; if( aDataHelper.GetBitmapEx( SotClipboardFormatId::BITMAP, aBmp ) ) - bRet = PasteBitmapEx( aPos, BitmapEx(aBmp) ); + bRet = PasteBitmap( aPos, aBmp ); } else if (nFormatId == SotClipboardFormatId::GDIMETAFILE) { diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 1538546d1779..e28f14bf948a 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -368,9 +368,9 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X return false; } -bool ScViewFunc::PasteBitmapEx( const Point& rPos, const BitmapEx& rBmpEx ) +bool ScViewFunc::PasteBitmap( const Point& rPos, const Bitmap& rBmp ) { - Graphic aGraphic(rBmpEx); + Graphic aGraphic(rBmp); return PasteGraphic( rPos, aGraphic, u""_ustr ); } commit 65a99e6b334cb3896e52da43a8eec51aca607097 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Aug 27 20:59:27 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Thu Aug 28 07:59:48 2025 +0200 BitmapEx->Bitmap in ImageList now that Bitmap supports transparency Change-Id: If30f5fbc801cd576a13ee6f969085021d3ba7d6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190304 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/uiconfiguration/ImageList.cxx b/framework/source/uiconfiguration/ImageList.cxx index 635688d24903..271620ce6f69 100644 --- a/framework/source/uiconfiguration/ImageList.cxx +++ b/framework/source/uiconfiguration/ImageList.cxx @@ -39,16 +39,16 @@ ImageList::ImageList(const std::vector< OUString >& rNameVector, } // FIXME: Rather a performance hazard -BitmapEx ImageList::GetAsHorizontalStrip() const +Bitmap ImageList::GetAsHorizontalStrip() const { sal_uInt16 nCount = maImages.size(); if( !nCount ) - return BitmapEx(); + return Bitmap(); Bitmap aTempl = maImages[ 0 ]->maImage.GetBitmap(); Size aImageSize(aTempl.GetSizePixel()); Size aSize(aImageSize.Width() * nCount, aImageSize.Height()); - BitmapEx aResult( BitmapEx(aTempl), Point(), aSize ); + Bitmap aResult( aTempl, Point(), aSize ); tools::Rectangle aSrcRect( Point( 0, 0 ), aImageSize ); for (sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++) @@ -56,7 +56,7 @@ BitmapEx ImageList::GetAsHorizontalStrip() const tools::Rectangle aDestRect( Point( nIdx * aImageSize.Width(), 0 ), aImageSize ); ImageAryData *pData = maImages[ nIdx ].get(); Bitmap aTmp = pData->maImage.GetBitmap(); - aResult.CopyPixel( aDestRect, aSrcRect, BitmapEx(aTmp)); + aResult.CopyPixel( aDestRect, aSrcRect, aTmp); } return aResult; diff --git a/framework/source/uiconfiguration/ImageList.hxx b/framework/source/uiconfiguration/ImageList.hxx index edd0789ed146..ccfa2e68e0a0 100644 --- a/framework/source/uiconfiguration/ImageList.hxx +++ b/framework/source/uiconfiguration/ImageList.hxx @@ -43,7 +43,7 @@ public: void InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, const std::vector< OUString > &rNameVector ); - BitmapEx GetAsHorizontalStrip() const; + Bitmap GetAsHorizontalStrip() const; sal_uInt16 GetImageCount() const; void AddImage( const OUString& rImageName, const Image& rImage ); diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index d46c9538e4d0..d6ef3bbe5058 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -117,6 +117,7 @@ public: Bitmap(); explicit Bitmap( const OUString& rIconName ); Bitmap( const Bitmap& rBitmap ); + Bitmap( const Bitmap& rBitmap, Point aSrc, Size aSize ); explicit Bitmap( const BitmapEx& rBitmapEx ); Bitmap( const Size& rSizePixel, vcl::PixelFormat ePixelFormat, const BitmapPalette* pPal = nullptr ); SAL_DLLPRIVATE explicit Bitmap( std::shared_ptr<SalBitmap> xSalBitmap ); diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index 95aa1c7242bc..9051b5ed4a78 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -191,6 +191,18 @@ Bitmap::Bitmap(const BitmapEx& rBitmapEx) } } +Bitmap::Bitmap( const Bitmap& rBitmap, Point aSrc, Size aSize ) +{ + if( rBitmap.IsEmpty() || aSize.IsEmpty() ) + return; + + *this = Bitmap(aSize, rBitmap.getPixelFormat()); + + tools::Rectangle aDestRect( Point( 0, 0 ), aSize ); + tools::Rectangle aSrcRect( aSrc, aSize ); + CopyPixel( aDestRect, aSrcRect, rBitmap ); +} + Bitmap::Bitmap( const OUString& rIconName ) { loadFromIconTheme( rIconName );