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

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

Issue 13934009: path ops -- use standard max, min, double-is-nan (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkDLineIntersection.cpp ('k') | src/pathops/SkPathOpsBounds.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 // Another approach is to start with the implicit form of one curve and solve 1 // Another approach is to start with the implicit form of one curve and solve
2 // (seek implicit coefficients in QuadraticParameter.cpp 2 // (seek implicit coefficients in QuadraticParameter.cpp
3 // by substituting in the parametric form of the other. 3 // by substituting in the parametric form of the other.
4 // The downside of this approach is that early rejects are difficult to come by. 4 // The downside of this approach is that early rejects are difficult to come by.
5 // http://planetmath.org/encyclopedia/GaloisTheoreticDerivationOfTheQuarticFormu la.html#step 5 // http://planetmath.org/encyclopedia/GaloisTheoreticDerivationOfTheQuarticFormu la.html#step
6 6
7 7
8 #include "SkDQuadImplicit.h" 8 #include "SkDQuadImplicit.h"
9 #include "SkIntersections.h" 9 #include "SkIntersections.h"
10 #include "SkPathOpsLine.h" 10 #include "SkPathOpsLine.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return false; 236 return false;
237 } 237 }
238 return is_linear_inner(q1, 0, 1, q2, 0, 1, i, NULL); 238 return is_linear_inner(q1, 0, 1, q2, 0, 1, i, NULL);
239 } 239 }
240 240
241 // FIXME: if flat measure is sufficiently large, then probably the quartic solut ion failed 241 // FIXME: if flat measure is sufficiently large, then probably the quartic solut ion failed
242 static void relaxed_is_linear(const SkDQuad& q1, const SkDQuad& q2, SkIntersecti ons* i) { 242 static void relaxed_is_linear(const SkDQuad& q1, const SkDQuad& q2, SkIntersecti ons* i) {
243 double m1 = flat_measure(q1); 243 double m1 = flat_measure(q1);
244 double m2 = flat_measure(q2); 244 double m2 = flat_measure(q2);
245 #if DEBUG_FLAT_QUADS 245 #if DEBUG_FLAT_QUADS
246 double min = SkTMin<double>(m1, m2); 246 double min = SkTMin(m1, m2);
247 if (min > 5) { 247 if (min > 5) {
248 SkDebugf("%s maybe not flat enough.. %1.9g\n", __FUNCTION__, min); 248 SkDebugf("%s maybe not flat enough.. %1.9g\n", __FUNCTION__, min);
249 } 249 }
250 #endif 250 #endif
251 i->reset(); 251 i->reset();
252 const SkDQuad& rounder = m2 < m1 ? q1 : q2; 252 const SkDQuad& rounder = m2 < m1 ? q1 : q2;
253 const SkDQuad& flatter = m2 < m1 ? q2 : q1; 253 const SkDQuad& flatter = m2 < m1 ? q2 : q1;
254 bool subDivide = false; 254 bool subDivide = false;
255 is_linear_inner(flatter, 0, 1, rounder, 0, 1, i, &subDivide); 255 is_linear_inner(flatter, 0, 1, rounder, 0, 1, i, &subDivide);
256 if (subDivide) { 256 if (subDivide) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 if (lowestIndex < 0) { 490 if (lowestIndex < 0) {
491 break; 491 break;
492 } 492 }
493 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], 493 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]],
494 pts1[lowestIndex]); 494 pts1[lowestIndex]);
495 closest[lowestIndex] = -1; 495 closest[lowestIndex] = -1;
496 } while (++used < r1Count); 496 } while (++used < r1Count);
497 return fUsed; 497 return fUsed;
498 } 498 }
OLDNEW
« no previous file with comments | « src/pathops/SkDLineIntersection.cpp ('k') | src/pathops/SkPathOpsBounds.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698