diff options
author | Armin Le Grand <Armin.Le.Grand@me.com> | 2021-12-10 16:36:11 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2021-12-10 17:51:12 +0100 |
commit | 2c6e2fa596d4ecb22adb062a837f1bbf4384fed2 (patch) | |
tree | f2a588a1bbaa54faf5633dfdcce8e199322d639c /vcl | |
parent | 6494fba15ea93283b625bf6bdb4666709f22439f (diff) |
Revert "Re-Enable DrawTransformBitmapExDirect for render backends"
This reverts commit 7e5af164b7d293dd410710bed411e1ca64bbecf7.
Reason for revert: Not the best/effective way to clear out the stuff remaining to be done, would need additional stuff
Change-Id: Ia6ab90384da29a5e34eff0ab8881bad2ab49c58c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126601
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpgdi.cxx | 5 | ||||
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/qt5/QtGraphics.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/inc/salgdi.hxx | 15 | ||||
-rw-r--r-- | vcl/inc/salgdiimpl.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/skia/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/GenPspGfxBackend.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/qt5/QtGraphics_GDI.cxx | 3 | ||||
-rw-r--r-- | vcl/quartz/AquaGraphicsBackend.cxx | 2 | ||||
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 46 | ||||
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 12 | ||||
-rw-r--r-- | vcl/source/outdev/bitmapex.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.cxx | 5 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi2.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/generic/print/GenPspGfxBackend.cxx | 2 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.cxx | 5 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/win/gdi/salgdi_gdiplus.cxx | 9 |
23 files changed, 86 insertions, 62 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index b894183102be..ac375c3fadf0 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -830,6 +830,11 @@ bool SvpSalGraphics::drawTransformedBitmap( return true; } +bool SvpSalGraphics::hasFastDrawTransformedBitmap() const +{ + return false; +} + void SvpSalGraphics::clipRegion(cairo_t* cr, const vcl::Region& rClipRegion) { RectangleVector aRectangles; diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index c69462b89742..32168d87e727 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -147,6 +147,7 @@ protected: const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; + virtual bool hasFastDrawTransformedBitmap() const override; virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; cairo_t* createTmpCompatibleCairoContext() const; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index b5756584f11b..fed7c2cb88f0 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -149,6 +149,8 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; + bool hasFastDrawTransformedBitmap() const override; + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index f996ffff378d..f0aa925c6083 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -431,6 +431,8 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; + bool hasFastDrawTransformedBitmap() const override; + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 121f7044ca5c..716c9aa934a6 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -430,7 +430,7 @@ public: double fAlpha, const OutputDevice& rOutDev ); - bool ImplementsFastDrawTransformedBitmap(bool bTestAllowed) const; + bool HasFastDrawTransformedBitmap() const; bool DrawAlphaRect( tools::Long nX, tools::Long nY, @@ -600,6 +600,10 @@ protected: const SalBitmap* pAlphaBitmap, double fAlpha) = 0; + /// Used e.g. by canvas to know whether to cache the drawing. + /// See also tdf#138068. + virtual bool hasFastDrawTransformedBitmap() const = 0; + /** Render solid rectangle with given transparency * * @param nX Top left coordinate of rectangle @@ -625,10 +629,6 @@ private: bool m_bLastMirrorDeviceLTRButBiDiRtlSet; protected: - /// check/remember if FastDraw is implemented for this SalGraphics - bool m_bFastDrawTransformedBitmapChecked; - bool m_bFastDrawTransformedBitmap; - /// flags which hold the SetAntialiasing() value from OutputDevice bool m_bAntiAlias : 1; @@ -894,6 +894,11 @@ public: return GetImpl()->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha); } + bool hasFastDrawTransformedBitmap() const override + { + return GetImpl()->hasFastDrawTransformedBitmap(); + } + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override { diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 035f896b2456..cb4bc35bd942 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -212,6 +212,10 @@ public: const SalBitmap* pAlphaBitmap, double fAlpha) = 0; + /// Used e.g. by canvas to know whether to cache the drawing. + /// See also tdf#138068. + virtual bool hasFastDrawTransformedBitmap() const = 0; + virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 6db0e87cdb99..b5144a249207 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -173,6 +173,8 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; + virtual bool hasFastDrawTransformedBitmap() const override; + /** Render solid rectangle with given transparency @param nX Top left coordinate of rectangle diff --git a/vcl/inc/unx/GenPspGfxBackend.hxx b/vcl/inc/unx/GenPspGfxBackend.hxx index 181d9f7ab95d..a37ee433e6eb 100644 --- a/vcl/inc/unx/GenPspGfxBackend.hxx +++ b/vcl/inc/unx/GenPspGfxBackend.hxx @@ -111,6 +111,8 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) override; + bool hasFastDrawTransformedBitmap() const override; + bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override; diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index 92c638ba660a..2a1a9945bd17 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -253,6 +253,8 @@ public: const SalBitmap* pAlphaBitmap, double fAlpha) override; + virtual bool hasFastDrawTransformedBitmap() const override; + virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 065e7e25aa5a..b472ece0a256 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -309,6 +309,8 @@ public: const SalBitmap* pAlphaBitmap, double fAlpha) override; + virtual bool hasFastDrawTransformedBitmap() const override; + virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; private: diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index cbbe2d819c96..f87de50827df 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -661,7 +661,6 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, { if (fAlpha != 1.0) return false; - QImage aImage; if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage)) return false; @@ -682,6 +681,8 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, return true; } +bool QtGraphicsBackend::hasFastDrawTransformedBitmap() const { return false; } + bool QtGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) { diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 060ca471aef8..056d2cd0e32f 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -1299,6 +1299,8 @@ bool AquaGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, return true; } +bool AquaGraphicsBackend::hasFastDrawTransformedBitmap() const { return false; } + bool AquaGraphicsBackend::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) { diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 9e022a02dec6..593e2ffb57e4 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1829,6 +1829,13 @@ void SkiaSalGraphicsImpl::drawShader(const SalTwoRect& rPosAry, const sk_sp<SkSh postDraw(); } +bool SkiaSalGraphicsImpl::hasFastDrawTransformedBitmap() const +{ + // Return true even in raster mode, even that way Skia is faster than e.g. GraphicObject + // trying to handle stuff manually. + return true; +} + // Whether applying matrix needs image smoothing for the transformation. static bool matrixNeedsHighQuality(const SkMatrix& matrix) { diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 15a1a1384540..aafa8f157e70 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -54,8 +54,6 @@ SalGraphics::SalGraphics() m_aLastMirrorW(0), m_nLastMirrorDeviceLTRButBiDiRtlTranslate(0), m_bLastMirrorDeviceLTRButBiDiRtlSet(false), - m_bFastDrawTransformedBitmapChecked(false), - m_bFastDrawTransformedBitmap(false), m_bAntiAlias(false) { // read global RTL settings @@ -844,9 +842,6 @@ bool SalGraphics::DrawTransformedBitmap( double fAlpha, const OutputDevice& rOutDev) { - bool bRetval(false); - bool bDone(false); - if( (m_nLayout & SalLayoutFlags::BiDiRtl) || rOutDev.IsRTLEnabled() ) { // mirroring set @@ -861,49 +856,16 @@ bool SalGraphics::DrawTransformedBitmap( basegfx::B2DPoint aX = aTranslateToMirroredBounds * rX; basegfx::B2DPoint aY = aTranslateToMirroredBounds * rY; - bRetval = drawTransformedBitmap(aNull, aX, aY, rSourceBitmap, pAlphaBitmap, fAlpha); - bDone = true; + return drawTransformedBitmap(aNull, aX, aY, rSourceBitmap, pAlphaBitmap, fAlpha); } } - if(!bDone) - { - bRetval = drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha); - } - - if(bRetval && !m_bFastDrawTransformedBitmap) - { - // we had a sucessful call, note it for this SalGraphics - m_bFastDrawTransformedBitmap = true; - } - - return bRetval; + return drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha); } -bool SalGraphics::ImplementsFastDrawTransformedBitmap(bool bTestAllowed) const +bool SalGraphics::HasFastDrawTransformedBitmap() const { - // do not check when we already had a sucessful usage of drawTransformedBitmap (see above) - // only check if calling OutputDevice is not empty (bTestAllowed) - // check only once using the direct check method (see below) - if(!m_bFastDrawTransformedBitmap && bTestAllowed && !m_bFastDrawTransformedBitmapChecked) - { - // for check and to not change anything, get the top-left pixel as SalBitmap - // and try to paint it again. This avoids an extra virtual method hat would need - // to be implemened at all backends and cald all the time (virual calls). - // Nothing simpler came to my mind, maybe there is something... - SalGraphics* that(const_cast<SalGraphics*>(this)); - std::shared_ptr<SalBitmap> aTest(that->getBitmap(0, 0, 1, 1)); - that->m_bFastDrawTransformedBitmapChecked = true; - that->m_bFastDrawTransformedBitmap = that->drawTransformedBitmap( - basegfx::B2DPoint::getEmptyPoint(), - basegfx::B2DPoint(1.0, 0.0), - basegfx::B2DPoint(0.0, 1.0), - *aTest, - nullptr, - 1.0); - } - - return m_bFastDrawTransformedBitmap; + return hasFastDrawTransformedBitmap(); } bool SalGraphics::DrawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 2c6d3a50a7d9..53a9f774b71d 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -691,6 +691,18 @@ void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap, mpMetaFile = pOldMetaFile; } +bool OutputDevice::HasFastDrawTransformedBitmap() const +{ + if( ImplIsRecordLayout() ) + return false; + + if (!mpGraphics && !AcquireGraphics()) + return false; + assert(mpGraphics); + + return mpGraphics->HasFastDrawTransformedBitmap(); +} + void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle ) { assert(!is_double_buffered_window()); diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx index d5d35b762ede..7855d1ae5613 100644 --- a/vcl/source/outdev/bitmapex.cxx +++ b/vcl/source/outdev/bitmapex.cxx @@ -525,7 +525,7 @@ void OutputDevice::DrawTransformedBitmapEx( if(rtl::math::approxEqual( fAlpha, 1.0 )) fAlpha = 1.0; // avoid the need for approxEqual in backends - if(bTryDirectPaint && DrawTransformBitmapExDirect(aFullTransform, bitmapEx)) + if(bTryDirectPaint && mpGraphics->HasFastDrawTransformedBitmap() && DrawTransformBitmapExDirect(aFullTransform, bitmapEx)) return; // decompose matrix to check rotation and shear @@ -689,9 +689,4 @@ void OutputDevice::DrawTransformedBitmapEx( DrawBitmapEx(aDestPt, aDestSize, aTransformed); } -bool OutputDevice::ImplementsFastDrawTransformedBitmap() const -{ - return mpGraphics->ImplementsFastDrawTransformedBitmap(!GetOutputSizePixel().IsEmpty()); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 7c167255d33b..53226821b4a1 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -852,6 +852,11 @@ bool X11SalGraphicsImpl::drawTransformedBitmap( return false; } +bool X11SalGraphicsImpl::hasFastDrawTransformedBitmap() const +{ + return false; +} + bool X11SalGraphicsImpl::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) { diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index 56cfba5ba371..6257b47d613d 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -272,6 +272,8 @@ public: const SalBitmap* pAlphaBitmap, double fAlpha) override; + virtual bool hasFastDrawTransformedBitmap() const override; + /** Render solid rectangle with given transparency @param nTransparency diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx index 648de56744a0..cfdb272005a5 100644 --- a/vcl/unx/generic/gdi/salgdi2.cxx +++ b/vcl/unx/generic/gdi/salgdi2.cxx @@ -139,13 +139,14 @@ bool X11SalGraphics::drawTransformedBitmap( const SalBitmap* pAlphaBitmap, double fAlpha) { - // called mxImpl->drawTransformedBitmap anyways returns false, but spares a call - if( fAlpha != 1.0 ) - return false; - return mxImpl->drawTransformedBitmap( rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha ); } +bool X11SalGraphics::hasFastDrawTransformedBitmap() const +{ + return mxImpl->hasFastDrawTransformedBitmap(); +} + bool X11SalGraphics::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) { diff --git a/vcl/unx/generic/print/GenPspGfxBackend.cxx b/vcl/unx/generic/print/GenPspGfxBackend.cxx index 2201c54c69d8..7b461ff4f5c6 100644 --- a/vcl/unx/generic/print/GenPspGfxBackend.cxx +++ b/vcl/unx/generic/print/GenPspGfxBackend.cxx @@ -387,6 +387,8 @@ bool GenPspGfxBackend::drawTransformedBitmap(const basegfx::B2DPoint& /*rNull*/, return false; } +bool GenPspGfxBackend::hasFastDrawTransformedBitmap() const { return false; } + bool GenPspGfxBackend::drawAlphaRect(tools::Long /*nX*/, tools::Long /*nY*/, tools::Long /*nWidth*/, tools::Long /*nHeight*/, sal_uInt8 /*nTransparency*/) { diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 5d0bab4ebaac..2c418732561b 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -2714,6 +2714,11 @@ bool WinSalGraphicsImpl::drawTransformedBitmap( return false; } +bool WinSalGraphicsImpl::hasFastDrawTransformedBitmap() const +{ + return false; +} + bool WinSalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/, const Gradient& /*rGradient*/) { diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 697ae97dde17..86342533fc6c 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -228,6 +228,8 @@ public: const SalBitmap* pAlphaBitmap, double fAlpha) override; + virtual bool hasFastDrawTransformedBitmap() const override; + /** Render solid rectangle with given transparency @param nTransparency diff --git a/vcl/win/gdi/salgdi_gdiplus.cxx b/vcl/win/gdi/salgdi_gdiplus.cxx index bbf4889c14f4..13452f5c7a6e 100644 --- a/vcl/win/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/gdi/salgdi_gdiplus.cxx @@ -92,12 +92,13 @@ bool WinSalGraphics::drawTransformedBitmap( const SalBitmap* pAlphaBitmap, double fAlpha) { - // called mpImpl->drawTransformedBitmap also checks this, but spares a call - if( fAlpha != 1.0 ) - return false; - return mpImpl->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha); } +bool WinSalGraphics::hasFastDrawTransformedBitmap() const +{ + return mpImpl->hasFastDrawTransformedBitmap(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |