include/vcl/qt/QtUtils.hxx | 8 ++++---- vcl/qt5/QtInstanceIconView.cxx | 2 +- vcl/source/bitmap/bitmap.cxx | 2 +- vcl/source/filter/png/PngImageWriter.cxx | 2 +- vcl/source/graphic/GraphicObject2.cxx | 27 ++------------------------- vcl/source/treelist/svtabbx.cxx | 6 +++--- 6 files changed, 12 insertions(+), 35 deletions(-)
New commits: commit 3bd2a42290687490f5b11490b47011d48c35809e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Aug 27 14:18:01 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 27 20:51:00 2025 +0200 simplify GraphicObject::ImplDrawTiled we already get an alpha-enabled Bitmap out of the VirtualDevice, no need to draw it twice Change-Id: Ie707d6bcaa37f8114f3c692130979b2985475c58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190298 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx index 23859c5b49c6..03dda1b16d81 100644 --- a/vcl/source/graphic/GraphicObject2.cxx +++ b/vcl/source/graphic/GraphicObject2.cxx @@ -300,30 +300,7 @@ bool GraphicObject::ImplDrawTiled(OutputDevice& rOut, const tools::Rectangle& rA if( ImplRenderTempTile( *aVDev, nNumTilesInCacheX, nNumTilesInCacheY, rSizePixel, pAttr ) ) { - BitmapEx aTileBitmap( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) ); - - // draw alpha content, if any - if( IsTransparent() ) - { - GraphicObject aAlphaGraphic; - - if( GetGraphic().IsAlpha() ) - aAlphaGraphic.SetGraphic(GetGraphic().GetBitmap().CreateAlphaMask().GetBitmap()); - else - aAlphaGraphic.SetGraphic(Bitmap()); - - if( aAlphaGraphic.ImplRenderTempTile( *aVDev, nNumTilesInCacheX, - nNumTilesInCacheY, rSizePixel, pAttr ) ) - { - // Combine bitmap and alpha/mask - if( GetGraphic().IsAlpha() ) - aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), - AlphaMask( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) ) ); - else - aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), - aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ).CreateAlphaMask( COL_WHITE ) ); - } - } + Bitmap aTileBitmap( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) ); // paint generated tile GraphicObject aTmpGraphic( aTileBitmap ); commit 6f695c1a984fae4109f384686eb3d274f80850b9 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Aug 27 13:31:05 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 27 20:50:49 2025 +0200 BitmapEx->Bitmap in vcl now that Bitmap supports transparency Change-Id: Ib71bb58a92379d3f6b5fab067a23a5099586c533 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190285 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/qt/QtUtils.hxx b/include/vcl/qt/QtUtils.hxx index cc20021389b0..1faee199696b 100644 --- a/include/vcl/qt/QtUtils.hxx +++ b/include/vcl/qt/QtUtils.hxx @@ -37,11 +37,11 @@ inline OUString toOUString(const QString& s) return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length()); } -inline QPixmap toQPixmap(const BitmapEx& rBitmapEx) +inline QPixmap toQPixmap(const Bitmap& rBitmap) { SvMemoryStream aMemoryStream; vcl::PngImageWriter aWriter(aMemoryStream); - aWriter.write(rBitmapEx); + aWriter.write(rBitmap); QPixmap aPixmap; aPixmap.loadFromData(static_cast<const uchar*>(aMemoryStream.GetData()), aMemoryStream.TellEnd()); @@ -49,7 +49,7 @@ inline QPixmap toQPixmap(const BitmapEx& rBitmapEx) return aPixmap; } -inline QPixmap toQPixmap(const Image& rImage) { return toQPixmap(BitmapEx(rImage.GetBitmap())); } +inline QPixmap toQPixmap(const Image& rImage) { return toQPixmap(rImage.GetBitmap()); } inline QPixmap toQPixmap(const css::uno::Reference<css::graphic::XGraphic>& rImage) { @@ -68,7 +68,7 @@ inline QPixmap toQPixmap(const OutputDevice& rDevice) inline QPixmap loadQPixmapIcon(const OUString& rIconName) { Bitmap aIcon(rIconName); - return toQPixmap(BitmapEx(aIcon)); + return toQPixmap(aIcon); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceIconView.cxx b/vcl/qt5/QtInstanceIconView.cxx index 119aa47561c5..f96a7b116d6f 100644 --- a/vcl/qt5/QtInstanceIconView.cxx +++ b/vcl/qt5/QtInstanceIconView.cxx @@ -93,7 +93,7 @@ void QtInstanceIconView::insert(int nPos, const OUString* pStr, const OUString* { std::optional<QPixmap> oPixmap; if (pIcon) - oPixmap = toQPixmap(BitmapEx(*pIcon)); + oPixmap = toQPixmap(*pIcon); const QPixmap* pPixmapIcon = oPixmap.has_value() ? &oPixmap.value() : nullptr; insert(nPos, pStr, pId, pPixmapIcon, pRet); diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index 0a0d201826b8..95aa1c7242bc 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -222,7 +222,7 @@ void savePNG(const OUString& sWhere, const Bitmap& rBmp) { SvFileStream aStream(sWhere, StreamMode::WRITE | StreamMode::TRUNC); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - rFilter.compressAsPNG(BitmapEx(rBmp), aStream); + rFilter.compressAsPNG(rBmp, aStream); } } diff --git a/vcl/source/filter/png/PngImageWriter.cxx b/vcl/source/filter/png/PngImageWriter.cxx index f65e098f2dd4..70734cd70fcb 100644 --- a/vcl/source/filter/png/PngImageWriter.cxx +++ b/vcl/source/filter/png/PngImageWriter.cxx @@ -365,7 +365,7 @@ static bool pngWrite(SvStream& rStream, const Graphic& rGraphic, int nCompressio const AnimationFrame& rCurrentFrame = *rFrames[1 + i]; SvMemoryStream aStream; - if (!pngWrite(aStream, rCurrentFrame.maBitmapEx, nCompressionLevel, bInterlaced, + if (!pngWrite(aStream, Bitmap(rCurrentFrame.maBitmapEx), nCompressionLevel, bInterlaced, bTranslucent, {})) return false; diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx index 191288c2cff3..23859c5b49c6 100644 --- a/vcl/source/graphic/GraphicObject2.cxx +++ b/vcl/source/graphic/GraphicObject2.cxx @@ -139,7 +139,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent rTileSizePixel, pAttr, aTileInfo ) ) { // extract generated tile -> see comment on the first loop below - BitmapEx aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) ); + Bitmap aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) ); xTmpGraphic.reset(new GraphicObject(std::move(aTileBitmap))); pTileGraphic = xTmpGraphic.get(); @@ -308,9 +308,9 @@ bool GraphicObject::ImplDrawTiled(OutputDevice& rOut, const tools::Rectangle& rA GraphicObject aAlphaGraphic; if( GetGraphic().IsAlpha() ) - aAlphaGraphic.SetGraphic(BitmapEx(GetGraphic().GetBitmap().CreateAlphaMask().GetBitmap())); + aAlphaGraphic.SetGraphic(GetGraphic().GetBitmap().CreateAlphaMask().GetBitmap()); else - aAlphaGraphic.SetGraphic(BitmapEx(Bitmap())); + aAlphaGraphic.SetGraphic(Bitmap()); if( aAlphaGraphic.ImplRenderTempTile( *aVDev, nNumTilesInCacheX, nNumTilesInCacheY, rSizePixel, pAttr ) ) diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index 649042f78db9..8607d40a1cfb 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -47,7 +47,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; namespace { - OString lcl_extractPngString(const BitmapEx& rImage) + OString lcl_extractPngString(const Bitmap& rImage) { SvMemoryStream aOStm(65535, 65535); // Use fastest compression "1" @@ -120,8 +120,8 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, // custom bitmap - send png else { - BitmapEx aCollapsedImage(pBmpItem->GetBitmap1().GetBitmap()); - BitmapEx aExpandedImage(pBmpItem->GetBitmap2().GetBitmap()); + Bitmap aCollapsedImage(pBmpItem->GetBitmap1().GetBitmap()); + Bitmap aExpandedImage(pBmpItem->GetBitmap2().GetBitmap()); bool bHasCollapsed = !aCollapsedImage.IsEmpty() && !aCollapsedImage.GetSizePixel().IsEmpty(); bool bHasExpanded = !aExpandedImage.IsEmpty() && !aExpandedImage.GetSizePixel().IsEmpty(); if (bHasCollapsed || bHasExpanded)