OLD | NEW |
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 SkIntersections_DEFINE | 7 #ifndef SkIntersections_DEFINE |
8 #define SkIntersections_DEFINE | 8 #define SkIntersections_DEFINE |
9 | 9 |
10 #include "SkPathOpsConic.h" | 10 #include "SkPathOpsConic.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 int cubicLine(const SkPoint a[4], const SkPoint b[2]) { | 97 int cubicLine(const SkPoint a[4], const SkPoint b[2]) { |
98 SkDCubic cubic; | 98 SkDCubic cubic; |
99 cubic.set(a); | 99 cubic.set(a); |
100 SkDLine line; | 100 SkDLine line; |
101 line.set(b); | 101 line.set(b); |
102 fMax = 3; | 102 fMax = 3; |
103 return intersect(cubic, line); | 103 return intersect(cubic, line); |
104 } | 104 } |
105 | 105 |
106 #ifdef SK_DEBUG | 106 #ifdef SK_DEBUG |
107 SkOpGlobalState* debugGlobalState() { return fDebugGlobalState; } | 107 SkOpGlobalState* globalState() const { return fDebugGlobalState; } |
108 #endif | 108 #endif |
109 | 109 |
110 bool hasT(double t) const { | 110 bool hasT(double t) const { |
111 SkASSERT(t == 0 || t == 1); | 111 SkASSERT(t == 0 || t == 1); |
112 return fUsed > 0 && (t == 0 ? fT[0][0] == 0 : fT[0][fUsed - 1] == 1); | 112 return fUsed > 0 && (t == 0 ? fT[0][0] == 0 : fT[0][fUsed - 1] == 1); |
113 } | 113 } |
114 | 114 |
115 bool hasOppT(double t) const { | 115 bool hasOppT(double t) const { |
116 SkASSERT(t == 0 || t == 1); | 116 SkASSERT(t == 0 || t == 1); |
117 return fUsed > 0 && (fT[1][0] == t || fT[1][fUsed - 1] == t); | 117 return fUsed > 0 && (fT[1][0] == t || fT[1][fUsed - 1] == t); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void debugResetLoopCount(); | 301 void debugResetLoopCount(); |
302 void dump() const; // implemented for testing only | 302 void dump() const; // implemented for testing only |
303 | 303 |
304 private: | 304 private: |
305 bool cubicCheckCoincidence(const SkDCubic& c1, const SkDCubic& c2); | 305 bool cubicCheckCoincidence(const SkDCubic& c1, const SkDCubic& c2); |
306 bool cubicExactEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic
2); | 306 bool cubicExactEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic
2); |
307 void cubicNearEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic2
, const SkDRect& ); | 307 void cubicNearEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic2
, const SkDRect& ); |
308 void cleanUpParallelLines(bool parallel); | 308 void cleanUpParallelLines(bool parallel); |
309 void computePoints(const SkDLine& line, int used); | 309 void computePoints(const SkDLine& line, int used); |
310 | 310 |
311 SkDPoint fPt[12]; // FIXME: since scans store points as SkPoint, this shoul
d also | 311 SkDPoint fPt[13]; // FIXME: since scans store points as SkPoint, this shoul
d also |
312 SkDPoint fPt2[2]; // used by nearly same to store alternate intersection po
int | 312 SkDPoint fPt2[2]; // used by nearly same to store alternate intersection po
int |
313 double fT[2][12]; | 313 double fT[2][13]; |
314 uint16_t fIsCoincident[2]; // bit set for each curve's coincident T | 314 uint16_t fIsCoincident[2]; // bit set for each curve's coincident T |
315 bool fNearlySame[2]; // true if end points nearly match | 315 bool fNearlySame[2]; // true if end points nearly match |
316 unsigned char fUsed; | 316 unsigned char fUsed; |
317 unsigned char fMax; | 317 unsigned char fMax; |
318 bool fAllowNear; | 318 bool fAllowNear; |
319 bool fSwap; | 319 bool fSwap; |
320 #ifdef SK_DEBUG | 320 #ifdef SK_DEBUG |
321 SkOpGlobalState* fDebugGlobalState; | 321 SkOpGlobalState* fDebugGlobalState; |
322 int fDepth; | 322 int fDepth; |
323 #endif | 323 #endif |
324 #if DEBUG_T_SECT_LOOP_COUNT | 324 #if DEBUG_T_SECT_LOOP_COUNT |
325 int fDebugLoopCount[3]; | 325 int fDebugLoopCount[3]; |
326 #endif | 326 #endif |
327 }; | 327 }; |
328 | 328 |
329 #endif | 329 #endif |
OLD | NEW |