[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - svx/source

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


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

New commits:
commit e04085f538336e7e3eac16c6f67c210fb7eae741
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Jan 4 15:27:27 2012 +0100

    move the assert checking the polygon count higher
    
     - so that it is called before accessing polygon points

diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 0d9f9a3..f1fbf44 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1643,10 +1643,10 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
                         const Point aControl(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
                         const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
 
+                        DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding control point (!)");
                         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),
commit a76d4d31358073b37abdb52888527e7e359c1083
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