Loading common/gal/cairo/cairo_gal.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -223,6 +223,19 @@ void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aS cairo_new_sub_path( currentContext ); cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle ); if( isFillEnabled ) { VECTOR2D startPoint( cos( aStartAngle ) * aRadius + aCenterPoint.x, sin( aStartAngle ) * aRadius + aCenterPoint.y ); VECTOR2D endPoint( cos( aEndAngle ) * aRadius + aCenterPoint.x, sin( aEndAngle ) * aRadius + aCenterPoint.y ); cairo_move_to( currentContext, aCenterPoint.x, aCenterPoint.y ); cairo_line_to( currentContext, startPoint.x, startPoint.y ); cairo_line_to( currentContext, endPoint.x, endPoint.y ); cairo_close_path( currentContext ); } isElementAdded = true; } Loading common/gal/opengl/opengl_gal.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -377,17 +377,12 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a // Swap the angles, if start angle is greater than end angle SWAP( aStartAngle, >, aEndAngle ); VECTOR2D startPoint( cos( aStartAngle ), sin( aStartAngle ) ); VECTOR2D endPoint( cos( aEndAngle ), sin( aEndAngle ) ); VECTOR2D startEndPoint = startPoint + endPoint; VECTOR2D middlePoint = 0.5 * startEndPoint; Save(); currentManager->Translate( aCenterPoint.x, aCenterPoint.y, layerDepth ); if( isStrokeEnabled ) { double alphaIncrement = 2.0 * M_PI / CIRCLE_POINTS; const double alphaIncrement = 2.0 * M_PI / CIRCLE_POINTS; currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); VECTOR2D p( cos( aStartAngle ) * aRadius, sin( aStartAngle ) * aRadius ); Loading @@ -411,20 +406,24 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a if( isFillEnabled ) { double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; const double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; double alpha; currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); currentManager->Shader( SHADER_NONE ); // Triangle fan for( alpha = aStartAngle; ( alpha + alphaIncrement ) < aEndAngle; ) { currentManager->Vertex( middlePoint.x, middlePoint.y, 0.0 ); currentManager->Vertex( cos( alpha ), sin( alpha ), 0.0 ); currentManager->Vertex( 0.0, 0.0, 0.0 ); currentManager->Vertex( cos( alpha ) * aRadius, sin( alpha ) * aRadius, 0.0 ); alpha += alphaIncrement; currentManager->Vertex( cos( alpha ), sin( alpha ), 0.0 ); currentManager->Vertex( cos( alpha ) * aRadius, sin( alpha ) * aRadius, 0.0 ); } currentManager->Vertex( middlePoint.x, middlePoint.y, 0.0 ); currentManager->Vertex( cos( alpha ), sin( alpha ), 0.0 ); // The last missing triangle const VECTOR2D endPoint( cos( aEndAngle ) * aRadius, sin( aEndAngle ) * aRadius ); currentManager->Vertex( 0.0, 0.0, 0.0 ); currentManager->Vertex( cos( alpha ) * aRadius, sin( alpha ) * aRadius, 0.0 ); currentManager->Vertex( endPoint.x, endPoint.y, 0.0 ); } Loading Loading
common/gal/cairo/cairo_gal.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -223,6 +223,19 @@ void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aS cairo_new_sub_path( currentContext ); cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle ); if( isFillEnabled ) { VECTOR2D startPoint( cos( aStartAngle ) * aRadius + aCenterPoint.x, sin( aStartAngle ) * aRadius + aCenterPoint.y ); VECTOR2D endPoint( cos( aEndAngle ) * aRadius + aCenterPoint.x, sin( aEndAngle ) * aRadius + aCenterPoint.y ); cairo_move_to( currentContext, aCenterPoint.x, aCenterPoint.y ); cairo_line_to( currentContext, startPoint.x, startPoint.y ); cairo_line_to( currentContext, endPoint.x, endPoint.y ); cairo_close_path( currentContext ); } isElementAdded = true; } Loading
common/gal/opengl/opengl_gal.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -377,17 +377,12 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a // Swap the angles, if start angle is greater than end angle SWAP( aStartAngle, >, aEndAngle ); VECTOR2D startPoint( cos( aStartAngle ), sin( aStartAngle ) ); VECTOR2D endPoint( cos( aEndAngle ), sin( aEndAngle ) ); VECTOR2D startEndPoint = startPoint + endPoint; VECTOR2D middlePoint = 0.5 * startEndPoint; Save(); currentManager->Translate( aCenterPoint.x, aCenterPoint.y, layerDepth ); if( isStrokeEnabled ) { double alphaIncrement = 2.0 * M_PI / CIRCLE_POINTS; const double alphaIncrement = 2.0 * M_PI / CIRCLE_POINTS; currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); VECTOR2D p( cos( aStartAngle ) * aRadius, sin( aStartAngle ) * aRadius ); Loading @@ -411,20 +406,24 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a if( isFillEnabled ) { double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; const double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; double alpha; currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); currentManager->Shader( SHADER_NONE ); // Triangle fan for( alpha = aStartAngle; ( alpha + alphaIncrement ) < aEndAngle; ) { currentManager->Vertex( middlePoint.x, middlePoint.y, 0.0 ); currentManager->Vertex( cos( alpha ), sin( alpha ), 0.0 ); currentManager->Vertex( 0.0, 0.0, 0.0 ); currentManager->Vertex( cos( alpha ) * aRadius, sin( alpha ) * aRadius, 0.0 ); alpha += alphaIncrement; currentManager->Vertex( cos( alpha ), sin( alpha ), 0.0 ); currentManager->Vertex( cos( alpha ) * aRadius, sin( alpha ) * aRadius, 0.0 ); } currentManager->Vertex( middlePoint.x, middlePoint.y, 0.0 ); currentManager->Vertex( cos( alpha ), sin( alpha ), 0.0 ); // The last missing triangle const VECTOR2D endPoint( cos( aEndAngle ) * aRadius, sin( aEndAngle ) * aRadius ); currentManager->Vertex( 0.0, 0.0, 0.0 ); currentManager->Vertex( cos( alpha ) * aRadius, sin( alpha ) * aRadius, 0.0 ); currentManager->Vertex( endPoint.x, endPoint.y, 0.0 ); } Loading