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

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

Issue 1113963002: use pathops utils to improve precision of cubic chopping in scan converter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use LineCubicIntersect utility for more robustness 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/SkDCubicLineIntersection.cpp ('k') | no next file » | 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 7
8 #ifndef SkPathOpsCubic_DEFINED 8 #ifndef SkPathOpsCubic_DEFINED
9 #define SkPathOpsCubic_DEFINED 9 #define SkPathOpsCubic_DEFINED
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool monotonicInX() const; 90 bool monotonicInX() const;
91 bool monotonicInY() const; 91 bool monotonicInY() const;
92 void otherPts(int index, const SkDPoint* o1Pts[kPointCount - 1]) const; 92 void otherPts(int index, const SkDPoint* o1Pts[kPointCount - 1]) const;
93 SkDPoint ptAtT(double t) const; 93 SkDPoint ptAtT(double t) const;
94 static int RootsReal(double A, double B, double C, double D, double t[3]); 94 static int RootsReal(double A, double B, double C, double D, double t[3]);
95 static int RootsValidT(const double A, const double B, const double C, doubl e D, double s[3]); 95 static int RootsValidT(const double A, const double B, const double C, doubl e D, double s[3]);
96 96
97 int searchRoots(double extremes[6], int extrema, double axisIntercept, 97 int searchRoots(double extremes[6], int extrema, double axisIntercept,
98 SearchAxis xAxis, double* validRoots) const; 98 SearchAxis xAxis, double* validRoots) const;
99 99
100 /**
101 * Return the number of valid roots (0 < root < 1) for this cubic intersect ing the
102 * specified horizontal line.
103 */
104 int horizontalIntersect(double yIntercept, double roots[3]) const;
105 /**
106 * Return the number of valid roots (0 < root < 1) for this cubic intersect ing the
107 * specified vertical line.
108 */
109 int verticalIntersect(double xIntercept, double roots[3]) const;
110
100 const SkDCubic& set(const SkPoint pts[kPointCount]) { 111 const SkDCubic& set(const SkPoint pts[kPointCount]) {
101 fPts[0] = pts[0]; 112 fPts[0] = pts[0];
102 fPts[1] = pts[1]; 113 fPts[1] = pts[1];
103 fPts[2] = pts[2]; 114 fPts[2] = pts[2];
104 fPts[3] = pts[3]; 115 fPts[3] = pts[3];
105 return *this; 116 return *this;
106 } 117 }
107 118
108 SkDCubic subDivide(double t1, double t2) const; 119 SkDCubic subDivide(double t1, double t2) const;
109 120
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3) 152 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3)
142 given that: 153 given that:
143 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0) 154 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0)
144 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3 -> (1, 0) 155 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3 -> (1, 0)
145 */ 156 */
146 inline int other_two(int one, int two) { 157 inline int other_two(int one, int two) {
147 return 1 >> (3 - (one ^ two)) ^ 3; 158 return 1 >> (3 - (one ^ two)) ^ 3;
148 } 159 }
149 160
150 #endif 161 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkDCubicLineIntersection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698