caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkOpSpan_DEFINED |
| 8 | #define SkOpSpan_DEFINED |
| 9 | |
| 10 | #include "SkPoint.h" |
| 11 | |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 12 | class SkOpAngle; |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 13 | class SkOpSegment; |
| 14 | |
| 15 | struct SkOpSpan { |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 16 | SkPoint fPt; // computed when the curves are intersected |
| 17 | double fT; |
| 18 | double fOtherT; // value at fOther[fOtherIndex].fT |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 19 | SkOpSegment* fOther; |
| 20 | SkOpAngle* fFromAngle; // (if t > 0) index into segment's angle array going negative in t |
| 21 | SkOpAngle* fToAngle; // (if t < 1) index into segment's angle array going positive in t |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 22 | int fOtherIndex; // can't be used during intersection |
| 23 | int fWindSum; // accumulated from contours surrounding this one. |
| 24 | int fOppSum; // for binary operators: the opposite winding sum |
| 25 | int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident |
| 26 | int fOppValue; // normally 0 -- when binary coincident edges combine, opp value goes here |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 27 | bool fChased; // set after span has been added to chase array |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 28 | bool fCoincident; // set if span is bumped -- if set additional points aren't inserted |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 29 | bool fDone; // if set, this span to next higher T has been processed |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 30 | bool fLoop; // set when a cubic loops back to this point |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 31 | bool fMultiple; // set if this is one of mutiple spans with identical t and pt values |
| 32 | bool fNear; // set if opposite end point is near but not equal to this one |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 33 | bool fSmall; // if set, consecutive points are almost equal |
| 34 | bool fTiny; // if set, consecutive points are equal but consecutive ts are not precisely equal |
caryclark@google.com | 570863f | 2013-09-16 15:55:01 +0000 | [diff] [blame] | 35 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 36 | // available to testing only |
| 37 | const SkOpSegment* debugToSegment(ptrdiff_t* ) const; |
caryclark@google.com | 570863f | 2013-09-16 15:55:01 +0000 | [diff] [blame] | 38 | void dump() const; |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 39 | void dumpOne() const; |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | #endif |