vcl/headless/SvpGraphicsBackend.cxx | 6 - vcl/inc/FileDefinitionWidgetDraw.hxx | 3 vcl/inc/headless/SvpGraphicsBackend.hxx | 3 vcl/inc/qt5/QtGraphics.hxx | 3 vcl/inc/quartz/salgdi.h | 3 vcl/inc/salgdi.hxx | 10 --- vcl/inc/salgdiimpl.hxx | 5 - vcl/inc/skia/gdiimpl.hxx | 3 vcl/inc/win/salgdi.h | 3 vcl/qt5/QtGraphics_GDI.cxx | 11 --- vcl/quartz/AquaGraphicsBackend.cxx | 19 ------ vcl/skia/gdiimpl.cxx | 6 - vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 24 ------- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 6 - vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 3 vcl/win/gdi/gdiimpl.cxx | 76 ------------------------ vcl/win/gdi/gdiimpl.hxx | 5 - vcl/win/gdi/salgdi2.cxx | 25 ------- 18 files changed, 2 insertions(+), 212 deletions(-)
New commits: commit 96b651f9a1fbd1b0d1433248702a52e37f92fad4 Author: Noel Grandin <[email protected]> AuthorDate: Sun Aug 31 09:11:06 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Aug 31 16:24:31 2025 +0200 start converting the SalGraphics backend from BitmapEx->Bitmap fold the two drawBitmap methods together. The second variant is no longer necessary since we can draw alpha with the first one. Change-Id: I578f72eb59af408624ef321059cfe897258e0b5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190430 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index 310d2f33de40..393b926b7209 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -169,12 +169,6 @@ void SvpGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& m_rCairoCommon.drawBitmap(rPosAry, rSalBitmap, getAntiAlias()); } -void SvpGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap) -{ - drawAlphaBitmap(rPosAry, rSalBitmap, rTransparentBitmap); -} - void SvpGraphicsBackend::drawMask(const SalTwoRect& rTR, const SalBitmap& rSalBitmap, Color nMaskColor) { diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx b/vcl/inc/FileDefinitionWidgetDraw.hxx index e7ada5fdfb86..826554eafb5c 100644 --- a/vcl/inc/FileDefinitionWidgetDraw.hxx +++ b/vcl/inc/FileDefinitionWidgetDraw.hxx @@ -66,9 +66,6 @@ public: static void drawBitmap(SalGraphics& rGraphics, const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap); - static void drawBitmap(SalGraphics& rGraphics, const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap); - static void implDrawGradient(SalGraphics& rGraphics, const basegfx::B2DPolyPolygon& rPolyPolygon, const SalGradient& rGradient); diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index d6a3260c09a9..dd49de76e1c3 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -86,9 +86,6 @@ public: void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; - void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap) override; - void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index 80ad883f4306..c9ab382724d1 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -115,9 +115,6 @@ public: void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; - void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap) override; - void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 0fdb516d7f93..fc446fad27d9 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -324,9 +324,6 @@ public: void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; - void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap) override; - void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 0e45d881f770..c8aedc57fb79 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -480,11 +480,6 @@ protected: virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0; - virtual void drawBitmap( - const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap ) = 0; - virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, @@ -783,11 +778,6 @@ public: GetImpl()->drawBitmap(rPosAry, rSalBitmap); } - void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rMaskBitmap) override - { - GetImpl()->drawBitmap(rPosAry, rSalBitmap, rMaskBitmap); - } - void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override { GetImpl()->drawMask(rPosAry, rSalBitmap, nMaskColor); diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 5d17c90a6c36..16370254e132 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -153,11 +153,6 @@ public: virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0; - virtual void drawBitmap( - const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap ) = 0; - virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 5244cebf02b5..e201bb31262e 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -126,9 +126,6 @@ public: virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; - virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap) override; - virtual void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index dbeb9fc3d4d8..7b5a3c45d44c 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -247,9 +247,6 @@ protected: // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; - virtual void drawBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap ) override; virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor ) override; diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 2ffb3659077d..52660c756e03 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -500,17 +500,6 @@ void QtGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& r drawScaledImage(rPosAry, *pImage); } -void QtGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& /*rSalBitmap*/, - const SalBitmap& /*rTransparentBitmap*/) -{ - if (rPosAry.mnSrcWidth <= 0 || rPosAry.mnSrcHeight <= 0 || rPosAry.mnDestWidth <= 0 - || rPosAry.mnDestHeight <= 0) - return; - - assert(rPosAry.mnSrcWidth == rPosAry.mnDestWidth); - assert(rPosAry.mnSrcHeight == rPosAry.mnDestHeight); -} - void QtGraphicsBackend::drawMask(const SalTwoRect& rPosAry, const SalBitmap& /*rSalBitmap*/, Color /*nMaskColor*/) { diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 77c8f7912d36..a623ef391bb5 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -920,25 +920,6 @@ void AquaGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& refreshRect(aDstRect); } -void AquaGraphicsBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap) -{ - if (!mrShared.checkContext()) - return; - - CGImageRef xMaskedImage(rSalBitmap.CreateWithMask(rTransparentBitmap, rPosAry.mnSrcX, - rPosAry.mnSrcY, rPosAry.mnSrcWidth, - rPosAry.mnSrcHeight)); - if (!xMaskedImage) - return; - - const CGRect aDstRect - = CGRectMake(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight); - CGContextDrawImage(mrShared.maContextHolder.get(), aDstRect, xMaskedImage); - CGImageRelease(xMaskedImage); - refreshRect(aDstRect); -} - void AquaGraphicsBackend::drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) { diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 20801881d3a9..e679c150a6a9 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1353,12 +1353,6 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& drawBitmap(rPosAry, rSkiaSourceBitmap); } -void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap) -{ - drawAlphaBitmap(rPosAry, rSalBitmap, rMaskBitmap); -} - void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) { diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index ab83e0aef358..138afe25a6e8 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -233,13 +233,6 @@ void FileDefinitionWidgetDraw::drawBitmap(SalGraphics& rGraphics, const SalTwoRe rGraphics.drawBitmap(rPosAry, rSalBitmap); } -void FileDefinitionWidgetDraw::drawBitmap(SalGraphics& rGraphics, const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap) -{ - rGraphics.drawBitmap(rPosAry, rSalBitmap, rTransparentBitmap); -} - void FileDefinitionWidgetDraw::implDrawGradient(SalGraphics& rGraphics, const basegfx::B2DPolyPolygon& rPolyPolygon, const SalGradient& rGradient) @@ -488,21 +481,8 @@ void munchDrawCommands(std::vector<std::shared_ptr<WidgetDrawAction>> const& rDr nImageHeight / nScaleFactor); if (!aBitmap.IsEmpty()) { - if (aBitmap.HasAlpha()) - { - BitmapEx aTmp(aBitmap); - const std::shared_ptr<SalBitmap> pSalBitmap - = aTmp.GetBitmap().ImplGetSalBitmap(); - const std::shared_ptr<SalBitmap> pSalBitmapAlpha - = aTmp.GetAlphaMask().GetBitmap().ImplGetSalBitmap(); - FileDefinitionWidgetDraw::drawBitmap(rGraphics, aTR, *pSalBitmap, - *pSalBitmapAlpha); - } - else - { - const std::shared_ptr<SalBitmap> pSalBitmap = aBitmap.ImplGetSalBitmap(); - FileDefinitionWidgetDraw::drawBitmap(rGraphics, aTR, *pSalBitmap); - } + const std::shared_ptr<SalBitmap> pSalBitmap = aBitmap.ImplGetSalBitmap(); + FileDefinitionWidgetDraw::drawBitmap(rGraphics, aTR, *pSalBitmap); } } break; diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index ba74c3c2fee2..3e54559bebbb 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -166,12 +166,6 @@ void X11CairoSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBit mrCairoCommon.drawBitmap(rPosAry, rSalBitmap, getAntiAlias()); } -void X11CairoSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap) -{ - drawAlphaBitmap(rPosAry, rSalBitmap, rTransparentBitmap); -} - bool X11CairoSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp) { diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index c72c3f9201f8..738bd04ff914 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -127,9 +127,6 @@ public: void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; - void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap) override; - /** Render bitmap with alpha channel @param rSourceBitmap diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 956cac45ff68..2ed6a0731a93 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -588,82 +588,6 @@ void WinSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& mbXORMode ? SRCINVERT : SRCCOPY ); } -void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSSalBitmap, - const SalBitmap& rSTransparentBitmap ) -{ - SAL_WARN_IF( mrParent.isPrinter(), "vcl", "No transparency print possible!" ); - bool bTryDirectPaint(!mrParent.isPrinter() && !mbXORMode); - - // try to draw using GdiPlus directly - if(bTryDirectPaint && drawAlphaBitmap(rPosAry, rSSalBitmap, rSTransparentBitmap)) - { - return; - } - - assert(dynamic_cast<const WinSalBitmap*>(&rSSalBitmap)); - assert(dynamic_cast<const WinSalBitmap*>(&rSTransparentBitmap)); - - const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap); - const WinSalBitmap& rTransparentBitmap = static_cast<const WinSalBitmap&>(rSTransparentBitmap); - - SalTwoRect aPosAry = rPosAry; - int nDstX = static_cast<int>(aPosAry.mnDestX); - int nDstY = static_cast<int>(aPosAry.mnDestY); - int nDstWidth = static_cast<int>(aPosAry.mnDestWidth); - int nDstHeight = static_cast<int>(aPosAry.mnDestHeight); - HDC hDC = mrParent.getHDC(); - - ScopedHBITMAP hMemBitmap; - ScopedHBITMAP hMaskBitmap; - - if( ( nDstWidth > CACHED_HDC_DEFEXT ) || ( nDstHeight > CACHED_HDC_DEFEXT ) ) - { - hMemBitmap.reset(CreateCompatibleBitmap(hDC, nDstWidth, nDstHeight)); - hMaskBitmap.reset(CreateCompatibleBitmap(hDC, nDstWidth, nDstHeight)); - } - - ScopedCachedHDC<CACHED_HDC_1> hMemDC(hMemBitmap.get()); - ScopedCachedHDC<CACHED_HDC_2> hMaskDC(hMaskBitmap.get()); - - aPosAry.mnDestX = aPosAry.mnDestY = 0; - BitBlt( hMemDC.get(), 0, 0, nDstWidth, nDstHeight, hDC, nDstX, nDstY, SRCCOPY ); - - // WIN/WNT seems to have a minor problem mapping the correct color of the - // mask to the palette if we draw the DIB directly ==> draw DDB - if( ( GetBitCount() <= 8 ) && rTransparentBitmap.ImplGethDIB() && rTransparentBitmap.GetBitCount() == 1 ) - { - WinSalBitmap aTmp; - - if( aTmp.Create( rTransparentBitmap, &mrParent ) ) - ImplDrawBitmap( hMaskDC.get(), aPosAry, aTmp, false, SRCCOPY ); - } - else - ImplDrawBitmap( hMaskDC.get(), aPosAry, rTransparentBitmap, false, SRCCOPY ); - - // now MemDC contains background, MaskDC the transparency mask - - // #105055# Respect XOR mode - if( mbXORMode ) - { - ImplDrawBitmap( hMaskDC.get(), aPosAry, rSalBitmap, false, SRCERASE ); - // now MaskDC contains the bitmap area with black background - BitBlt( hMemDC.get(), 0, 0, nDstWidth, nDstHeight, hMaskDC.get(), 0, 0, SRCINVERT ); - // now MemDC contains background XORed bitmap area on top - } - else - { - BitBlt( hMemDC.get(), 0, 0, nDstWidth, nDstHeight, hMaskDC.get(), 0, 0, SRCAND ); - // now MemDC contains background with masked-out bitmap area - ImplDrawBitmap( hMaskDC.get(), aPosAry, rSalBitmap, false, SRCERASE ); - // now MaskDC contains the bitmap area with black background - BitBlt( hMemDC.get(), 0, 0, nDstWidth, nDstHeight, hMaskDC.get(), 0, 0, SRCPAINT ); - // now MemDC contains background and bitmap merged together - } - // copy to output DC - BitBlt( hDC, nDstX, nDstY, nDstWidth, nDstHeight, hMemDC.get(), 0, 0, SRCCOPY ); -} - bool WinSalGraphicsImpl::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) { diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index ea7c0b56c634..0cb651dd8c97 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -160,11 +160,6 @@ public: virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; - virtual void drawBitmap( - const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rMaskBitmap ) override; - virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx index 2d1cfb2c89b5..d2026181df2b 100644 --- a/vcl/win/gdi/salgdi2.cxx +++ b/vcl/win/gdi/salgdi2.cxx @@ -174,31 +174,6 @@ void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSal } } -void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSSalBitmap, - const SalBitmap& rSTransparentBitmap ) -{ - assert(&rSSalBitmap && "msvc -analyze gets confused here"); - if (dynamic_cast<const WinSalBitmap*>(&rSSalBitmap) == nullptr - && dynamic_cast<WinSkiaSalGraphicsImpl*>(mpImpl.get()) == nullptr - ) - { - WinSalBitmap aWinSalBitmap; - SalBitmap& rConstBitmap = const_cast<SalBitmap&>(rSSalBitmap); - convertToWinSalBitmap(rConstBitmap, aWinSalBitmap); - - WinSalBitmap aWinTransparentSalBitmap; - SalBitmap& rConstTransparentBitmap = const_cast<SalBitmap&>(rSTransparentBitmap); - convertToWinSalBitmap(rConstTransparentBitmap, aWinTransparentSalBitmap); - - mpImpl->drawBitmap(rPosAry, aWinSalBitmap, aWinTransparentSalBitmap); - } - else - { - mpImpl->drawBitmap(rPosAry, rSSalBitmap, rSTransparentBitmap); - } -} - bool WinSalGraphics::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) {
