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

Side by Side Diff: src/pathops/SkPathOpsCurve.h

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « src/pathops/SkPathOpsCommon.cpp ('k') | src/pathops/SkPathOpsDebug.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #ifndef SkPathOpsCurve_DEFINE 7 #ifndef SkPathOpsCurve_DEFINE
8 #define SkPathOpsCurve_DEFINE 8 #define SkPathOpsCurve_DEFINE
9 9
10 #include "SkIntersections.h" 10 #include "SkIntersections.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return conic.ptAtT(t); 101 return conic.ptAtT(t);
102 } 102 }
103 103
104 static SkDPoint dcubic_xy_at_t(const SkPoint a[4], SkScalar , double t) { 104 static SkDPoint dcubic_xy_at_t(const SkPoint a[4], SkScalar , double t) {
105 SkDCubic cubic; 105 SkDCubic cubic;
106 cubic.set(a); 106 cubic.set(a);
107 return cubic.ptAtT(t); 107 return cubic.ptAtT(t);
108 } 108 }
109 109
110 static SkDPoint (* const CurveDPointAtT[])(const SkPoint[], SkScalar , double ) = { 110 static SkDPoint (* const CurveDPointAtT[])(const SkPoint[], SkScalar , double ) = {
111 NULL, 111 nullptr,
112 dline_xy_at_t, 112 dline_xy_at_t,
113 dquad_xy_at_t, 113 dquad_xy_at_t,
114 dconic_xy_at_t, 114 dconic_xy_at_t,
115 dcubic_xy_at_t 115 dcubic_xy_at_t
116 }; 116 };
117 117
118 static SkPoint fline_xy_at_t(const SkPoint a[2], SkScalar weight, double t) { 118 static SkPoint fline_xy_at_t(const SkPoint a[2], SkScalar weight, double t) {
119 return dline_xy_at_t(a, weight, t).asSkPoint(); 119 return dline_xy_at_t(a, weight, t).asSkPoint();
120 } 120 }
121 121
122 static SkPoint fquad_xy_at_t(const SkPoint a[3], SkScalar weight, double t) { 122 static SkPoint fquad_xy_at_t(const SkPoint a[3], SkScalar weight, double t) {
123 return dquad_xy_at_t(a, weight, t).asSkPoint(); 123 return dquad_xy_at_t(a, weight, t).asSkPoint();
124 } 124 }
125 125
126 static SkPoint fconic_xy_at_t(const SkPoint a[3], SkScalar weight, double t) { 126 static SkPoint fconic_xy_at_t(const SkPoint a[3], SkScalar weight, double t) {
127 return dconic_xy_at_t(a, weight, t).asSkPoint(); 127 return dconic_xy_at_t(a, weight, t).asSkPoint();
128 } 128 }
129 129
130 static SkPoint fcubic_xy_at_t(const SkPoint a[4], SkScalar weight, double t) { 130 static SkPoint fcubic_xy_at_t(const SkPoint a[4], SkScalar weight, double t) {
131 return dcubic_xy_at_t(a, weight, t).asSkPoint(); 131 return dcubic_xy_at_t(a, weight, t).asSkPoint();
132 } 132 }
133 133
134 static SkPoint (* const CurvePointAtT[])(const SkPoint[], SkScalar , double ) = { 134 static SkPoint (* const CurvePointAtT[])(const SkPoint[], SkScalar , double ) = {
135 NULL, 135 nullptr,
136 fline_xy_at_t, 136 fline_xy_at_t,
137 fquad_xy_at_t, 137 fquad_xy_at_t,
138 fconic_xy_at_t, 138 fconic_xy_at_t,
139 fcubic_xy_at_t 139 fcubic_xy_at_t
140 }; 140 };
141 141
142 static SkDVector dline_dxdy_at_t(const SkPoint a[2], SkScalar , double ) { 142 static SkDVector dline_dxdy_at_t(const SkPoint a[2], SkScalar , double ) {
143 SkDLine line; 143 SkDLine line;
144 line.set(a); 144 line.set(a);
145 return line[1] - line[0]; 145 return line[1] - line[0];
(...skipping 11 matching lines...) Expand all
157 return conic.dxdyAtT(t); 157 return conic.dxdyAtT(t);
158 } 158 }
159 159
160 static SkDVector dcubic_dxdy_at_t(const SkPoint a[4], SkScalar , double t) { 160 static SkDVector dcubic_dxdy_at_t(const SkPoint a[4], SkScalar , double t) {
161 SkDCubic cubic; 161 SkDCubic cubic;
162 cubic.set(a); 162 cubic.set(a);
163 return cubic.dxdyAtT(t); 163 return cubic.dxdyAtT(t);
164 } 164 }
165 165
166 static SkDVector (* const CurveDSlopeAtT[])(const SkPoint[], SkScalar , double ) = { 166 static SkDVector (* const CurveDSlopeAtT[])(const SkPoint[], SkScalar , double ) = {
167 NULL, 167 nullptr,
168 dline_dxdy_at_t, 168 dline_dxdy_at_t,
169 dquad_dxdy_at_t, 169 dquad_dxdy_at_t,
170 dconic_dxdy_at_t, 170 dconic_dxdy_at_t,
171 dcubic_dxdy_at_t 171 dcubic_dxdy_at_t
172 }; 172 };
173 173
174 static SkVector fline_dxdy_at_t(const SkPoint a[2], SkScalar , double ) { 174 static SkVector fline_dxdy_at_t(const SkPoint a[2], SkScalar , double ) {
175 return a[1] - a[0]; 175 return a[1] - a[0];
176 } 176 }
177 177
178 static SkVector fquad_dxdy_at_t(const SkPoint a[3], SkScalar weight, double t) { 178 static SkVector fquad_dxdy_at_t(const SkPoint a[3], SkScalar weight, double t) {
179 return dquad_dxdy_at_t(a, weight, t).asSkVector(); 179 return dquad_dxdy_at_t(a, weight, t).asSkVector();
180 } 180 }
181 181
182 static SkVector fconic_dxdy_at_t(const SkPoint a[3], SkScalar weight, double t) { 182 static SkVector fconic_dxdy_at_t(const SkPoint a[3], SkScalar weight, double t) {
183 return dconic_dxdy_at_t(a, weight, t).asSkVector(); 183 return dconic_dxdy_at_t(a, weight, t).asSkVector();
184 } 184 }
185 185
186 static SkVector fcubic_dxdy_at_t(const SkPoint a[4], SkScalar weight, double t) { 186 static SkVector fcubic_dxdy_at_t(const SkPoint a[4], SkScalar weight, double t) {
187 return dcubic_dxdy_at_t(a, weight, t).asSkVector(); 187 return dcubic_dxdy_at_t(a, weight, t).asSkVector();
188 } 188 }
189 189
190 static SkVector (* const CurveSlopeAtT[])(const SkPoint[], SkScalar , double ) = { 190 static SkVector (* const CurveSlopeAtT[])(const SkPoint[], SkScalar , double ) = {
191 NULL, 191 nullptr,
192 fline_dxdy_at_t, 192 fline_dxdy_at_t,
193 fquad_dxdy_at_t, 193 fquad_dxdy_at_t,
194 fconic_dxdy_at_t, 194 fconic_dxdy_at_t,
195 fcubic_dxdy_at_t 195 fcubic_dxdy_at_t
196 }; 196 };
197 197
198 static bool line_is_vertical(const SkPoint a[2], SkScalar , double startT, doubl e endT) { 198 static bool line_is_vertical(const SkPoint a[2], SkScalar , double startT, doubl e endT) {
199 SkDLine line; 199 SkDLine line;
200 line.set(a); 200 line.set(a);
201 SkDPoint dst[2] = { line.ptAtT(startT), line.ptAtT(endT) }; 201 SkDPoint dst[2] = { line.ptAtT(startT), line.ptAtT(endT) };
(...skipping 16 matching lines...) Expand all
218 218
219 static bool cubic_is_vertical(const SkPoint a[4], SkScalar , double startT, doub le endT) { 219 static bool cubic_is_vertical(const SkPoint a[4], SkScalar , double startT, doub le endT) {
220 SkDCubic cubic; 220 SkDCubic cubic;
221 cubic.set(a); 221 cubic.set(a);
222 SkDCubic dst = cubic.subDivide(startT, endT); 222 SkDCubic dst = cubic.subDivide(startT, endT);
223 return AlmostEqualUlps(dst[0].fX, dst[1].fX) && AlmostEqualUlps(dst[1].fX, d st[2].fX) 223 return AlmostEqualUlps(dst[0].fX, dst[1].fX) && AlmostEqualUlps(dst[1].fX, d st[2].fX)
224 && AlmostEqualUlps(dst[2].fX, dst[3].fX); 224 && AlmostEqualUlps(dst[2].fX, dst[3].fX);
225 } 225 }
226 226
227 static bool (* const CurveIsVertical[])(const SkPoint[], SkScalar , double , dou ble) = { 227 static bool (* const CurveIsVertical[])(const SkPoint[], SkScalar , double , dou ble) = {
228 NULL, 228 nullptr,
229 line_is_vertical, 229 line_is_vertical,
230 quad_is_vertical, 230 quad_is_vertical,
231 conic_is_vertical, 231 conic_is_vertical,
232 cubic_is_vertical 232 cubic_is_vertical
233 }; 233 };
234 234
235 static void line_intersect_ray(const SkPoint a[2], SkScalar , const SkDLine& ray , 235 static void line_intersect_ray(const SkPoint a[2], SkScalar , const SkDLine& ray ,
236 SkIntersections* i) { 236 SkIntersections* i) {
237 SkDLine line; 237 SkDLine line;
238 line.set(a); 238 line.set(a);
(...skipping 16 matching lines...) Expand all
255 255
256 static void cubic_intersect_ray(const SkPoint a[4], SkScalar , const SkDLine& ra y, 256 static void cubic_intersect_ray(const SkPoint a[4], SkScalar , const SkDLine& ra y,
257 SkIntersections* i) { 257 SkIntersections* i) {
258 SkDCubic cubic; 258 SkDCubic cubic;
259 cubic.set(a); 259 cubic.set(a);
260 i->intersectRay(cubic, ray); 260 i->intersectRay(cubic, ray);
261 } 261 }
262 262
263 static void (* const CurveIntersectRay[])(const SkPoint[] , SkScalar , const SkD Line& , 263 static void (* const CurveIntersectRay[])(const SkPoint[] , SkScalar , const SkD Line& ,
264 SkIntersections* ) = { 264 SkIntersections* ) = {
265 NULL, 265 nullptr,
266 line_intersect_ray, 266 line_intersect_ray,
267 quad_intersect_ray, 267 quad_intersect_ray,
268 conic_intersect_ray, 268 conic_intersect_ray,
269 cubic_intersect_ray 269 cubic_intersect_ray
270 }; 270 };
271 271
272 static int line_intercept_h(const SkPoint a[2], SkScalar , SkScalar y, double* r oots) { 272 static int line_intercept_h(const SkPoint a[2], SkScalar , SkScalar y, double* r oots) {
273 SkDLine line; 273 SkDLine line;
274 roots[0] = SkIntersections::HorizontalIntercept(line.set(a), y); 274 roots[0] = SkIntersections::HorizontalIntercept(line.set(a), y);
275 return between(0, roots[0], 1); 275 return between(0, roots[0], 1);
(...skipping 29 matching lines...) Expand all
305 SkDCubic cubic; 305 SkDCubic cubic;
306 return cubic.set(a).horizontalIntersect(y, roots); 306 return cubic.set(a).horizontalIntersect(y, roots);
307 } 307 }
308 308
309 static int cubic_intercept_v(const SkPoint a[3], SkScalar , SkScalar x, double* roots) { 309 static int cubic_intercept_v(const SkPoint a[3], SkScalar , SkScalar x, double* roots) {
310 SkDCubic cubic; 310 SkDCubic cubic;
311 return cubic.set(a).verticalIntersect(x, roots); 311 return cubic.set(a).verticalIntersect(x, roots);
312 } 312 }
313 313
314 static int (* const CurveIntercept[])(const SkPoint[] , SkScalar , SkScalar , do uble* ) = { 314 static int (* const CurveIntercept[])(const SkPoint[] , SkScalar , SkScalar , do uble* ) = {
315 NULL, 315 nullptr,
316 NULL, 316 nullptr,
317 line_intercept_h, 317 line_intercept_h,
318 line_intercept_v, 318 line_intercept_v,
319 quad_intercept_h, 319 quad_intercept_h,
320 quad_intercept_v, 320 quad_intercept_v,
321 conic_intercept_h, 321 conic_intercept_h,
322 conic_intercept_v, 322 conic_intercept_v,
323 cubic_intercept_h, 323 cubic_intercept_h,
324 cubic_intercept_v, 324 cubic_intercept_v,
325 }; 325 };
326 326
327 #endif 327 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCommon.cpp ('k') | src/pathops/SkPathOpsDebug.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698