Kaydet (Commit) 8659d189 authored tarafından Chris Sherlock's avatar Chris Sherlock

fdo#74702 Refactor gradient clipping functions

There are two gradient clipping functions: one uses a normal intersection
to get the symmetric difference to clip the gradient - this is used by
OS X and when printing. The other uses XOR clipping, which is an elegant
trick to implement complex clipping on graphics systems that have minimal
capabilities.
cf. http://www.openoffice.org/marketing/ooocon2008/programme/wednesday_1401.pdf

Change-Id: Iab16258c8e758c41a29337525927ba780329e887
Reviewed-on: https://gerrit.libreoffice.org/8873Tested-by: 's avatarLibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: 's avatarChris Sherlock <chris.sherlock79@gmail.com>
Tested-by: 's avatarChris Sherlock <chris.sherlock79@gmail.com>
üst 3b6dba35
......@@ -844,6 +844,12 @@ protected:
virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
void DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
virtual void ClipGradientToBounds( Gradient &rGradient, const PolyPolygon &rPolyPoly );
void ClipGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect );
void XORClipGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect );
virtual void ClipGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect );
private:
typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
......
......@@ -274,7 +274,10 @@ public:
protected:
long ImplGetGradientStepCount( long nMinRect ) SAL_OVERRIDE;
virtual void ClipGradientToBounds( Gradient &rGradient, const PolyPolygon &rPolyPoly ) SAL_OVERRIDE;
virtual void ClipGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect ) SAL_OVERRIDE;
virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
void ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { };
public:
......
This diff is collapsed.
......@@ -1812,4 +1812,19 @@ bool Printer::UsePolyPolygonForComplexGradient()
return true;
}
void Printer::ClipGradientToBounds ( Gradient &rGradient, const PolyPolygon &rPolyPoly )
{
const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
ClipGradient ( rGradient, rPolyPoly, aBoundRect );
}
void Printer::ClipGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect )
{
Push( PUSH_CLIPREGION );
IntersectClipRegion(Region(rPolyPoly));
DrawGradient( rBoundRect, rGradient );
Pop();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment