summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canvas/source/vcl/canvashelper.cxx22
-rw-r--r--include/vcl/outdev.hxx6
-rw-r--r--vcl/headless/svpgdi.cxx5
-rw-r--r--vcl/inc/headless/svpgdi.hxx1
-rw-r--r--vcl/inc/qt5/Qt5Graphics.hxx1
-rw-r--r--vcl/inc/quartz/salgdi.h2
-rw-r--r--vcl/inc/salgdi.hxx5
-rw-r--r--vcl/inc/salgdiimpl.hxx3
-rw-r--r--vcl/inc/skia/gdiimpl.hxx2
-rw-r--r--vcl/inc/unx/genpspgraphics.h1
-rw-r--r--vcl/inc/unx/salgdi.h2
-rw-r--r--vcl/inc/win/salgdi.h3
-rw-r--r--vcl/qt5/Qt5Graphics_GDI.cxx2
-rw-r--r--vcl/quartz/salgdicommon.cxx5
-rw-r--r--vcl/skia/gdiimpl.cxx7
-rw-r--r--vcl/source/gdi/salgdilayout.cxx5
-rw-r--r--vcl/source/outdev/bitmap.cxx11
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx5
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.hxx2
-rw-r--r--vcl/unx/generic/gdi/salgdi2.cxx5
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx5
-rw-r--r--vcl/win/gdi/gdiimpl.cxx5
-rw-r--r--vcl/win/gdi/gdiimpl.hxx2
-rw-r--r--vcl/win/gdi/salgdi_gdiplus.cxx5
24 files changed, 112 insertions, 0 deletions
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 501741301d8e..89ee207989c6 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -723,6 +723,28 @@ namespace vclcanvas
// itself serves this purpose
return uno::Reference< rendering::XCachedPrimitive >(nullptr);
}
+ else if( !bModulateColors && mpOutDevProvider->getOutDev().HasFastDrawTransformedBitmap())
+ {
+ ::basegfx::B2DHomMatrix aSizeTransform;
+ aSizeTransform.scale( aBmpEx.GetSizePixel().Width(), aBmpEx.GetSizePixel().Height() );
+ aMatrix = aMatrix * aSizeTransform;
+
+ mpOutDevProvider->getOutDev().DrawTransformedBitmapEx( aMatrix, aBmpEx );
+ if( mp2ndOutDevProvider )
+ {
+ // HACK. Normally, CanvasHelper does not care about
+ // actually what mp2ndOutDev is... well, here we do &
+ // assume a 1bpp target - everything beyond 97%
+ // transparency is fully transparent
+ if( aBmpEx.IsAlpha() )
+ {
+ BitmapFilter::Filter(aBmpEx, BitmapAlphaClampFilter(253));
+ }
+
+ mp2ndOutDevProvider->getOutDev().DrawTransformedBitmapEx( aMatrix, aBmpEx );
+ }
+ return uno::Reference< rendering::XCachedPrimitive >(nullptr);
+ }
else
{
// Matrix contains non-trivial transformation (or
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index d101b6c8c571..2eb6fd9e882e 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1485,6 +1485,12 @@ public:
const basegfx::B2DHomMatrix& rTransformation,
const BitmapEx& rBitmapEx);
+ /** Return true if DrawTransformedBitmapEx() is fast.
+
+ @since 7.2
+ */
+ bool HasFastDrawTransformedBitmap() const;
+
protected:
virtual void DrawDeviceBitmap(
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index ab28f158be0a..5c713657d755 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -829,6 +829,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 d9ec43c0b0ef..a0a20e508d72 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -145,6 +145,7 @@ protected:
const basegfx::B2DPoint& rY,
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx
index a163db87d94a..87ffc938becf 100644
--- a/vcl/inc/qt5/Qt5Graphics.hxx
+++ b/vcl/inc/qt5/Qt5Graphics.hxx
@@ -155,6 +155,7 @@ public:
bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX,
const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index ce68b75b0b06..b3df7550ebf9 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -296,6 +296,8 @@ public:
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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/salgdi.hxx b/vcl/inc/salgdi.hxx
index 92a587841a9c..44ddf34a50ff 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -416,6 +416,8 @@ public:
const SalBitmap* pAlphaBitmap,
const OutputDevice& rOutDev );
+ bool HasFastDrawTransformedBitmap() const;
+
bool DrawAlphaRect(
tools::Long nX, tools::Long nY,
tools::Long nWidth, tools::Long nHeight,
@@ -580,6 +582,9 @@ protected:
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) = 0;
+ /// Used e.g. by canvas to know whether to cache the drawing.
+ virtual bool hasFastDrawTransformedBitmap() const = 0;
+
/** Render solid rectangle with given transparency
*
* @param nX Top left coordinate of rectangle
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index e349edadddc4..eb1508dcf7d6 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -196,6 +196,9 @@ public:
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) = 0;
+ /// Used e.g. by canvas to know whether to cache the drawing.
+ 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 6b60f63ae405..53a9a0ae0978 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -176,6 +176,8 @@ public:
const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index b8e55627cf8c..a572a9013c63 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -190,6 +190,7 @@ public:
const basegfx::B2DPoint& rY,
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 56f587e521a8..d8e175750813 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -248,6 +248,8 @@ public:
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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 52b04aaf26b9..ca04f2469d66 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -290,6 +290,9 @@ public:
const basegfx::B2DPoint& rY,
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index 5c4db9ecceb3..fbcc3d32d0d9 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -653,6 +653,8 @@ bool Qt5Graphics::drawTransformedBitmap(const basegfx::B2DPoint& rNull, const ba
return true;
}
+bool Qt5Graphics::hasFastDrawTransformedBitmap() const { return false; }
+
bool Qt5Graphics::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
tools::Long nHeight, sal_uInt8 nTransparency)
{
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index f58cfecf712e..b74dbda15360 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -375,6 +375,11 @@ bool AquaSalGraphics::drawTransformedBitmap(
return true;
}
+bool AquaSalGraphics::hasFastDrawTransformedBitmap() const
+{
+ return false;
+}
+
bool AquaSalGraphics::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 f9fdfcaa1300..d8077df48a68 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1751,6 +1751,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;
+}
+
bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
const basegfx::B2DPoint& rX,
const basegfx::B2DPoint& rY,
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index ed2a2ed21df2..d019b93e816b 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -859,6 +859,11 @@ bool SalGraphics::DrawTransformedBitmap(
return drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap);
}
+bool SalGraphics::HasFastDrawTransformedBitmap() const
+{
+ return hasFastDrawTransformedBitmap();
+}
+
bool SalGraphics::DrawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
sal_uInt8 nTransparency, const OutputDevice& rOutDev )
{
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 6c93084f0062..8f4fbef24ee0 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1430,6 +1430,17 @@ void OutputDevice::DrawTransformedBitmapEx(
DrawBitmapEx(aDestPt, aDestSize, aTransformed);
}
+bool OutputDevice::HasFastDrawTransformedBitmap() const
+{
+ if( ImplIsRecordLayout() )
+ return false;
+
+ if ( !mpGraphics && !AcquireGraphics() )
+ return false;
+
+ return mpGraphics->HasFastDrawTransformedBitmap();
+}
+
void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle )
{
assert(!is_double_buffered_window());
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 97d9067d0be7..680a9e5d14b8 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -851,6 +851,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 bb3092b25356..dcc4f641f3a3 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -272,6 +272,8 @@ public:
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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 d688f00fa743..c4954e9e6119 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -141,6 +141,11 @@ bool X11SalGraphics::drawTransformedBitmap(
return mxImpl->drawTransformedBitmap( rNull, rX, rY, rSourceBitmap, pAlphaBitmap );
}
+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/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 3d93a2c05ffe..4218da4ed53b 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -854,6 +854,11 @@ bool GenPspGraphics::drawTransformedBitmap(
return false;
}
+bool GenPspGraphics::hasFastDrawTransformedBitmap() const
+{
+ return false;
+}
+
bool GenPspGraphics::drawAlphaRect( tools::Long, tools::Long, tools::Long, tools::Long, sal_uInt8 )
{
return false;
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 7e524fd5f9ac..40c7bbbbdb84 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2710,6 +2710,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 b7e87ce97116..0d9d9b30ce2c 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -228,6 +228,8 @@ public:
const SalBitmap& rSourceBitmap,
const SalBitmap* pAlphaBitmap) 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 f56a227609f9..8a85f033783b 100644
--- a/vcl/win/gdi/salgdi_gdiplus.cxx
+++ b/vcl/win/gdi/salgdi_gdiplus.cxx
@@ -95,4 +95,9 @@ bool WinSalGraphics::drawTransformedBitmap(
rSourceBitmap, pAlphaBitmap);
}
+bool WinSalGraphics::hasFastDrawTransformedBitmap() const
+{
+ return mpImpl->hasFastDrawTransformedBitmap();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */