include/vcl/outdev.hxx | 19 - include/vcl/virdev.hxx | 6 vcl/headless/SvpGraphicsBackend.cxx | 13 - vcl/inc/bitmap/bmpfast.hxx | 4 vcl/inc/headless/SvpGraphicsBackend.hxx | 5 vcl/inc/qt5/QtGraphics.hxx | 5 vcl/inc/quartz/salgdi.h | 5 vcl/inc/salgdi.hxx | 35 --- vcl/inc/salgdiimpl.hxx | 10 vcl/inc/skia/gdiimpl.hxx | 6 vcl/inc/win/salgdi.h | 8 vcl/qt5/QtGraphics_GDI.cxx | 12 - vcl/quartz/AquaGraphicsBackend.cxx | 13 - vcl/skia/gdiimpl.cxx | 77 ------- vcl/source/bitmap/bmpfast.cxx | 253 ------------------------ vcl/source/gdi/salgdilayout.cxx | 30 -- vcl/source/gdi/virdev.cxx | 14 - vcl/source/outdev/bitmap.cxx | 106 ---------- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 8 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 7 vcl/win/gdi/gdiimpl.cxx | 16 - vcl/win/gdi/gdiimpl.hxx | 10 vcl/win/gdi/salgdi_gdiplus.cxx | 16 - 23 files changed, 678 deletions(-)
New commits: commit 9ed572baa1916a8633cbd6e14ccaffee17ae8c30 Author: Noel Grandin <[email protected]> AuthorDate: Wed Jul 23 11:12:53 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Jul 24 10:49:58 2025 +0200 loplugin:unusedmethods mostly since commit 088a7c7c451321a800ca8d3523a18b6bb93239b7 Author: Noel Grandin <[email protected]> Date: Tue Sep 24 16:18:11 2024 +0200 remove alpha device from OutputDevice Change-Id: I72859790b31df6f721ffea5cf79222b97a96f06a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188209 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index c8f11f1f10cf..538d2bfee842 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1441,25 +1441,6 @@ private: Size const & aOutSz, Point const & aOutPt); - SAL_DLLPRIVATE void BlendBitmap( - const SalTwoRect& rPosAry, - const Bitmap& rBmp ); - - SAL_DLLPRIVATE Bitmap BlendBitmap( - Bitmap& aBmp, - BitmapReadAccess const * pP, - BitmapReadAccess const * pA, - const sal_Int32 nOffY, - const sal_Int32 nDstHeight, - const sal_Int32 nOffX, - const sal_Int32 nDstWidth, - const tools::Rectangle& aBmpRect, - const Size& aOutSz, - const bool bHMirr, - const bool bVMirr, - const sal_Int32* pMapX, - const sal_Int32* pMapY ); - static SAL_DLLPRIVATE Bitmap BlendBitmapWithAlpha( Bitmap& aBmp, BitmapReadAccess const * pP, diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 84a7df790aec..1a1785cf043b 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -60,12 +60,6 @@ private: VirtualDevice (const VirtualDevice &) = delete; VirtualDevice & operator= (const VirtualDevice &) = delete; - /** Used for alpha VDev, to set areas to opaque - - @since \#i32109# - */ - SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const tools::Rectangle& rRect ); - protected: virtual bool AcquireGraphics() const override; virtual void ReleaseGraphics( bool bRelease = true ) override; diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index 61f7454b7b66..310d2f33de40 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -212,19 +212,6 @@ void SvpGraphicsBackend::invert(sal_uInt32 nPoints, const Point* pPtAry, SalInve m_rCairoCommon.invert(nPoints, pPtAry, nFlags, getAntiAlias()); } -bool SvpGraphicsBackend::blendBitmap(const SalTwoRect& /*rPosAry*/, const SalBitmap& /*rBitmap*/) -{ - return false; -} - -bool SvpGraphicsBackend::blendAlphaBitmap(const SalTwoRect& /*rPosAry*/, - const SalBitmap& /*rSrcBitmap*/, - const SalBitmap& /*rMaskBitmap*/, - const SalBitmap& /*rAlphaBitmap*/) -{ - return false; -} - bool SvpGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rTR, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) { diff --git a/vcl/inc/bitmap/bmpfast.hxx b/vcl/inc/bitmap/bmpfast.hxx index e76dcdeb2487..c04c542d6634 100644 --- a/vcl/inc/bitmap/bmpfast.hxx +++ b/vcl/inc/bitmap/bmpfast.hxx @@ -39,10 +39,6 @@ bool ImplFastCopyScanline( tools::Long nY, BitmapBuffer& rDst, const BitmapBuffe bool ImplFastCopyScanline( tools::Long nY, BitmapBuffer& rDst, ConstScanline aSrcScanline, ScanlineFormat nSrcScanlineFormat, sal_uInt32 nSrcScanlineSize); -bool ImplFastBitmapBlending( BitmapWriteAccess const & rDst, - const BitmapReadAccess& rSrc, const BitmapReadAccess& rMask, - const SalTwoRect& rTwoRect ); - bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index 28851fb0e112..d6a3260c09a9 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -102,11 +102,6 @@ public: void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; - bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; - - bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; - bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index 898a0e3f9943..2fe97adcc9d9 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -131,11 +131,6 @@ public: void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override; - bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; - - bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; - bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index c3213832f5a7..ee40c46102ae 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -343,11 +343,6 @@ public: bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize) override; - bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; - - bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; - bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 4bd2f31d487b..36c8957a4dc3 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -349,18 +349,6 @@ public: */ inline bool UpdateSettings(AllSettings&); - SAL_DLLPRIVATE bool BlendBitmap( - const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const OutputDevice& rOutDev ); - - SAL_DLLPRIVATE bool BlendAlphaBitmap( - const SalTwoRect& rPosAry, - const SalBitmap& rSalSrcBitmap, - const SalBitmap& rSalMaskBitmap, - const SalBitmap& rSalAlphaBitmap, - const OutputDevice& rOutDev ); - SAL_DLLPRIVATE bool DrawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, @@ -517,18 +505,6 @@ protected: void* /*pPtr*/, sal_uInt32 /*nSize*/ ) { return false; } - /** Blend the bitmap with the current buffer */ - virtual bool blendBitmap( - const SalTwoRect&, - const SalBitmap& rBitmap ) = 0; - - /** Draw the bitmap by blending using the mask and alpha channel */ - virtual bool blendAlphaBitmap( - const SalTwoRect&, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap ) = 0; - /** Render bitmap with alpha channel @param rSourceBitmap @@ -823,17 +799,6 @@ public: return GetImpl()->getPixel(nX, nY); } - bool blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& rBitmap) override - { - return GetImpl()->blendBitmap(rPosAry, rBitmap); - } - - bool blendAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, - const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override - { - return GetImpl()->blendAlphaBitmap(rPosAry, rSourceBitmap, rMaskBitmap, rAlphaBitmap); - } - bool drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) override { diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 54578b480f29..5d17c90a6c36 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -181,16 +181,6 @@ public: void* /*pPtr*/, sal_uInt32 /*nSize*/ ) { return false; } - virtual bool blendBitmap( - const SalTwoRect&, - const SalBitmap& rBitmap ) = 0; - - virtual bool blendAlphaBitmap( - const SalTwoRect&, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap ) = 0; - virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index ff11958f30bc..5d376cc94539 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -124,12 +124,6 @@ public: virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override; - virtual bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; - - virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap) override; - virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override; virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 2423af293539..fdf999e9352a 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -120,14 +120,6 @@ public: void setHWND(HWND hWnd); void Flush(); - virtual bool blendBitmap( const SalTwoRect&, - const SalBitmap& rBitmap ) override; - - virtual bool blendAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap ) override; - virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap ) override; diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 70a78086545f..2ffb3659077d 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -570,18 +570,6 @@ void QtGraphicsBackend::invert(sal_uInt32 /*nPoints*/, const Point* /*pPtAry*/, { } -bool QtGraphicsBackend::blendBitmap(const SalTwoRect&, const SalBitmap& /*rBitmap*/) -{ - return false; -} - -bool QtGraphicsBackend::blendAlphaBitmap(const SalTwoRect&, const SalBitmap& /*rSrcBitmap*/, - const SalBitmap& /*rMaskBitmap*/, - const SalBitmap& /*rAlphaBitmap*/) -{ - return false; -} - static QImage getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) { assert(rSourceBitmap.GetSize() == rAlphaBitmap.GetSize()); diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 507ee139a043..77c8f7912d36 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -1209,19 +1209,6 @@ bool AquaGraphicsBackend::drawEPS(tools::Long /*nX*/, tools::Long /*nY*/, tools: } #endif -bool AquaGraphicsBackend::blendBitmap(const SalTwoRect& /*rPosAry*/, const SalBitmap& /*rBitmap*/) -{ - return false; -} - -bool AquaGraphicsBackend::blendAlphaBitmap(const SalTwoRect& /*rPosAry*/, - const SalBitmap& /*rSrcBitmap*/, - const SalBitmap& /*rMaskBitmap*/, - const SalBitmap& /*rAlphaBitmap*/) -{ - return false; -} - bool AquaGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp) { diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 9933350bc256..bcc6cc01c0f0 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1342,83 +1342,6 @@ void SkiaSalGraphicsImpl::privateCopyBits(const SalTwoRect& rPosAry, const SkiaS } } -bool SkiaSalGraphicsImpl::blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& rBitmap) -{ - if (checkInvalidSourceOrDestination(rPosAry)) - return false; - - assert(dynamic_cast<const SkiaSalBitmap*>(&rBitmap)); - const SkiaSalBitmap& rSkiaBitmap = static_cast<const SkiaSalBitmap&>(rBitmap); - // This is used by VirtualDevice in the alpha mode for the "alpha" layer - // So the result is transparent only if both the inputs - // are transparent. Which seems to be what SkBlendMode::kModulate does, - // so use that. - // See also blendAlphaBitmap(). - if (rSkiaBitmap.IsFullyOpaqueAsAlpha()) - { - // Optimization. If the bitmap means fully opaque, it's all one's. In CPU - // mode it should be faster to just copy instead of SkBlendMode::kMultiply. - drawBitmap(rPosAry, rSkiaBitmap); - } - else - drawBitmap(rPosAry, rSkiaBitmap, SkBlendMode::kModulate); - return true; -} - -bool SkiaSalGraphicsImpl::blendAlphaBitmap(const SalTwoRect& rPosAry, - const SalBitmap& rSourceBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap) -{ - // tdf#156361 use slow blending path if alpha mask blending is disabled - // SkiaSalGraphicsImpl::blendBitmap() fails unexpectedly in the following - // cases so return false and use the non-Skia alpha mask blending code: - // - Unexpected white areas when running a slideshow or printing: - // https://bugs.documentfoundation.org/attachment.cgi?id=188447 - // - Unexpected scaling of bitmap and/or alpha mask when exporting to PDF: - // https://bugs.documentfoundation.org/attachment.cgi?id=188498 - if (!SkiaHelper::isAlphaMaskBlendingEnabled()) - return false; - - if (checkInvalidSourceOrDestination(rPosAry)) - return false; - - assert(dynamic_cast<const SkiaSalBitmap*>(&rSourceBitmap)); - assert(dynamic_cast<const SkiaSalBitmap*>(&rMaskBitmap)); - assert(dynamic_cast<const SkiaSalBitmap*>(&rAlphaBitmap)); - const SkiaSalBitmap& rSkiaSourceBitmap = static_cast<const SkiaSalBitmap&>(rSourceBitmap); - const SkiaSalBitmap& rSkiaMaskBitmap = static_cast<const SkiaSalBitmap&>(rMaskBitmap); - const SkiaSalBitmap& rSkiaAlphaBitmap = static_cast<const SkiaSalBitmap&>(rAlphaBitmap); - - if (rSkiaMaskBitmap.IsFullyOpaqueAsAlpha()) - { - // Optimization. If the mask of the bitmap to be blended means it's actually opaque, - // just draw the bitmap directly (that's what the math below will result in). - drawBitmap(rPosAry, rSkiaSourceBitmap); - return true; - } - // This was originally implemented for the OpenGL drawing method and it is poorly documented. - // The source and mask bitmaps are the usual data and alpha bitmaps, and 'alpha' - // is the "alpha" layer of the VirtualDevice (the alpha in VirtualDevice is also stored - // as a separate bitmap). Now if I understand it correctly these two alpha masks first need - // to be combined into the actual alpha mask to be used. The formula for TYPE_BLEND - // in opengl's combinedTextureFragmentShader.glsl is - // "result_alpha = 1.0 - (1.0 - floor(alpha)) * mask". - // See also blendBitmap(). - - SkSamplingOptions samplingOptions = makeSamplingOptions(rPosAry, mScaling); - // First do the "( 1 - alpha ) * mask" - // (no idea how to do "floor", but hopefully not needed in practice). - sk_sp<SkShader> shaderAlpha - = SkShaders::Blend(SkBlendMode::kDstIn, rSkiaMaskBitmap.GetAlphaSkShader(samplingOptions), - rSkiaAlphaBitmap.GetAlphaSkShader(samplingOptions)); - // And now draw the bitmap with "1 - x", where x is the "( 1 - alpha ) * mask". - sk_sp<SkShader> shader = SkShaders::Blend(SkBlendMode::kSrcIn, shaderAlpha, - rSkiaSourceBitmap.GetSkShader(samplingOptions)); - drawShader(rPosAry, shader); - return true; -} - void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) { if (checkInvalidSourceOrDestination(rPosAry)) diff --git a/vcl/source/bitmap/bmpfast.cxx b/vcl/source/bitmap/bmpfast.cxx index 37fba37615b1..33661c7bc52f 100644 --- a/vcl/source/bitmap/bmpfast.cxx +++ b/vcl/source/bitmap/bmpfast.cxx @@ -214,52 +214,6 @@ static void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst, } } -// alpha blending truecolor pixels -template <ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> -static void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst, - const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal ) -{ - static const unsigned nAlphaShift = 8; - if( !nAlphaVal ) - ImplConvertPixel( rDst, rSrc ); - else if( nAlphaVal != ~(~0U << nAlphaShift) ) - { - int nR = rDst.GetRed(); - int nS = rSrc.GetRed(); - nR = nS + (((nR - nS) * nAlphaVal) >> nAlphaShift); - - int nG = rDst.GetGreen(); - nS = rSrc.GetGreen(); - nG = nS + (((nG - nS) * nAlphaVal) >> nAlphaShift); - - int nB = rDst.GetBlue(); - nS = rSrc.GetBlue(); - nB = nS + (((nB - nS) * nAlphaVal) >> nAlphaShift); - - rDst.SetColor( sal::static_int_cast<PIXBYTE>(nR), - sal::static_int_cast<PIXBYTE>(nG), - sal::static_int_cast<PIXBYTE>(nB) ); - } -} - -template <ScanlineFormat MASKFMT, ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> -static void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst, - const TrueColorPixelPtr<SRCFMT>& rSrc, const TrueColorPixelPtr<MASKFMT>& rMsk, - int nPixelCount ) -{ - TrueColorPixelPtr<MASKFMT> aMsk( rMsk ); - TrueColorPixelPtr<DSTFMT> aDst( rDst ); - TrueColorPixelPtr<SRCFMT> aSrc( rSrc ); - while( --nPixelCount >= 0 ) - { - // VCL masks store alpha as color, hence the GetRed() and not GetAlpha(). - ImplBlendPixels(aDst, aSrc, aMsk.GetRed()); - ++aDst; - ++aSrc; - ++aMsk; - } -} - static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer ) { const int nSrcLinestep = rSrcBuffer.mnScanlineSize; @@ -558,213 +512,6 @@ bool ImplFastCopyScanline( tools::Long nY, BitmapBuffer& rDst, const BitmapBuffe return ImplFastCopyScanline( nY, rDst, ImplGetScanline( rSrc, nY ), rSrc.meFormat, rSrc.mnScanlineSize); } -template <ScanlineFormat DSTFMT, ScanlineFormat SRCFMT> //,sal_uLong MSKFMT> -static bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, - BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, - const BitmapBuffer& rMskBuffer ) -{ - SAL_WARN_IF(rMskBuffer.meFormat != ScanlineFormat::N8BitPal, "vcl.gdi", "FastBmp BlendImage: unusual MSKFMT"); - - const int nSrcLinestep = rSrcBuffer.mnScanlineSize; - int nMskLinestep = rMskBuffer.mnScanlineSize; - int nDstLinestep = rDstBuffer.mnScanlineSize; - - TrueColorPixelPtr<ScanlineFormat::N8BitPal> aMskLine; aMskLine.SetRawPtr( rMskBuffer.mpBits ); - TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits ); - - // special case for single line masks - if( rMskBuffer.mnHeight == 1 ) - nMskLinestep = 0; - - // source and mask don't match: upside down - if (rSrcBuffer.meDirection != rMskBuffer.meDirection) - { - aMskLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nMskLinestep ); - nMskLinestep = -nMskLinestep; - } - - // source and destination don't match: upside down - if (rSrcBuffer.meDirection != rDstBuffer.meDirection) - { - aDstLine.AddByteOffset( (rDstBuffer.mnHeight - 1) * nDstLinestep ); - nDstLinestep = -nDstLinestep; - } - - assert(rDstBuffer.mnHeight <= rSrcBuffer.mnHeight && "not sure about that?"); - for (int y = rDstBuffer.mnHeight; --y >= 0;) - { - ImplBlendLines(aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth); - aDstLine.AddByteOffset( nDstLinestep ); - rSrcLine.AddByteOffset( nSrcLinestep ); - aMskLine.AddByteOffset( nMskLinestep ); - } - - return true; -} - -// some specializations to reduce the code size -template <> -bool ImplBlendToBitmap<ScanlineFormat::N24BitTcBgr,ScanlineFormat::N24BitTcBgr>( - TrueColorPixelPtr<ScanlineFormat::N24BitTcBgr>&, - BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, - const BitmapBuffer& rMskBuffer ) - { - TrueColorPixelPtr<ScanlineFormat::N24BitTcRgb> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits ); - return ImplBlendToBitmap<ScanlineFormat::N24BitTcRgb>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer ); - } - -template <> -bool ImplBlendToBitmap<ScanlineFormat::N32BitTcAbgr,ScanlineFormat::N32BitTcAbgr>( - TrueColorPixelPtr<ScanlineFormat::N32BitTcAbgr>&, - BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, - const BitmapBuffer& rMskBuffer ) - { - TrueColorPixelPtr<ScanlineFormat::N32BitTcArgb> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits ); - return ImplBlendToBitmap<ScanlineFormat::N32BitTcArgb>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer ); - } - -template <> -bool ImplBlendToBitmap<ScanlineFormat::N32BitTcBgra,ScanlineFormat::N32BitTcBgra>( - TrueColorPixelPtr<ScanlineFormat::N32BitTcBgra>&, - BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, - const BitmapBuffer& rMskBuffer ) - { - TrueColorPixelPtr<ScanlineFormat::N32BitTcRgba> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits ); - return ImplBlendToBitmap<ScanlineFormat::N32BitTcRgba>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer ); - } - -template <ScanlineFormat SRCFMT> -static bool ImplBlendFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc, const BitmapBuffer& rMsk ) -{ - TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits ); - - // select the matching instantiation for the destination's bitmap format - switch (rDst.meFormat) - { - case ScanlineFormat::N1BitMsbPal: - case ScanlineFormat::N8BitPal: - break; - - case ScanlineFormat::N24BitTcBgr: - return ImplBlendToBitmap<ScanlineFormat::N24BitTcBgr>( aSrcType, rDst, rSrc, rMsk ); - case ScanlineFormat::N24BitTcRgb: - return ImplBlendToBitmap<ScanlineFormat::N24BitTcRgb>( aSrcType, rDst, rSrc, rMsk ); - - case ScanlineFormat::N32BitTcAbgr: - case ScanlineFormat::N32BitTcXbgr: - return ImplBlendToBitmap<ScanlineFormat::N32BitTcAbgr>( aSrcType, rDst, rSrc, rMsk ); - case ScanlineFormat::N32BitTcArgb: - case ScanlineFormat::N32BitTcXrgb: - return ImplBlendToBitmap<ScanlineFormat::N32BitTcArgb>( aSrcType, rDst, rSrc, rMsk ); - case ScanlineFormat::N32BitTcBgra: - case ScanlineFormat::N32BitTcBgrx: - return ImplBlendToBitmap<ScanlineFormat::N32BitTcBgra>( aSrcType, rDst, rSrc, rMsk ); - case ScanlineFormat::N32BitTcRgba: - case ScanlineFormat::N32BitTcRgbx: - return ImplBlendToBitmap<ScanlineFormat::N32BitTcRgba>( aSrcType, rDst, rSrc, rMsk ); - default: break; - } - - static int nNotAccelerated = 0; - SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 100, - "vcl.gdi", - "ImplBlendFromBitmap for not accelerated case (" << std::hex << int(rSrc.meFormat) << "*" << int(rMsk.meFormat) << "->" << int(rDst.meFormat) ); - return false; -} - -bool ImplFastBitmapBlending( BitmapWriteAccess const & rDstWA, - const BitmapReadAccess& rSrcRA, const BitmapReadAccess& rMskRA, - const SalTwoRect& rTR ) -{ - // accelerated blending of paletted bitmaps not implemented yet - if( rSrcRA.HasPalette() ) - return false; - if( rDstWA.HasPalette() ) - return false; - // TODO: either get rid of mask's use of 8BIT_PAL or check the palette - - // horizontal mirroring not implemented yet - if( rTR.mnDestWidth < 0 ) - return false; - // vertical mirroring - if( rTR.mnDestHeight < 0 ) - // TODO: rDst.meDirection != ScanlineDirection::TopDown; - return false; - - // offsetted blending is not implemented yet - if( rTR.mnSrcX || rTR.mnSrcY ) - return false; - if( rTR.mnDestX || rTR.mnDestY ) - return false; - - // stretched blending is not implemented yet - if( rTR.mnDestWidth != rTR.mnSrcWidth ) - return false; - if( rTR.mnDestHeight!= rTR.mnSrcHeight ) - return false; - - // check source image size - if( rSrcRA.Width() < rTR.mnSrcX + rTR.mnSrcWidth ) - return false; - if( rSrcRA.Height() < rTR.mnSrcY + rTR.mnSrcHeight ) - return false; - - // check mask image size - if( rMskRA.Width() < rTR.mnSrcX + rTR.mnSrcWidth ) - return false; - if( rMskRA.Height() < rTR.mnSrcY + rTR.mnSrcHeight ) - if( rMskRA.Height() != 1 ) - return false; - - // check dest image size - if( rDstWA.Width() < rTR.mnDestX + rTR.mnDestWidth ) - return false; - if( rDstWA.Height() < rTR.mnDestY + rTR.mnDestHeight ) - return false; - - BitmapBuffer& rDst = *rDstWA.ImplGetBitmapBuffer(); - const BitmapBuffer& rSrc = *rSrcRA.ImplGetBitmapBuffer(); - const BitmapBuffer& rMsk = *rMskRA.ImplGetBitmapBuffer(); - - // select the matching instantiation for the source's bitmap format - switch (rSrc.meFormat) - { - case ScanlineFormat::N1BitMsbPal: - break; - - case ScanlineFormat::N8BitPal: - if(rSrc.maPalette.IsGreyPalette8Bit()) - return ImplBlendFromBitmap<ScanlineFormat::N8BitPal>( rDst, rSrc, rMsk ); - break; - - case ScanlineFormat::N24BitTcBgr: - return ImplBlendFromBitmap<ScanlineFormat::N24BitTcBgr>( rDst, rSrc, rMsk ); - case ScanlineFormat::N24BitTcRgb: - return ImplBlendFromBitmap<ScanlineFormat::N24BitTcRgb>( rDst, rSrc, rMsk ); - - case ScanlineFormat::N32BitTcAbgr: - case ScanlineFormat::N32BitTcXbgr: - return ImplBlendFromBitmap<ScanlineFormat::N32BitTcAbgr>( rDst, rSrc, rMsk ); - case ScanlineFormat::N32BitTcArgb: - case ScanlineFormat::N32BitTcXrgb: - return ImplBlendFromBitmap<ScanlineFormat::N32BitTcArgb>( rDst, rSrc, rMsk ); - case ScanlineFormat::N32BitTcBgra: - case ScanlineFormat::N32BitTcBgrx: - return ImplBlendFromBitmap<ScanlineFormat::N32BitTcBgra>( rDst, rSrc, rMsk ); - case ScanlineFormat::N32BitTcRgba: - case ScanlineFormat::N32BitTcRgbx: - return ImplBlendFromBitmap<ScanlineFormat::N32BitTcRgba>( rDst, rSrc, rMsk ); - default: break; - } - - static int nNotAccelerated = 0; - SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 100, - "vcl.gdi", - "ImplFastBlend for not accelerated case (" << std::hex << int(rSrc.meFormat) << "*" << int(rMsk.meFormat) << "->" << int(rDst.meFormat) << ")" ); - - return false; -} - bool ImplFastEraseBitmap( BitmapBuffer& rDst, const BitmapColor& rColor ) { // erasing a bitmap is often just a byte-wise memory fill diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 939b8c5b0dbb..797cfb91d55f 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -822,36 +822,6 @@ bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, return forWidget()->getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, OUString(), rNativeBoundingRegion, rNativeContentRegion); } -bool SalGraphics::BlendBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rBitmap, - const OutputDevice& rOutDev ) -{ - if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() ) - { - SalTwoRect aPosAry2 = rPosAry; - mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev ); - return blendBitmap( aPosAry2, rBitmap ); - } - else - return blendBitmap( rPosAry, rBitmap ); -} - -bool SalGraphics::BlendAlphaBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap, - const OutputDevice& rOutDev ) -{ - if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() ) - { - SalTwoRect aPosAry2 = rPosAry; - mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev ); - return blendAlphaBitmap( aPosAry2, rSrcBitmap, rMaskBitmap, rAlphaBitmap ); - } - else - return blendAlphaBitmap( rPosAry, rSrcBitmap, rMaskBitmap, rAlphaBitmap ); -} - bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap, diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 906311e89cec..07729bba42f0 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -337,20 +337,6 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra return bRet; } -// #i32109#: Fill opaque areas correctly (without relying on -// fill/linecolor state) -void VirtualDevice::ImplFillOpaqueRectangle( const tools::Rectangle& rRect ) -{ - // Set line and fill color to opaque, - // fill rect with that (linecolor, too, because of - // those pesky missing pixel problems) - Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR ); - SetLineColor( COL_ALPHA_OPAQUE ); - SetFillColor( COL_ALPHA_OPAQUE ); - DrawRect( rRect ); - Pop(); -} - bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase, bool bAlphaMaskTransparent ) { return InnerImplSetOutputSizePixel(rNewSize, bErase, bAlphaMaskTransparent); diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 441e2f370eeb..4205188fab36 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -555,13 +555,6 @@ namespace } } -void OutputDevice::BlendBitmap( - const SalTwoRect& rPosAry, - const Bitmap& rBmp ) -{ - mpGraphics->BlendBitmap( rPosAry, *rBmp.ImplGetSalBitmap(), *this ); -} - Bitmap OutputDevice::BlendBitmapWithAlpha( Bitmap& aBmp, BitmapReadAccess const * pP, @@ -599,103 +592,4 @@ Bitmap OutputDevice::BlendBitmapWithAlpha( return res; } -Bitmap OutputDevice::BlendBitmap( - Bitmap& aBmp, - BitmapReadAccess const * pP, - BitmapReadAccess const * pA, - const sal_Int32 nOffY, - const sal_Int32 nDstHeight, - const sal_Int32 nOffX, - const sal_Int32 nDstWidth, - const tools::Rectangle& aBmpRect, - const Size& aOutSz, - const bool bHMirr, - const bool bVMirr, - const sal_Int32* pMapX, - const sal_Int32* pMapY ) -{ - if( !pP || !pA ) - return aBmp; - - if( GetBitCount() <= 8 ) - { - Bitmap aDither(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP); - BitmapColor aIndex( 0 ); - BitmapScopedReadAccess pB(aBmp); - BitmapScopedWriteAccess pW(aDither); - - for( int nY = 0, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ ) - { - tools::Long nMapY = pMapY[ nY ]; - if (bVMirr) - { - nMapY = aBmpRect.Bottom() - nMapY; - } - const tools::Long nModY = ( nOutY & 0x0FL ) << 4; - - Scanline pScanline = pW->GetScanline(nY); - Scanline pScanlineAlpha = pA->GetScanline(nMapY); - for( int nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ ) - { - tools::Long nMapX = pMapX[ nX ]; - if (bHMirr) - { - nMapX = aBmpRect.Right() - nMapX; - } - const sal_uLong nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ]; - - BitmapColor aDstCol = pB->GetColor( nY, nX ); - aDstCol.Merge( pP->GetColor( nMapY, nMapX ), 255 - pA->GetIndexFromData( pScanlineAlpha, nMapX ) ); - aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16 ] + - nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16 ] + - nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16 ] ) ); - pW->SetPixelOnData( pScanline, nX, aIndex ); - } - } - - pB.reset(); - pW.reset(); - return aDither; - } - - BitmapScopedWriteAccess pB(aBmp); - - bool bFastBlend = false; - if (!bHMirr && !bVMirr) - { - SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(), - nOffX, nOffY, aOutSz.Width(), aOutSz.Height()); - - bFastBlend = ImplFastBitmapBlending(*pB, *pP, *pA, aTR); - } - - if (!bFastBlend) - { - for (int nY = 0; nY < nDstHeight; nY++) - { - tools::Long nMapY = pMapY[nY]; - - if (bVMirr) - nMapY = aBmpRect.Bottom() - nMapY; - - Scanline pAScan = pA->GetScanline(nMapY); - Scanline pBScan = pB->GetScanline(nY); - for(int nX = 0; nX < nDstWidth; nX++) - { - tools::Long nMapX = pMapX[nX]; - - if (bHMirr) - nMapX = aBmpRect.Right() - nMapX; - - BitmapColor aDstCol = pB->GetPixelFromData(pBScan, nX); - aDstCol.Merge(pP->GetColor(nMapY, nMapX), pAScan[nMapX]); - pB->SetPixelOnData(pBScan, nX, aDstCol); - } - } - } - - pB.reset(); - return aBmp; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index aea90a9b87f4..ba74c3c2fee2 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -208,14 +208,6 @@ bool X11CairoSalGraphicsImpl::drawPolyPolygonBezier(sal_uInt32, const sal_uInt32 return false; } -bool X11CairoSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap&) { return false; } - -bool X11CairoSalGraphicsImpl::blendAlphaBitmap(const SalTwoRect&, const SalBitmap&, - const SalBitmap&, const SalBitmap&) -{ - return false; -} - bool X11CairoSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY, diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index d53f7994056a..c72c3f9201f8 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -166,13 +166,6 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; - /** Blend bitmap with color channels */ - bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override; - - /** Render bitmap by blending using the mask and alpha channel */ - bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override; - bool supportsOperation(OutDevSupportType eType) const override; }; diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index afa19be6941a..956cac45ff68 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -2448,22 +2448,6 @@ bool WinSalGraphicsImpl::TryDrawBitmapGDIPlus(const SalTwoRect& rTR, const SalBi return true; } -bool WinSalGraphicsImpl::blendBitmap( - const SalTwoRect&, - const SalBitmap&) -{ - return false; -} - -bool WinSalGraphicsImpl::blendAlphaBitmap( - const SalTwoRect&, - const SalBitmap&, - const SalBitmap&, - const SalBitmap&) -{ - return false; -} - bool WinSalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& rTR, const SalBitmap& rSrcBitmap, diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 7959620d5243..ea7c0b56c634 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -182,16 +182,6 @@ public: virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override; - virtual bool blendBitmap( - const SalTwoRect&, - const SalBitmap& rBitmap ) override; - - virtual bool blendAlphaBitmap( - const SalTwoRect&, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap ) override; - /** Render bitmap with alpha channel @param rSourceBitmap diff --git a/vcl/win/gdi/salgdi_gdiplus.cxx b/vcl/win/gdi/salgdi_gdiplus.cxx index 198f755b231d..45b169b480fc 100644 --- a/vcl/win/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/gdi/salgdi_gdiplus.cxx @@ -60,22 +60,6 @@ bool WinSalGraphics::drawPolyLine( bPixelSnapHairline); } -bool WinSalGraphics::blendBitmap( - const SalTwoRect& rTR, - const SalBitmap& rBmp) -{ - return mpImpl->blendBitmap(rTR, rBmp); -} - -bool WinSalGraphics::blendAlphaBitmap( - const SalTwoRect& rTR, - const SalBitmap& rSrcBmp, - const SalBitmap& rMaskBmp, - const SalBitmap& rAlphaBmp) -{ - return mpImpl->blendAlphaBitmap(rTR, rSrcBmp, rMaskBmp, rAlphaBmp); -} - bool WinSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, const SalBitmap& rSrcBitmap,
