2
2
// Anti-Grain Geometry - Version 2.4
3
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
4
4
//
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.
7
7
// This software is provided "as is" without express or implied
8
8
// warranty, and with no claim as to its suitability for any purpose.
9
9
//
@@ -28,31 +28,31 @@ namespace agg
28
28
29
29
30
30
// ---------------------------------------------------------------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
33
33
// and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control
34
34
// 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.
41
41
//
42
42
// Initially, path storages are not suppose to keep all the vertices of the
43
43
// curves (although, nothing prevents us from doing so). Instead, path_storage
44
44
// 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.
50
50
//
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.
53
53
// -----------------------------------------------------------------------
54
- template <class VertexSource ,
55
- class Curve3 =curve3,
54
+ template <class VertexSource ,
55
+ class Curve3 =curve3,
56
56
class Curve4 =curve4> class conv_curve
57
57
{
58
58
public:
@@ -64,51 +64,51 @@ namespace agg
64
64
m_source(&source), m_last_x(0.0 ), m_last_y(0.0 ) {}
65
65
void attach (VertexSource& source) { m_source = &source; }
66
66
67
- void approximation_method (curve_approximation_method_e v)
68
- {
67
+ void approximation_method (curve_approximation_method_e v)
68
+ {
69
69
m_curve3.approximation_method (v);
70
70
m_curve4.approximation_method (v);
71
71
}
72
72
73
- curve_approximation_method_e approximation_method () const
74
- {
73
+ curve_approximation_method_e approximation_method () const
74
+ {
75
75
return m_curve4.approximation_method ();
76
76
}
77
77
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);
82
82
}
83
83
84
- double approximation_scale () const
85
- {
86
- return m_curve4.approximation_scale ();
84
+ double approximation_scale () const
85
+ {
86
+ return m_curve4.approximation_scale ();
87
87
}
88
88
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);
93
93
}
94
94
95
- double angle_tolerance () const
96
- {
97
- return m_curve4.angle_tolerance ();
95
+ double angle_tolerance () const
96
+ {
97
+ return m_curve4.angle_tolerance ();
98
98
}
99
99
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);
104
104
}
105
105
106
- double cusp_limit () const
107
- {
108
- return m_curve4.cusp_limit ();
106
+ double cusp_limit () const
107
+ {
108
+ return m_curve4.cusp_limit ();
109
109
}
110
110
111
- void rewind (unsigned path_id);
111
+ void rewind (unsigned path_id);
112
112
unsigned vertex (double * x, double * y);
113
113
114
114
private:
@@ -154,19 +154,19 @@ namespace agg
154
154
return path_cmd_line_to;
155
155
}
156
156
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 ;
161
161
162
162
unsigned cmd = m_source->vertex (x, y);
163
163
switch (cmd)
164
164
{
165
165
case path_cmd_curve3:
166
166
m_source->vertex (&end_x, &end_y);
167
167
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,
170
170
end_x, end_y);
171
171
172
172
m_curve3.vertex (x, y); // First call returns path_cmd_move_to
@@ -178,9 +178,9 @@ namespace agg
178
178
m_source->vertex (&ct2_x, &ct2_y);
179
179
m_source->vertex (&end_x, &end_y);
180
180
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,
184
184
end_x, end_y);
185
185
186
186
m_curve4.vertex (x, y); // First call returns path_cmd_move_to
0 commit comments