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

Side by Side Diff: src/pathops/SkOpSegment.h

Issue 14865019: path ops work in progress (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkOpAngle.cpp ('k') | src/pathops/SkOpSegment.cpp » ('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 #ifndef SkOpSegment_DEFINE 7 #ifndef SkOpSegment_DEFINE
8 #define SkOpSegment_DEFINE 8 #define SkOpSegment_DEFINE
9 9
10 #include "SkOpAngle.h" 10 #include "SkOpAngle.h"
(...skipping 22 matching lines...) Expand all
33 // OPTIMIZE 33 // OPTIMIZE
34 // when the edges are initially walked, they don't automatically get the pri or and next 34 // when the edges are initially walked, they don't automatically get the pri or and next
35 // edges assigned to positions t=0 and t=1. Doing that would remove the need for this check, 35 // edges assigned to positions t=0 and t=1. Doing that would remove the need for this check,
36 // and would additionally remove the need for similar checks in condition ed ges. It would 36 // and would additionally remove the need for similar checks in condition ed ges. It would
37 // also allow intersection code to assume end of segment intersections (mayb e?) 37 // also allow intersection code to assume end of segment intersections (mayb e?)
38 bool complete() const { 38 bool complete() const {
39 int count = fTs.count(); 39 int count = fTs.count();
40 return count > 1 && fTs[0].fT == 0 && fTs[--count].fT == 1; 40 return count > 1 && fTs[0].fT == 0 && fTs[--count].fT == 1;
41 } 41 }
42 42
43 int count() const {
44 return fTs.count();
45 }
46
43 bool done() const { 47 bool done() const {
44 SkASSERT(fDoneSpans <= fTs.count()); 48 SkASSERT(fDoneSpans <= fTs.count());
45 return fDoneSpans == fTs.count(); 49 return fDoneSpans == fTs.count();
46 } 50 }
47 51
48 bool done(int min) const { 52 bool done(int min) const {
49 return fTs[min].fDone; 53 return fTs[min].fDone;
50 } 54 }
51 55
52 bool done(const SkOpAngle* angle) const { 56 bool done(const SkOpAngle* angle) const {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 117
114 int oppValue(int tIndex) const { 118 int oppValue(int tIndex) const {
115 return fTs[tIndex].fOppValue; 119 return fTs[tIndex].fOppValue;
116 } 120 }
117 121
118 int oppValue(const SkOpAngle* angle) const { 122 int oppValue(const SkOpAngle* angle) const {
119 int lesser = SkMin32(angle->start(), angle->end()); 123 int lesser = SkMin32(angle->start(), angle->end());
120 return fTs[lesser].fOppValue; 124 return fTs[lesser].fOppValue;
121 } 125 }
122 126
127 const SkOpSegment* other(int index) const {
128 return fTs[index].fOther;
129 }
130
123 const SkPoint* pts() const { 131 const SkPoint* pts() const {
124 return fPts; 132 return fPts;
125 } 133 }
126 134
127 void reset() { 135 void reset() {
128 init(NULL, (SkPath::Verb) -1, false, false); 136 init(NULL, (SkPath::Verb) -1, false, false);
129 fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMax, SK_ScalarMax); 137 fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMax, SK_ScalarMax);
130 fTs.reset(); 138 fTs.reset();
131 } 139 }
132 140
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 SkOpSegment* findNextXor(int* nextStart, int* nextEnd, bool* unsortable); 263 SkOpSegment* findNextXor(int* nextStart, int* nextEnd, bool* unsortable);
256 void findTooCloseToCall(); 264 void findTooCloseToCall();
257 SkOpSegment* findTop(int* tIndex, int* endIndex, bool* unsortable, bool only Sortable); 265 SkOpSegment* findTop(int* tIndex, int* endIndex, bool* unsortable, bool only Sortable);
258 void fixOtherTIndex(); 266 void fixOtherTIndex();
259 void initWinding(int start, int end); 267 void initWinding(int start, int end);
260 void initWinding(int start, int end, double tHit, int winding, SkScalar hitD x, int oppWind, 268 void initWinding(int start, int end, double tHit, int winding, SkScalar hitD x, int oppWind,
261 SkScalar hitOppDx); 269 SkScalar hitOppDx);
262 bool isLinear(int start, int end) const; 270 bool isLinear(int start, int end) const;
263 bool isMissing(double startT) const; 271 bool isMissing(double startT) const;
264 bool isSimple(int end) const; 272 bool isSimple(int end) const;
273 bool isTiny(const SkOpAngle* angle) const;
265 SkOpSpan* markAndChaseDoneBinary(int index, int endIndex); 274 SkOpSpan* markAndChaseDoneBinary(int index, int endIndex);
266 SkOpSpan* markAndChaseDoneUnary(int index, int endIndex); 275 SkOpSpan* markAndChaseDoneUnary(int index, int endIndex);
267 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding, int oppWi nding); 276 SkOpSpan* markAndChaseWinding(const SkOpAngle* angle, int winding, int oppWi nding);
268 SkOpSpan* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int o ppSumWinding, 277 SkOpSpan* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, int o ppSumWinding,
269 bool activeAngle, const SkOpAngle* angle); 278 bool activeAngle, const SkOpAngle* angle);
270 void markDone(int index, int winding); 279 void markDone(int index, int winding);
271 void markDoneBinary(int index); 280 void markDoneBinary(int index);
272 void markDoneUnary(int index); 281 void markDoneUnary(int index);
273 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding); 282 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding);
274 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding, int o ppWinding); 283 SkOpSpan* markOneWinding(const char* funName, int tIndex, int winding, int o ppWinding);
275 void markWinding(int index, int winding); 284 void markWinding(int index, int winding);
276 void markWinding(int index, int winding, int oppWinding); 285 void markWinding(int index, int winding, int oppWinding);
277 bool nextCandidate(int* start, int* end) const; 286 bool nextCandidate(int* start, int* end) const;
278 int nextExactSpan(int from, int step) const; 287 int nextExactSpan(int from, int step) const;
279 int nextSpan(int from, int step) const; 288 int nextSpan(int from, int step) const;
280 void setUpWindings(int index, int endIndex, int* sumMiWinding, int* sumSuWin ding, 289 void setUpWindings(int index, int endIndex, int* sumMiWinding, int* sumSuWin ding,
281 int* maxWinding, int* sumWinding, int* oppMaxWinding, int* oppSumWin ding); 290 int* maxWinding, int* sumWinding, int* oppMaxWinding, int* oppSumWin ding);
282 static bool SortAngles(const SkTDArray<SkOpAngle>& angles, SkTDArray<SkOpAng le*>* angleList); 291 static bool SortAngles(const SkTDArray<SkOpAngle>& angles, SkTDArray<SkOpAng le*>* angleList);
283 void subDivide(int start, int end, SkPoint edge[4]) const; 292 void subDivide(int start, int end, SkPoint edge[4]) const;
293 void subDivide(int start, int end, SkDCubic* result) const;
284 void undoneSpan(int* start, int* end); 294 void undoneSpan(int* start, int* end);
285 int updateOppWindingReverse(const SkOpAngle* angle) const; 295 int updateOppWindingReverse(const SkOpAngle* angle) const;
286 int updateWindingReverse(const SkOpAngle* angle) const; 296 int updateWindingReverse(const SkOpAngle* angle) const;
287 static bool UseInnerWinding(int outerWinding, int innerWinding); 297 static bool UseInnerWinding(int outerWinding, int innerWinding);
288 int windingAtT(double tHit, int tIndex, bool crossOpp, SkScalar* dx) const; 298 int windingAtT(double tHit, int tIndex, bool crossOpp, SkScalar* dx) const;
289 int windSum(const SkOpAngle* angle) const; 299 int windSum(const SkOpAngle* angle) const;
290 int windValue(const SkOpAngle* angle) const; 300 int windValue(const SkOpAngle* angle) const;
291 301
292 #if DEBUG_DUMP 302 #if DEBUG_DUMP
293 int debugID() const { 303 int debugID() const {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 void markOneDone(const char* funName, int tIndex, int winding); 351 void markOneDone(const char* funName, int tIndex, int winding);
342 void markOneDoneBinary(const char* funName, int tIndex); 352 void markOneDoneBinary(const char* funName, int tIndex);
343 void markOneDoneBinary(const char* funName, int tIndex, int winding, int opp Winding); 353 void markOneDoneBinary(const char* funName, int tIndex, int winding, int opp Winding);
344 void markOneDoneUnary(const char* funName, int tIndex); 354 void markOneDoneUnary(const char* funName, int tIndex);
345 void markUnsortable(int start, int end); 355 void markUnsortable(int start, int end);
346 bool monotonicInY(int tStart, int tEnd) const; 356 bool monotonicInY(int tStart, int tEnd) const;
347 bool multipleSpans(int end) const; 357 bool multipleSpans(int end) const;
348 SkOpSegment* nextChase(int* index, const int step, int* min, SkOpSpan** last ); 358 SkOpSegment* nextChase(int* index, const int step, int* min, SkOpSpan** last );
349 bool serpentine(int tStart, int tEnd) const; 359 bool serpentine(int tStart, int tEnd) const;
350 void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const; 360 void subDivideBounds(int start, int end, SkPathOpsBounds* bounds) const;
351 bool tiny(const SkOpAngle* angle) const;
352 static void TrackOutside(SkTDArray<double>* outsideTs, double end, double st art); 361 static void TrackOutside(SkTDArray<double>* outsideTs, double end, double st art);
353 int updateOppWinding(int index, int endIndex) const; 362 int updateOppWinding(int index, int endIndex) const;
354 int updateOppWinding(const SkOpAngle* angle) const; 363 int updateOppWinding(const SkOpAngle* angle) const;
355 int updateWinding(int index, int endIndex) const; 364 int updateWinding(int index, int endIndex) const;
356 int updateWinding(const SkOpAngle* angle) const; 365 int updateWinding(const SkOpAngle* angle) const;
357 SkOpSpan* verifyOneWinding(const char* funName, int tIndex); 366 SkOpSpan* verifyOneWinding(const char* funName, int tIndex);
358 SkOpSpan* verifyOneWindingU(const char* funName, int tIndex); 367 SkOpSpan* verifyOneWindingU(const char* funName, int tIndex);
359 int windValueAt(double t) const; 368 int windValueAt(double t) const;
360 void zeroSpan(SkOpSpan* span); 369 void zeroSpan(SkOpSpan* span);
361 370
(...skipping 22 matching lines...) Expand all
384 SkPath::Verb fVerb; 393 SkPath::Verb fVerb;
385 bool fOperand; 394 bool fOperand;
386 bool fXor; // set if original contour had even-odd fill 395 bool fXor; // set if original contour had even-odd fill
387 bool fOppXor; // set if opposite operand had even-odd fill 396 bool fOppXor; // set if opposite operand had even-odd fill
388 #if DEBUG_DUMP 397 #if DEBUG_DUMP
389 int fID; 398 int fID;
390 #endif 399 #endif
391 }; 400 };
392 401
393 #endif 402 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkOpAngle.cpp ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698