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

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

Issue 1111333002: compute initial winding from projected rays (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add missing test reference Created 5 years, 7 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/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsCurve.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"
11 #include "SkPathOpsCubic.h"
12 #include "SkPathOpsLine.h"
13 #include "SkPathOpsQuad.h"
14 11
15 #ifndef SK_RELEASE 12 #ifndef SK_RELEASE
16 #include "SkPath.h" 13 #include "SkPath.h"
17 #endif 14 #endif
18 15
19 struct SkPathOpsBounds; 16 struct SkPathOpsBounds;
20 17
21 struct SkOpCurve { 18 struct SkOpCurve {
22 SkPoint fPts[4]; 19 SkPoint fPts[4];
23 SkScalar fWeight; 20 SkScalar fWeight;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 double s, double e, double* topT); 68 double s, double e, double* topT);
72 SkDPoint cubicTop(const SkPoint curve[4], SkScalar , double s, double e, dou ble* topT); 69 SkDPoint cubicTop(const SkPoint curve[4], SkScalar , double s, double e, dou ble* topT);
73 void dumpID(int ) const; 70 void dumpID(int ) const;
74 SkDPoint lineTop(const SkPoint[2], SkScalar , double , double , double* topT ); 71 SkDPoint lineTop(const SkPoint[2], SkScalar , double , double , double* topT );
75 SkDPoint quadTop(const SkPoint curve[3], SkScalar , double s, double e, doub le* topT); 72 SkDPoint quadTop(const SkPoint curve[3], SkScalar , double s, double e, doub le* topT);
76 73
77 void setConicBounds(const SkPoint curve[3], SkScalar curveWeight, 74 void setConicBounds(const SkPoint curve[3], SkScalar curveWeight,
78 double s, double e, SkPathOpsBounds* ); 75 double s, double e, SkPathOpsBounds* );
79 void setCubicBounds(const SkPoint curve[4], SkScalar , 76 void setCubicBounds(const SkPoint curve[4], SkScalar ,
80 double s, double e, SkPathOpsBounds* ); 77 double s, double e, SkPathOpsBounds* );
81 void setLineBounds(const SkPoint[2], SkScalar , double , double , SkPathOpsB ounds* );
82 void setQuadBounds(const SkPoint curve[3], SkScalar , 78 void setQuadBounds(const SkPoint curve[3], SkScalar ,
83 double s, double e, SkPathOpsBounds*); 79 double s, double e, SkPathOpsBounds*);
84 }; 80 };
85 81
86 82
87 extern void (SkDCurve::* const SetBounds[])(const SkPoint curve[], SkScalar cWei ght,
88 double tStart, double tEnd, SkPathOpsBounds* );
89
90 extern SkDPoint (SkDCurve::* const Top[])(const SkPoint curve[], SkScalar cWeigh t, 83 extern SkDPoint (SkDCurve::* const Top[])(const SkPoint curve[], SkScalar cWeigh t,
91 double tStart, double tEnd, double* topT); 84 double tStart, double tEnd, double* topT);
92 85
93 static SkDPoint dline_xy_at_t(const SkPoint a[2], SkScalar , double t) { 86 static SkDPoint dline_xy_at_t(const SkPoint a[2], SkScalar , double t) {
94 SkDLine line; 87 SkDLine line;
95 line.set(a); 88 line.set(a);
96 return line.ptAtT(t); 89 return line.ptAtT(t);
97 } 90 }
98 91
99 static SkDPoint dquad_xy_at_t(const SkPoint a[3], SkScalar , double t) { 92 static SkDPoint dquad_xy_at_t(const SkPoint a[3], SkScalar , double t) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 262
270 static void (* const CurveIntersectRay[])(const SkPoint[] , SkScalar , const SkD Line& , 263 static void (* const CurveIntersectRay[])(const SkPoint[] , SkScalar , const SkD Line& ,
271 SkIntersections* ) = { 264 SkIntersections* ) = {
272 NULL, 265 NULL,
273 line_intersect_ray, 266 line_intersect_ray,
274 quad_intersect_ray, 267 quad_intersect_ray,
275 conic_intersect_ray, 268 conic_intersect_ray,
276 cubic_intersect_ray 269 cubic_intersect_ray
277 }; 270 };
278 271
272 static int line_intercept_h(const SkPoint a[2], SkScalar , SkScalar y, double* r oots) {
273 SkDLine line;
274 roots[0] = SkIntersections::HorizontalIntercept(line.set(a), y);
275 return between(0, roots[0], 1);
276 }
277
278 static int line_intercept_v(const SkPoint a[2], SkScalar , SkScalar x, double* r oots) {
279 SkDLine line;
280 roots[0] = SkIntersections::VerticalIntercept(line.set(a), x);
281 return between(0, roots[0], 1);
282 }
283
284 static int quad_intercept_h(const SkPoint a[2], SkScalar , SkScalar y, double* r oots) {
285 SkDQuad quad;
286 return SkIntersections::HorizontalIntercept(quad.set(a), y, roots);
287 }
288
289 static int quad_intercept_v(const SkPoint a[2], SkScalar , SkScalar x, double* r oots) {
290 SkDQuad quad;
291 return SkIntersections::VerticalIntercept(quad.set(a), x, roots);
292 }
293
294 static int conic_intercept_h(const SkPoint a[2], SkScalar w, SkScalar y, double* roots) {
295 SkDConic conic;
296 return SkIntersections::HorizontalIntercept(conic.set(a, w), y, roots);
297 }
298
299 static int conic_intercept_v(const SkPoint a[2], SkScalar w, SkScalar x, double* roots) {
300 SkDConic conic;
301 return SkIntersections::VerticalIntercept(conic.set(a, w), x, roots);
302 }
303
304 static int cubic_intercept_h(const SkPoint a[3], SkScalar , SkScalar y, double* roots) {
305 SkDCubic cubic;
306 return cubic.set(a).horizontalIntersect(y, roots);
307 }
308
309 static int cubic_intercept_v(const SkPoint a[3], SkScalar , SkScalar x, double* roots) {
310 SkDCubic cubic;
311 return cubic.set(a).verticalIntersect(x, roots);
312 }
313
314 static int (* const CurveIntercept[])(const SkPoint[] , SkScalar , SkScalar , do uble* ) = {
315 NULL,
316 NULL,
317 line_intercept_h,
318 line_intercept_v,
319 quad_intercept_h,
320 quad_intercept_v,
321 conic_intercept_h,
322 conic_intercept_v,
323 cubic_intercept_h,
324 cubic_intercept_v,
325 };
326
279 #endif 327 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsCurve.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698