blob: d9ce44eb7720fb4fb4cd78521b1ec750f15b9358 [file] [log] [blame]
caryclark@google.com07393ca2013-04-08 11:47:37 +00001/*
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
caryclarkdac1d172014-06-17 05:15:38 -070012class SkOpAngle;
caryclark@google.com07393ca2013-04-08 11:47:37 +000013class SkOpSegment;
14
15struct SkOpSpan {
caryclark@google.com07393ca2013-04-08 11:47:37 +000016 SkPoint fPt; // computed when the curves are intersected
17 double fT;
18 double fOtherT; // value at fOther[fOtherIndex].fT
caryclarkdac1d172014-06-17 05:15:38 -070019 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.com07393ca2013-04-08 11:47:37 +000022 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.org4431e772014-04-14 17:08:59 +000027 bool fChased; // set after span has been added to chase array
caryclarkdac1d172014-06-17 05:15:38 -070028 bool fCoincident; // set if span is bumped -- if set additional points aren't inserted
caryclark@google.com07393ca2013-04-08 11:47:37 +000029 bool fDone; // if set, this span to next higher T has been processed
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000030 bool fLoop; // set when a cubic loops back to this point
caryclarkdac1d172014-06-17 05:15:38 -070031 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.org4431e772014-04-14 17:08:59 +000033 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.com570863f2013-09-16 15:55:01 +000035
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000036 // available to testing only
37 const SkOpSegment* debugToSegment(ptrdiff_t* ) const;
caryclark@google.com570863f2013-09-16 15:55:01 +000038 void dump() const;
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000039 void dumpOne() const;
caryclark@google.com07393ca2013-04-08 11:47:37 +000040};
41
42#endif