[Libreoffice-commits] .: svx/source

Radek Doulík rodo at kemper.freedesktop.org
Wed Jan 4 06:09:58 PST 2012


 svx/source/customshapes/EnhancedCustomShape2d.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 250f84daf8f443bf436e0a86c9a718c37749971a
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Jan 4 15:05:32 2012 +0100

    implemented QUADRATICCURVETO case of custom shape paths
    
     - convert them to cubic beziers, which we have in basegfx

diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 2b2078a..0d9f9a3 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1637,10 +1637,20 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
                 }
                 break;
 
-                case QUADRATICCURVETO :  // TODO
+                case QUADRATICCURVETO :
                     for ( sal_Int32 i(0L); ( i < nPntCount ) && ( rSrcPt + 1 < nCoordSize ); i++ )
                     {
-                        rSrcPt += 2;
+                        const Point aControl(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+                        const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+
+                        basegfx::B2DPoint aStartPointB2D( aNewB2DPolygon.getB2DPoint(aNewB2DPolygon.count() - 1 ) );
+                        Point aStartPoint( aStartPointB2D.getX(), aStartPointB2D.getY() );
+
+                        DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding control point (!)");
+                        aNewB2DPolygon.appendBezierSegment(
+                            basegfx::B2DPoint(aStartPoint.X() + 2.0*(aControl.X() - aStartPoint.X())/3.0, aStartPoint.Y() + 2.0*(aControl.Y() - aStartPoint.Y())/3.0),
+                            basegfx::B2DPoint(aEnd.X() + 2.0*(aControl.X() - aEnd.X())/3.0, aEnd.Y() + 2.0*(aControl.Y() - aEnd.Y())/3.0),
+                            basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
                     }
                     break;
 


More information about the Libreoffice-commits mailing list