diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-17 01:45:58 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-17 02:41:13 +1000 |
commit | 2024224a4ee351841f50a6f7b8a267f605a17096 (patch) | |
tree | f6f3ff8343609ccb1707b141c3deefff413018ac | |
parent | e1f9e73893e3d5760dab45b9322eca9fb8ce7ac4 (diff) |
Move bezier functions
Move ImplSubdivideBezier(Polygon) to Polygon as a static function.
Move ImplSubdivideBezier(PolyPolygon) to PolyPolygon as a static function.
Change-Id: I0d006a8a2d3a8d9ba1aec913ceecb38507e4dd2f
-rw-r--r-- | include/tools/poly.hxx | 2 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 3 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 12 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 11 | ||||
-rw-r--r-- | vcl/source/outdev/bezier.cxx | 20 | ||||
-rw-r--r-- | vcl/source/outdev/polygon.cxx | 6 | ||||
-rw-r--r-- | vcl/source/outdev/polyline.cxx | 4 |
7 files changed, 30 insertions, 28 deletions
diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index 5f5171c99005..dbfb94da729a 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -156,6 +156,7 @@ public: pixel. */ void AdaptiveSubdivide( Polygon& rResult, const double d = 1.0 ) const; + static Polygon SubdivideBezier( const Polygon& rPoly ); void Move( long nHorzMove, long nVertMove ); void Translate( const Point& rTrans ); @@ -242,6 +243,7 @@ public: pixel. */ void AdaptiveSubdivide( PolyPolygon& rResult, const double d = 1.0 ) const; + static PolyPolygon SubdivideBezier( const PolyPolygon& rPolyPoly ); void GetIntersection( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const; void GetUnion( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const; diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 6b19451b9c7a..420fe444a0ce 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -275,9 +275,6 @@ typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl; const char* ImplDbgCheckOutputDevice( const void* pObj ); -Polygon ImplSubdivideBezier( const Polygon& rPoly ); -PolyPolygon ImplSubdivideBezier( const PolyPolygon& rPolyPoly ); - sal_uLong ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix ); void ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect ); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index c2377953d5e4..f9a23a91f694 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -277,6 +277,18 @@ void ImplPolygon::ImplCreateFlagArray() } } + +Polygon Polygon::SubdivideBezier( const Polygon& rPoly ) +{ + Polygon aPoly; + + // #100127# Use adaptive subdivide instead of fixed 25 segments + rPoly.AdaptiveSubdivide( aPoly ); + + return aPoly; +} + + inline void Polygon::ImplMakeUnique() { // copy references if any exist diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 3804cdb29114..4bff3622518d 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -295,6 +295,17 @@ void PolyPolygon::AdaptiveSubdivide( PolyPolygon& rResult, const double d ) cons } } +PolyPolygon PolyPolygon::SubdivideBezier( const PolyPolygon& rPolyPoly ) +{ + sal_uInt16 i, nPolys = rPolyPoly.Count(); + PolyPolygon aPolyPoly( nPolys ); + for( i=0; i<nPolys; ++i ) + aPolyPoly.Insert( Polygon::SubdivideBezier( rPolyPoly.GetObject(i) ) ); + + return aPolyPoly; +} + + void PolyPolygon::GetIntersection( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const { ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_INT ); diff --git a/vcl/source/outdev/bezier.cxx b/vcl/source/outdev/bezier.cxx index f60eb57d6139..5046f65e3876 100644 --- a/vcl/source/outdev/bezier.cxx +++ b/vcl/source/outdev/bezier.cxx @@ -19,23 +19,3 @@ #include <vcl/outdev.hxx> #include <tools/poly.hxx> - -Polygon ImplSubdivideBezier( const Polygon& rPoly ) -{ - Polygon aPoly; - - // #100127# Use adaptive subdivide instead of fixed 25 segments - rPoly.AdaptiveSubdivide( aPoly ); - - return aPoly; -} - -PolyPolygon ImplSubdivideBezier( const PolyPolygon& rPolyPoly ) -{ - sal_uInt16 i, nPolys = rPolyPoly.Count(); - PolyPolygon aPolyPoly( nPolys ); - for( i=0; i<nPolys; ++i ) - aPolyPoly.Insert( ImplSubdivideBezier( rPolyPoly.GetObject(i) ) ); - - return aPolyPoly; -} diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index 312625dfd850..74026755b166 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -219,7 +219,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) const sal_uInt8* pFlgAry = aPoly.GetConstFlagAry(); if( !mpGraphics->DrawPolygonBezier( nPoints, pPtAry, pFlgAry, this ) ) { - aPoly = ImplSubdivideBezier(aPoly); + aPoly = Polygon::SubdivideBezier(aPoly); pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); mpGraphics->DrawPolygon( aPoly.GetSize(), pPtAry, this ); } @@ -373,7 +373,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const PolyPolygon& rPo { if( !mpGraphics->DrawPolygonBezier( *pPointAry, *pPointAryAry, *pFlagAryAry, this ) ) { - Polygon aPoly = ImplSubdivideBezier( rPolyPoly.GetObject( last ) ); + Polygon aPoly = Polygon::SubdivideBezier( rPolyPoly.GetObject( last ) ); mpGraphics->DrawPolygon( aPoly.GetSize(), (const SalPoint*)aPoly.GetConstPointAry(), this ); } } @@ -389,7 +389,7 @@ void OutputDevice::ImplDrawPolyPolygon( sal_uInt16 nPoly, const PolyPolygon& rPo { if( !mpGraphics->DrawPolyPolygonBezier( j, pPointAry, pPointAryAry, pFlagAryAry, this ) ) { - PolyPolygon aPolyPoly = ImplSubdivideBezier( rPolyPoly ); + PolyPolygon aPolyPoly = PolyPolygon::SubdivideBezier( rPolyPoly ); ImplDrawPolyPolygon( aPolyPoly.Count(), aPolyPoly ); } } diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx index 26693376a25b..b9da23e110d1 100644 --- a/vcl/source/outdev/polyline.cxx +++ b/vcl/source/outdev/polyline.cxx @@ -87,7 +87,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) const sal_uInt8* pFlgAry = aPoly.GetConstFlagAry(); if( !mpGraphics->DrawPolyLineBezier( nPoints, pPtAry, pFlgAry, this ) ) { - aPoly = ImplSubdivideBezier(aPoly); + aPoly = Polygon::SubdivideBezier(aPoly); pPtAry = (const SalPoint*)aPoly.GetConstPointAry(); mpGraphics->DrawPolyLine( aPoly.GetSize(), pPtAry, this ); } @@ -277,7 +277,7 @@ void OutputDevice::ImplDrawPolyLineWithLineInfo(const Polygon& rPoly, const Line // NO way to find out there that it's a curve. if( aPoly.HasFlags() ) { - aPoly = ImplSubdivideBezier( aPoly ); + aPoly = Polygon::SubdivideBezier( aPoly ); nPoints = aPoly.GetSize(); } |