From ad6d94009cf8ea526eb70bf1a07e5c6a21320f83 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Sat, 25 Oct 2014 18:51:51 +1100 Subject: vcl: Allow SalGraphics to draw gradients natively The aim of this patch is to allow for native gradient rendering in SalGraphics (i.e. let OpenGL do this natively). It is a two step process: 1. I need to allow gradient draw into SalGraphics, however the current completely intertwined with the metafile code in OutputDevice. I am seperating the gradient metafile code from the gradient drawing code. 2. After splitting the metafile stuff from the actual gradient drawing, I am now able to call on SalGraphics::DrawGradient(). This just calls on SalGraphics::drawGradient() which returns false if there is no way of drawing native gradients, and true if there is. If false, then we use OutputDevice's DrawGradient() functionality. Change-Id: Ibaaabe13b76a8e7a037d9f751b5f662653a50566 Reviewed-on: https://gerrit.libreoffice.org/12119 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock --- vcl/inc/generic/genpspgraphics.h | 2 ++ vcl/inc/headless/svpgdi.hxx | 1 + vcl/inc/quartz/salgdi.h | 1 + vcl/inc/salgdi.hxx | 11 +++++++++++ vcl/inc/unx/salgdi.h | 2 ++ vcl/inc/win/salgdi.h | 1 + 6 files changed, 18 insertions(+) (limited to 'vcl/inc') diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index 2a562c341ff7..30c8fecd5eea 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -148,6 +148,8 @@ public: const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ) SAL_OVERRIDE; + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) SAL_OVERRIDE { return false; }; + virtual void copyArea( long nDestX, long nDestY, long nSrcX, diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index a872d4a2019d..cbbac7a4b1dd 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -211,6 +211,7 @@ public: const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ) SAL_OVERRIDE; + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) SAL_OVERRIDE { return false; }; virtual void copyArea( long nDestX, long nDestY, diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 23d3bb3904a9..eb21e09a6710 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -237,6 +237,7 @@ public: const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, com::sun::star::drawing::LineCap eLineCap) SAL_OVERRIDE; + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) SAL_OVERRIDE { return false; }; // CopyArea --> No RasterOp, but ClipRegion virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 7e06ee6d82e7..2266d87ee64e 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -288,6 +288,12 @@ public: const sal_uInt8* const* pFlgAry, const OutputDevice *pOutDev ); + bool DrawGradient( + const tools::PolyPolygon& rPolyPoly, + const Gradient& rGradient, + OutputDevice* ); + + // CopyArea --> No RasterOp, but ClipRegion void CopyArea( long nDestX, long nDestY, @@ -451,6 +457,11 @@ protected: const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ) = 0; + + virtual bool drawGradient( + const tools::PolyPolygon& rPolyPoly, + const Gradient& rGradient ) = 0; + // CopyArea --> No RasterOp, but ClipRegion virtual void copyArea( long nDestX, long nDestY, diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index c4eea0fe3c37..f56411227405 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -277,6 +277,8 @@ public: basegfx::B2DLineJoin, com::sun::star::drawing::LineCap) SAL_OVERRIDE; virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency ); + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) SAL_OVERRIDE { return false; }; + #if 1 // TODO: remove these obselete methods virtual bool drawPolyLineBezier( sal_uInt32 nPoints, diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 66c561830e49..ca423fb46f8d 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -219,6 +219,7 @@ protected: virtual bool drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual bool drawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); + virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) SAL_OVERRIDE { return false; }; // CopyArea --> No RasterOp, but ClipRegion virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, -- cgit