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

Side by Side Diff: src/pathops/SkDCubicLineIntersection.cpp

Issue 265453009: remove inverse_paths from ignored tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: experiment with 128 bit floats Created 6 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 | « gyp/pathops_unittest.gyp ('k') | src/pathops/SkPathOpsCubic.h » ('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 #include "SkIntersections.h" 7 #include "SkIntersections.h"
8 #include "SkPathOpsCubic.h" 8 #include "SkPathOpsCubic.h"
9 #include "SkPathOpsLine.h" 9 #include "SkPathOpsLine.h"
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 } 140 }
141 fIntersections->insert(cubicT, lineT, pt); 141 fIntersections->insert(cubicT, lineT, pt);
142 skipInsert: 142 skipInsert:
143 ; 143 ;
144 } 144 }
145 } 145 }
146 return fIntersections->used(); 146 return fIntersections->used();
147 } 147 }
148 148
149 int horizontalIntersect(double axisIntercept, double roots[3]) { 149 int horizontalIntersect(double axisIntercept, double validRoots[3]) {
150 double A, B, C, D; 150 double A, B, C, D;
151 SkDCubic::Coefficients(&fCubic[0].fY, &A, &B, &C, &D); 151 SkDCubic::Coefficients(&fCubic[0].fY, &A, &B, &C, &D);
152 D -= axisIntercept; 152 D -= axisIntercept;
153 return SkDCubic::RootsValidT(A, B, C, D, roots); 153 int realCount;
154 double allRoots[3];
155 int validCount = SkDCubic::RootsValidT(A, B, C, D, allRoots, &realCount, validRoots);
156 if (validCount >= 0) {
157 return validCount;
158 }
159 SkDPoint calcPt = fCubic.ptAtT(validRoots[0]);
160 if (approximately_equal(calcPt.fY, axisIntercept)) {
161 return 1;
162 }
163 fCubic.searchRoots(allRoots, realCount, &validRoots[0], axisIntercept, f alse);
164 return 1;
154 } 165 }
155 166
156 int horizontalIntersect(double axisIntercept, double left, double right, boo l flipped) { 167 int horizontalIntersect(double axisIntercept, double left, double right, boo l flipped) {
157 addExactHorizontalEndPoints(left, right, axisIntercept); 168 addExactHorizontalEndPoints(left, right, axisIntercept);
158 if (fAllowNear) { 169 if (fAllowNear) {
159 addNearHorizontalEndPoints(left, right, axisIntercept); 170 addNearHorizontalEndPoints(left, right, axisIntercept);
160 } 171 }
161 double rootVals[3]; 172 double rootVals[3];
162 int roots = horizontalIntersect(axisIntercept, rootVals); 173 int roots = horizontalIntersect(axisIntercept, rootVals);
163 for (int index = 0; index < roots; ++index) { 174 for (int index = 0; index < roots; ++index) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 367 }
357 368
358 int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) { 369 int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) {
359 LineCubicIntersections c(cubic, line, this); 370 LineCubicIntersections c(cubic, line, this);
360 fUsed = c.intersectRay(fT[0]); 371 fUsed = c.intersectRay(fT[0]);
361 for (int index = 0; index < fUsed; ++index) { 372 for (int index = 0; index < fUsed; ++index) {
362 fPt[index] = cubic.ptAtT(fT[0][index]); 373 fPt[index] = cubic.ptAtT(fT[0][index]);
363 } 374 }
364 return fUsed; 375 return fUsed;
365 } 376 }
OLDNEW
« no previous file with comments | « gyp/pathops_unittest.gyp ('k') | src/pathops/SkPathOpsCubic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698