22// Anti-Grain Geometry - Version 2.4
33// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
44//
5- // Permission to copy, use, modify, sell and distribute this software
6- // is granted provided this copyright notice appears in all copies.
5+ // Permission to copy, use, modify, sell and distribute this software
6+ // is granted provided this copyright notice appears in all copies.
77// This software is provided "as is" without express or implied
88// warranty, and with no claim as to its suitability for any purpose.
99//
@@ -28,31 +28,31 @@ namespace agg
2828
2929
3030 // ---------------------------------------------------------------conv_curve
31- // Curve converter class. Any path storage can have Bezier curves defined
32- // by their control points. There're two types of curves supported: curve3
31+ // Curve converter class. Any path storage can have Bezier curves defined
32+ // by their control points. There're two types of curves supported: curve3
3333 // and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control
3434 // point. Curve4 has 2 control points (4 points in total) and can be used
35- // to interpolate more complicated curves. Curve4, unlike curve3 can be used
36- // to approximate arcs, both circular and elliptical. Curves are approximated
37- // with straight lines and one of the approaches is just to store the whole
38- // sequence of vertices that approximate our curve. It takes additional
39- // memory, and at the same time the consecutive vertices can be calculated
40- // on demand.
35+ // to interpolate more complicated curves. Curve4, unlike curve3 can be used
36+ // to approximate arcs, both circular and elliptical. Curves are approximated
37+ // with straight lines and one of the approaches is just to store the whole
38+ // sequence of vertices that approximate our curve. It takes additional
39+ // memory, and at the same time the consecutive vertices can be calculated
40+ // on demand.
4141 //
4242 // Initially, path storages are not suppose to keep all the vertices of the
4343 // curves (although, nothing prevents us from doing so). Instead, path_storage
4444 // keeps only vertices, needed to calculate a curve on demand. Those vertices
45- // are marked with special commands. So, if the path_storage contains curves
46- // (which are not real curves yet), and we render this storage directly,
47- // all we will see is only 2 or 3 straight line segments (for curve3 and
48- // curve4 respectively). If we need to see real curves drawn we need to
49- // include this class into the conversion pipeline.
45+ // are marked with special commands. So, if the path_storage contains curves
46+ // (which are not real curves yet), and we render this storage directly,
47+ // all we will see is only 2 or 3 straight line segments (for curve3 and
48+ // curve4 respectively). If we need to see real curves drawn we need to
49+ // include this class into the conversion pipeline.
5050 //
51- // Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4
52- // and converts these vertices into a move_to/line_to sequence.
51+ // Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4
52+ // and converts these vertices into a move_to/line_to sequence.
5353 // -----------------------------------------------------------------------
54- template <class VertexSource ,
55- class Curve3 =curve3,
54+ template <class VertexSource ,
55+ class Curve3 =curve3,
5656 class Curve4 =curve4> class conv_curve
5757 {
5858 public:
@@ -64,51 +64,51 @@ namespace agg
6464 m_source(&source), m_last_x(0.0 ), m_last_y(0.0 ) {}
6565 void attach (VertexSource& source) { m_source = &source; }
6666
67- void approximation_method (curve_approximation_method_e v)
68- {
67+ void approximation_method (curve_approximation_method_e v)
68+ {
6969 m_curve3.approximation_method (v);
7070 m_curve4.approximation_method (v);
7171 }
7272
73- curve_approximation_method_e approximation_method () const
74- {
73+ curve_approximation_method_e approximation_method () const
74+ {
7575 return m_curve4.approximation_method ();
7676 }
7777
78- void approximation_scale (double s)
79- {
80- m_curve3.approximation_scale (s);
81- m_curve4.approximation_scale (s);
78+ void approximation_scale (double s)
79+ {
80+ m_curve3.approximation_scale (s);
81+ m_curve4.approximation_scale (s);
8282 }
8383
84- double approximation_scale () const
85- {
86- return m_curve4.approximation_scale ();
84+ double approximation_scale () const
85+ {
86+ return m_curve4.approximation_scale ();
8787 }
8888
89- void angle_tolerance (double v)
90- {
91- m_curve3.angle_tolerance (v);
92- m_curve4.angle_tolerance (v);
89+ void angle_tolerance (double v)
90+ {
91+ m_curve3.angle_tolerance (v);
92+ m_curve4.angle_tolerance (v);
9393 }
9494
95- double angle_tolerance () const
96- {
97- return m_curve4.angle_tolerance ();
95+ double angle_tolerance () const
96+ {
97+ return m_curve4.angle_tolerance ();
9898 }
9999
100- void cusp_limit (double v)
101- {
102- m_curve3.cusp_limit (v);
103- m_curve4.cusp_limit (v);
100+ void cusp_limit (double v)
101+ {
102+ m_curve3.cusp_limit (v);
103+ m_curve4.cusp_limit (v);
104104 }
105105
106- double cusp_limit () const
107- {
108- return m_curve4.cusp_limit ();
106+ double cusp_limit () const
107+ {
108+ return m_curve4.cusp_limit ();
109109 }
110110
111- void rewind (unsigned path_id);
111+ void rewind (unsigned path_id);
112112 unsigned vertex (double * x, double * y);
113113
114114 private:
@@ -154,19 +154,19 @@ namespace agg
154154 return path_cmd_line_to;
155155 }
156156
157- double ct2_x;
158- double ct2_y;
159- double end_x;
160- double end_y;
157+ double ct2_x = 0.0 ;
158+ double ct2_y = 0.0 ;
159+ double end_x = 0.0 ;
160+ double end_y = 0.0 ;
161161
162162 unsigned cmd = m_source->vertex (x, y);
163163 switch (cmd)
164164 {
165165 case path_cmd_curve3:
166166 m_source->vertex (&end_x, &end_y);
167167
168- m_curve3.init (m_last_x, m_last_y,
169- *x, *y,
168+ m_curve3.init (m_last_x, m_last_y,
169+ *x, *y,
170170 end_x, end_y);
171171
172172 m_curve3.vertex (x, y); // First call returns path_cmd_move_to
@@ -178,9 +178,9 @@ namespace agg
178178 m_source->vertex (&ct2_x, &ct2_y);
179179 m_source->vertex (&end_x, &end_y);
180180
181- m_curve4.init (m_last_x, m_last_y,
182- *x, *y,
183- ct2_x, ct2_y,
181+ m_curve4.init (m_last_x, m_last_y,
182+ *x, *y,
183+ ct2_x, ct2_y,
184184 end_x, end_y);
185185
186186 m_curve4.vertex (x, y); // First call returns path_cmd_move_to
0 commit comments