diff options
-rw-r--r-- | canvas/source/vcl/canvashelper.cxx | 14 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper_texturefill.cxx | 18 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.cxx | 14 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.hxx | 4 | ||||
-rw-r--r-- | canvas/source/vcl/spritehelper.cxx | 2 | ||||
-rw-r--r-- | include/tools/gen.hxx | 9 |
6 files changed, 37 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 ); diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 14ded16a8f0a..0acef174718c 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -390,6 +390,7 @@ public: /// Constructs an empty Rectangle, with top/left at the specified params Rectangle( long nLeft, long nTop ); Rectangle( const Point& rLT, const Size& rSize ); + Rectangle( basegfx::B2DRectangle const & ); static Rectangle Justify( const Point& rLT, const Point& rRB ); @@ -533,6 +534,14 @@ inline tools::Rectangle::Rectangle( const Point& rLT, const Size& rSize ) nBottom = rSize.Height() ? nTop+(rSize.Height()-1) : RECT_EMPTY; } +inline tools::Rectangle::Rectangle( const basegfx::B2DRectangle& rRect ) +{ + nLeft = rRect.getMinX(); + nTop = rRect.getMinY(); + nRight = !rRect.isEmpty() ? rRect.getMaxX() : RECT_EMPTY; + nBottom = !rRect.isEmpty() ? rRect.getMaxY() : RECT_EMPTY; +} + inline bool tools::Rectangle::IsEmpty() const { return (nRight == RECT_EMPTY) || (nBottom == RECT_EMPTY); |