Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: core/src/fxge/agg/agg23/agg_curves.h

Issue 402463002: Replace agg with skia (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix clang compile error Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/agg/agg23/agg_conv_stroke.h ('k') | core/src/fxge/agg/agg23/agg_math.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 //----------------------------------------------------------------------------
3 // Anti-Grain Geometry - Version 2.3
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5 // Copyright (C) 2005 Tony Juricic (tonygeek@yahoo.com)
6 //
7 // Permission to copy, use, modify, sell and distribute this software
8 // is granted provided this copyright notice appears in all copies.
9 // This software is provided "as is" without express or implied
10 // warranty, and with no claim as to its suitability for any purpose.
11 //
12 //----------------------------------------------------------------------------
13 // Contact: mcseem@antigrain.com
14 // mcseemagg@yahoo.com
15 // http://www.antigrain.com
16 //----------------------------------------------------------------------------
17 #ifndef AGG_CURVES_INCLUDED
18 #define AGG_CURVES_INCLUDED
19 #include "agg_array.h"
20 namespace agg
21 {
22 struct curve4_points : public CFX_Object {
23 FX_FLOAT cp[8];
24 curve4_points() {}
25 curve4_points(FX_FLOAT x1, FX_FLOAT y1,
26 FX_FLOAT x2, FX_FLOAT y2,
27 FX_FLOAT x3, FX_FLOAT y3,
28 FX_FLOAT x4, FX_FLOAT y4)
29 {
30 cp[0] = x1;
31 cp[1] = y1;
32 cp[2] = x2;
33 cp[3] = y2;
34 cp[4] = x3;
35 cp[5] = y3;
36 cp[6] = x4;
37 cp[7] = y4;
38 }
39 void init(FX_FLOAT x1, FX_FLOAT y1,
40 FX_FLOAT x2, FX_FLOAT y2,
41 FX_FLOAT x3, FX_FLOAT y3,
42 FX_FLOAT x4, FX_FLOAT y4)
43 {
44 cp[0] = x1;
45 cp[1] = y1;
46 cp[2] = x2;
47 cp[3] = y2;
48 cp[4] = x3;
49 cp[5] = y3;
50 cp[6] = x4;
51 cp[7] = y4;
52 }
53 FX_FLOAT operator [] (unsigned i) const
54 {
55 return cp[i];
56 }
57 FX_FLOAT& operator [] (unsigned i)
58 {
59 return cp[i];
60 }
61 };
62 class curve4_div : public CFX_Object
63 {
64 public:
65 curve4_div() :
66 m_cusp_limit(0),
67 m_count(0)
68 {}
69 curve4_div(FX_FLOAT x1, FX_FLOAT y1,
70 FX_FLOAT x2, FX_FLOAT y2,
71 FX_FLOAT x3, FX_FLOAT y3,
72 FX_FLOAT x4, FX_FLOAT y4) :
73 m_cusp_limit(0),
74 m_count(0)
75 {
76 init(x1, y1, x2, y2, x3, y3, x4, y4);
77 }
78 curve4_div(const curve4_points& cp) :
79 m_count(0)
80 {
81 init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
82 }
83 void reset()
84 {
85 m_points.remove_all();
86 m_count = 0;
87 }
88 void init(FX_FLOAT x1, FX_FLOAT y1,
89 FX_FLOAT x2, FX_FLOAT y2,
90 FX_FLOAT x3, FX_FLOAT y3,
91 FX_FLOAT x4, FX_FLOAT y4);
92 void init(const curve4_points& cp)
93 {
94 init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
95 }
96 void rewind(unsigned)
97 {
98 m_count = 0;
99 }
100 unsigned vertex(FX_FLOAT* x, FX_FLOAT* y)
101 {
102 if(m_count >= m_points.size()) {
103 return path_cmd_stop;
104 }
105 const point_type& p = m_points[m_count++];
106 *x = p.x;
107 *y = p.y;
108 return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to;
109 }
110 unsigned vertex_flag(FX_FLOAT* x, FX_FLOAT* y, int& flag)
111 {
112 if(m_count >= m_points.size()) {
113 return path_cmd_stop;
114 }
115 const point_type& p = m_points[m_count++];
116 *x = p.x;
117 *y = p.y;
118 flag = p.flag;
119 return (m_count == 1) ? path_cmd_move_to : path_cmd_line_to;
120 }
121 int count()
122 {
123 return m_points.size();
124 }
125 private:
126 void bezier(FX_FLOAT x1, FX_FLOAT y1,
127 FX_FLOAT x2, FX_FLOAT y2,
128 FX_FLOAT x3, FX_FLOAT y3,
129 FX_FLOAT x4, FX_FLOAT y4);
130 void recursive_bezier(FX_FLOAT x1, FX_FLOAT y1,
131 FX_FLOAT x2, FX_FLOAT y2,
132 FX_FLOAT x3, FX_FLOAT y3,
133 FX_FLOAT x4, FX_FLOAT y4,
134 unsigned level);
135 FX_FLOAT m_distance_tolerance_square;
136 FX_FLOAT m_distance_tolerance_manhattan;
137 FX_FLOAT m_cusp_limit;
138 unsigned m_count;
139 pod_deque<point_type> m_points;
140 };
141 class curve4 : public CFX_Object
142 {
143 public:
144 curve4() {}
145 curve4(FX_FLOAT x1, FX_FLOAT y1,
146 FX_FLOAT x2, FX_FLOAT y2,
147 FX_FLOAT x3, FX_FLOAT y3,
148 FX_FLOAT x4, FX_FLOAT y4)
149 {
150 init(x1, y1, x2, y2, x3, y3, x4, y4);
151 }
152 curve4(const curve4_points& cp)
153 {
154 init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
155 }
156 void reset()
157 {
158 m_curve_div.reset();
159 }
160 void init(FX_FLOAT x1, FX_FLOAT y1,
161 FX_FLOAT x2, FX_FLOAT y2,
162 FX_FLOAT x3, FX_FLOAT y3,
163 FX_FLOAT x4, FX_FLOAT y4)
164 {
165 m_curve_div.init(x1, y1, x2, y2, x3, y3, x4, y4);
166 }
167 void init(const curve4_points& cp)
168 {
169 init(cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
170 }
171 void rewind(unsigned path_id)
172 {
173 m_curve_div.rewind(path_id);
174 }
175 unsigned vertex(FX_FLOAT* x, FX_FLOAT* y)
176 {
177 return m_curve_div.vertex(x, y);
178 }
179 unsigned vertex_curve_flag(FX_FLOAT* x, FX_FLOAT* y, int& flag)
180 {
181 return m_curve_div.vertex_flag(x, y, flag);
182 }
183 int count()
184 {
185 return m_curve_div.count();
186 }
187 private:
188 curve4_div m_curve_div;
189 };
190 }
191 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/agg/agg23/agg_conv_stroke.h ('k') | core/src/fxge/agg/agg23/agg_math.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698