summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-09-25 20:26:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-09-26 13:00:23 +0200
commit0cabffc05f3b40f5ee897df73475e09a3c05fc70 (patch)
tree348d95049998ec1d4179f67a5ee907eaf2bc0a15 /canvas
parent25e7a5923edc507a2511dc17e3c238cd0f37e642 (diff)
tools::PolyPolygon -> basegfx in canvas
Change-Id: I7b5ac7b434932515895bf60acfa0109e6a2ebd18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103417 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/vcl/canvashelper.cxx14
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx18
-rw-r--r--canvas/source/vcl/impltools.cxx14
-rw-r--r--canvas/source/vcl/impltools.hxx4
-rw-r--r--canvas/source/vcl/spritehelper.cxx2
5 files changed, 28 insertions, 24 deletions
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 5cc5f3c42b73..a62057ce4a30 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -266,7 +266,7 @@ namespace vclcanvas
const ::basegfx::B2DPolyPolygon& rPolyPoly(
::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon) );
- const ::tools::PolyPolygon aPolyPoly( tools::mapPolyPolygon( rPolyPoly, viewState, renderState ) );
+ const ::basegfx::B2DPolyPolygon aPolyPoly( tools::mapPolyPolygon( rPolyPoly, viewState, renderState ) );
if( rPolyPoly.isClosed() )
{
@@ -284,9 +284,9 @@ namespace vclcanvas
// DrawPolygon(), and open ones via DrawPolyLine():
// closed polygons will simply already contain the
// closing segment.
- sal_uInt16 nSize( aPolyPoly.Count() );
+ sal_uInt32 nSize( aPolyPoly.count() );
- for( sal_uInt16 i=0; i<nSize; ++i )
+ for( sal_uInt32 i=0; i<nSize; ++i )
{
mpOutDevProvider->getOutDev().DrawPolyLine( aPolyPoly[i] );
@@ -476,7 +476,7 @@ namespace vclcanvas
::basegfx::B2DPolyPolygon aB2DPolyPoly(
::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
aB2DPolyPoly.setClosed(true); // ensure closed poly, otherwise VCL does not fill
- const ::tools::PolyPolygon aPolyPoly( tools::mapPolyPolygon(
+ const ::basegfx::B2DPolyPolygon aPolyPoly( tools::mapPolyPolygon(
aB2DPolyPoly,
viewState, renderState ) );
const bool bSourceAlpha( renderState.CompositeOperation == rendering::CompositeOperation::SOURCE );
@@ -486,8 +486,10 @@ namespace vclcanvas
}
else
{
- const int nTransPercent( (nTransparency * 100 + 128) / 255 ); // normal rounding, no truncation here
- mpOutDevProvider->getOutDev().DrawTransparent( aPolyPoly, static_cast<sal_uInt16>(nTransPercent) );
+ const double dTransparency( (nTransparency + 128) / 255.0 );
+ basegfx::B2DHomMatrix aIdentityMatrix;
+ aIdentityMatrix.identity();
+ mpOutDevProvider->getOutDev().DrawTransparent( aIdentityMatrix, aPolyPoly, dTransparency );
}
if( mp2ndOutDevProvider )
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 9cb8dd8abd99..b0b0ef3770d5 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -437,7 +437,7 @@ namespace vclcanvas
OutputDevice* p2ndOutDev,
const ::canvas::ParametricPolyPolygon::Values& rValues,
const std::vector< ::Color >& rColors,
- const ::tools::PolyPolygon& rPoly,
+ const ::basegfx::B2DPolyPolygon& rPoly,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const rendering::Texture& texture,
@@ -466,8 +466,8 @@ namespace vclcanvas
// determine maximal bound rect of texture-filled
// polygon
- const ::tools::Rectangle aPolygonDeviceRectOrig(
- rPoly.GetBoundRect() );
+ const ::basegfx::B2DRectangle aPolygonDeviceRectOrig(
+ rPoly.getB2DRange() );
if( tools::isRectangle( rPoly ) )
{
@@ -482,7 +482,7 @@ namespace vclcanvas
// twice for XOR
rOutDev.Push( PushFlags::CLIPREGION );
- rOutDev.IntersectClipRegion( aPolygonDeviceRectOrig );
+ rOutDev.IntersectClipRegion( ::tools::Rectangle(aPolygonDeviceRectOrig) );
doGradientFill( rOutDev,
rValues,
rColors,
@@ -570,7 +570,7 @@ namespace vclcanvas
tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDevProvider );
const int nTransparency( setupOutDevState( viewState, renderState, IGNORE_COLOR ) );
- ::tools::PolyPolygon aPolyPoly( tools::mapPolyPolygon(
+ ::basegfx::B2DPolyPolygon aPolyPoly( tools::mapPolyPolygon(
::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon),
viewState, renderState ) );
@@ -636,7 +636,7 @@ namespace vclcanvas
// determine maximal bound rect of texture-filled
// polygon
const ::tools::Rectangle aPolygonDeviceRect(
- aPolyPoly.GetBoundRect() );
+ aPolyPoly.getB2DRange() );
// first of all, determine whether we have a
@@ -945,8 +945,10 @@ namespace vclcanvas
// shift output to origin of VDev
const ::Point aOutPos( aPt - aPolygonDeviceRect.TopLeft() );
- aPolyPoly.Translate( ::Point( -aPolygonDeviceRect.Left(),
- -aPolygonDeviceRect.Top() ) );
+ basegfx::B2DHomMatrix aTranslateMatrix;
+ aTranslateMatrix.translate( -aPolygonDeviceRect.Left(),
+ -aPolygonDeviceRect.Top() );
+ aPolyPoly.transform( aTranslateMatrix );
const vcl::Region aPolyClipRegion( aPolyPoly );
diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx
index 754a34ce0806..b8341b401a05 100644
--- a/canvas/source/vcl/impltools.cxx
+++ b/canvas/source/vcl/impltools.cxx
@@ -134,20 +134,20 @@ namespace vclcanvas::tools
return true;
}
- bool isRectangle( const ::tools::PolyPolygon& rPolyPoly )
+ bool isRectangle( const ::basegfx::B2DPolyPolygon& rPolyPoly )
{
// exclude some cheap cases first
- if( rPolyPoly.Count() != 1 )
+ if( rPolyPoly.count() != 1 )
return false;
- const ::tools::Polygon& rPoly( rPolyPoly[0] );
+ const ::basegfx::B2DPolygon& rPoly( rPolyPoly[0] );
- sal_uInt16 nCount( rPoly.GetSize() );
+ sal_uInt16 nCount( rPoly.count() );
if( nCount < 4 )
return false;
// delegate to basegfx
- return ::basegfx::utils::isRectangle( rPoly.getB2DPolygon() );
+ return ::basegfx::utils::isRectangle( rPoly );
}
@@ -168,7 +168,7 @@ namespace vclcanvas::tools
return vcl::unotools::pointFromB2DPoint( aPoint );
}
- ::tools::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly,
+ ::basegfx::B2DPolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly,
const rendering::ViewState& rViewState,
const rendering::RenderState& rRenderState )
{
@@ -181,7 +181,7 @@ namespace vclcanvas::tools
aTemp.transform( aMatrix );
- return ::tools::PolyPolygon( aTemp );
+ return aTemp;
}
::BitmapEx transformBitmap( const BitmapEx& rBitmap,
diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx
index 028ea1174f3c..a97211e3e7cb 100644
--- a/canvas/source/vcl/impltools.hxx
+++ b/canvas/source/vcl/impltools.hxx
@@ -92,7 +92,7 @@ namespace vclcanvas
@return true, if the polygon is a rectangle.
*/
- bool isRectangle( const ::tools::PolyPolygon& rPolyPoly );
+ bool isRectangle( const ::basegfx::B2DPolyPolygon& rPolyPoly );
// Little helper to encapsulate locking into policy class
@@ -164,7 +164,7 @@ namespace vclcanvas
const css::rendering::ViewState& rViewState,
const css::rendering::RenderState& rRenderState );
- ::tools::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly,
+ ::basegfx::B2DPolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly,
const css::rendering::ViewState& rViewState,
const css::rendering::RenderState& rRenderState );
diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx
index e52bb211020c..d25d06a49168 100644
--- a/canvas/source/vcl/spritehelper.cxx
+++ b/canvas/source/vcl/spritehelper.cxx
@@ -266,7 +266,7 @@ namespace vclcanvas
rTargetSurface.SetLineColor( Color( 0,255,0 ) );
rTargetSurface.SetFillColor();
- rTargetSurface.DrawPolyPolygon(::tools::PolyPolygon(aClipPoly)); // #i76339#
+ rTargetSurface.DrawPolyPolygon(aClipPoly); // #i76339#
}
vcl::Region aClipRegion( aClipPoly );