diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-02-19 18:36:23 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-02-24 12:40:13 +0100 |
commit | 5ba5ac948db1092712ffeaef41983ea5f5dcb5cc (patch) | |
tree | 1efc83d9f17c5f458908300eb9d918e665531662 /vcl/win | |
parent | f57872d2da23c8a3f90c67b6ad4a3ad0f699a276 (diff) |
add additional 0-1 alpha argument to DrawTransformedBitmap()
This allows the VCL backends the apply the extra alpha transformation
as it sees fit, rather than it being done manually elsewhere (and
even if the backend doesn't implement it, at least do it in one
place in the function).
With the document from tdf#136223, going from slide 2 to slide 3,
this easily saves 10-30% of CPU cycles. As an additional bonus,
using AlphaMask::BlendWith() rather than AlphaMask::Replace()
makes edges of shapes noticeably more smooth.
Change-Id: I036dc9b887d6def0c7cdad3982becabdc7cd5206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111247
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/gdi/gdiimpl.cxx | 6 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.hxx | 3 | ||||
-rw-r--r-- | vcl/win/gdi/salgdi_gdiplus.cxx | 5 |
3 files changed, 10 insertions, 4 deletions
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 40c7bbbbdb84..cedd5f42a802 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -2649,11 +2649,15 @@ bool WinSalGraphicsImpl::drawTransformedBitmap( const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, - const SalBitmap* pAlphaBitmap) + const SalBitmap* pAlphaBitmap, + double fAlpha) { assert(dynamic_cast<const WinSalBitmap*>(&rSourceBitmap)); assert(!pAlphaBitmap || dynamic_cast<const WinSalBitmap*>(pAlphaBitmap)); + if( fAlpha != 1.0 ) + return false; + const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSourceBitmap); const WinSalBitmap* pSalAlpha = static_cast< const WinSalBitmap* >(pAlphaBitmap); std::shared_ptr< Gdiplus::Bitmap > aARGB(rSalBitmap.ImplGetGdiPlusBitmap(pSalAlpha)); diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 0d9d9b30ce2c..3f4d13f1c517 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -226,7 +226,8 @@ public: const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, - const SalBitmap* pAlphaBitmap) override; + const SalBitmap* pAlphaBitmap, + double fAlpha) override; virtual bool hasFastDrawTransformedBitmap() const override; diff --git a/vcl/win/gdi/salgdi_gdiplus.cxx b/vcl/win/gdi/salgdi_gdiplus.cxx index 8a85f033783b..13452f5c7a6e 100644 --- a/vcl/win/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/gdi/salgdi_gdiplus.cxx @@ -89,10 +89,11 @@ bool WinSalGraphics::drawTransformedBitmap( const basegfx::B2DPoint& rX, const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, - const SalBitmap* pAlphaBitmap) + const SalBitmap* pAlphaBitmap, + double fAlpha) { return mpImpl->drawTransformedBitmap(rNull, rX, rY, - rSourceBitmap, pAlphaBitmap); + rSourceBitmap, pAlphaBitmap, fAlpha); } bool WinSalGraphics::hasFastDrawTransformedBitmap() const |