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

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

Issue 1182493015: pathops coincident fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: all tests (including extended) work Created 5 years, 5 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
« no previous file with comments | « src/pathops/SkOpContour.h ('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 27 matching lines...) Expand all
38 SkOpSpanBase** endPtr, bool* done); 38 SkOpSpanBase** endPtr, bool* done);
39 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, 39 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr,
40 SkOpSpanBase** endPtr, bool* done); 40 SkOpSpanBase** endPtr, bool* done);
41 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor SuMask, 41 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor SuMask,
42 SkPathOp op); 42 SkPathOp op);
43 bool activeOp(int xorMiMask, int xorSuMask, SkOpSpanBase* start, SkOpSpanBas e* end, SkPathOp op, 43 bool activeOp(int xorMiMask, int xorSuMask, SkOpSpanBase* start, SkOpSpanBas e* end, SkPathOp op,
44 int* sumMiWinding, int* sumSuWinding); 44 int* sumMiWinding, int* sumSuWinding);
45 45
46 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end); 46 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end);
47 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* sumWinding); 47 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* sumWinding);
48 void addAlignIntersection(SkOpPtT& endPtT, SkPoint& oldPt,
49 SkOpContourHead* contourList, SkChunkAlloc* allocator);
50
51 void addAlignIntersections(SkOpContourHead* contourList, SkChunkAlloc* alloc ator) {
52 this->addAlignIntersection(*fHead.ptT(), fOriginal[0], contourList, allo cator);
53 this->addAlignIntersection(*fTail.ptT(), fOriginal[1], contourList, allo cator);
54 }
48 55
49 SkOpSegment* addConic(SkPoint pts[3], SkScalar weight, SkOpContour* parent) { 56 SkOpSegment* addConic(SkPoint pts[3], SkScalar weight, SkOpContour* parent) {
50 init(pts, weight, parent, SkPath::kConic_Verb); 57 init(pts, weight, parent, SkPath::kConic_Verb);
51 SkDCurve curve; 58 SkDCurve curve;
52 curve.fConic.set(pts, weight); 59 curve.fConic.set(pts, weight);
53 curve.setConicBounds(pts, weight, 0, 1, &fBounds); 60 curve.setConicBounds(pts, weight, 0, 1, &fBounds);
54 return this; 61 return this;
55 } 62 }
56 63
57 SkOpSegment* addCubic(SkPoint pts[4], SkOpContour* parent) { 64 SkOpSegment* addCubic(SkPoint pts[4], SkOpContour* parent) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 SkOpSpanBase** lastPtr); 244 SkOpSpanBase** lastPtr);
238 bool markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, int winding , 245 bool markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, int winding ,
239 int oppWinding, SkOpSpanBase** lastPtr); 246 int oppWinding, SkOpSpanBase** lastPtr);
240 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, const SkOpAngle* ang le); 247 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, const SkOpAngle* ang le);
241 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, i nt oppSumWinding, 248 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, i nt oppSumWinding,
242 const SkOpAngle* angle); 249 const SkOpAngle* angle);
243 void markDone(SkOpSpan* ); 250 void markDone(SkOpSpan* );
244 bool markWinding(SkOpSpan* , int winding); 251 bool markWinding(SkOpSpan* , int winding);
245 bool markWinding(SkOpSpan* , int winding, int oppWinding); 252 bool markWinding(SkOpSpan* , int winding, int oppWinding);
246 bool match(const SkOpPtT* span, const SkOpSegment* parent, double t, const S kPoint& pt) const; 253 bool match(const SkOpPtT* span, const SkOpSegment* parent, double t, const S kPoint& pt) const;
247 void missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc* allocat or); 254 bool missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc* allocat or);
248 void moveMultiples(); 255 void moveMultiples();
249 void moveNearby(); 256 void moveNearby();
250 257
251 SkOpSegment* next() const { 258 SkOpSegment* next() const {
252 return fNext; 259 return fNext;
253 } 260 }
254 261
255 SkOpSegment* nextChase(SkOpSpanBase** , int* step, SkOpSpan** , SkOpSpanBase ** last) const; 262 SkOpSegment* nextChase(SkOpSpanBase** , int* step, SkOpSpan** , SkOpSpanBase ** last) const;
256 bool operand() const; 263 bool operand() const;
257 264
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 bool subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end, SkOpCurve * result) const; 346 bool subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end, SkOpCurve * result) const;
340 347
341 const SkOpSpanBase* tail() const { 348 const SkOpSpanBase* tail() const {
342 return &fTail; 349 return &fTail;
343 } 350 }
344 351
345 SkOpSpanBase* tail() { 352 SkOpSpanBase* tail() {
346 return &fTail; 353 return &fTail;
347 } 354 }
348 355
356 bool testForCoincidence(const SkOpPtT* priorPtT, const SkOpPtT* ptT, const S kOpSpanBase* prior,
357 const SkOpSpanBase* spanBase, const SkOpSegment* opp, SkScalar flatn essLimit) const;
358
349 void undoneSpan(SkOpSpanBase** start, SkOpSpanBase** end); 359 void undoneSpan(SkOpSpanBase** start, SkOpSpanBase** end);
350 int updateOppWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) con st; 360 int updateOppWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) con st;
351 int updateOppWinding(const SkOpAngle* angle) const; 361 int updateOppWinding(const SkOpAngle* angle) const;
352 int updateOppWindingReverse(const SkOpAngle* angle) const; 362 int updateOppWindingReverse(const SkOpAngle* angle) const;
353 int updateWinding(SkOpSpanBase* start, SkOpSpanBase* end); 363 int updateWinding(SkOpSpanBase* start, SkOpSpanBase* end);
354 int updateWinding(SkOpAngle* angle); 364 int updateWinding(SkOpAngle* angle);
355 int updateWindingReverse(const SkOpAngle* angle); 365 int updateWindingReverse(const SkOpAngle* angle);
356 366
357 static bool UseInnerWinding(int outerWinding, int innerWinding); 367 static bool UseInnerWinding(int outerWinding, int innerWinding);
358 368
(...skipping 20 matching lines...) Expand all
379 SkPoint* writablePt(bool end) { 389 SkPoint* writablePt(bool end) {
380 return &fPts[end ? SkPathOpsVerbToPoints(fVerb) : 0]; 390 return &fPts[end ? SkPathOpsVerbToPoints(fVerb) : 0];
381 } 391 }
382 392
383 private: 393 private:
384 SkOpSpan fHead; // the head span always has its t set to zero 394 SkOpSpan fHead; // the head span always has its t set to zero
385 SkOpSpanBase fTail; // the tail span always has its t set to one 395 SkOpSpanBase fTail; // the tail span always has its t set to one
386 SkOpContour* fContour; 396 SkOpContour* fContour;
387 SkOpSegment* fNext; // forward-only linked list used by contour to walk the segments 397 SkOpSegment* fNext; // forward-only linked list used by contour to walk the segments
388 const SkOpSegment* fPrev; 398 const SkOpSegment* fPrev;
399 SkPoint fOriginal[2]; // if aligned, the original unaligned points are here
389 SkPoint* fPts; // pointer into array of points owned by edge builder that m ay be tweaked 400 SkPoint* fPts; // pointer into array of points owned by edge builder that m ay be tweaked
390 SkPathOpsBounds fBounds; // tight bounds 401 SkPathOpsBounds fBounds; // tight bounds
391 SkScalar fWeight; 402 SkScalar fWeight;
392 int fCount; // number of spans (one for a non-intersecting segment) 403 int fCount; // number of spans (one for a non-intersecting segment)
393 int fDoneCount; // number of processed spans (zero initially) 404 int fDoneCount; // number of processed spans (zero initially)
394 SkPath::Verb fVerb; 405 SkPath::Verb fVerb;
395 SkDCubic::CubicType fCubicType; 406 SkDCubic::CubicType fCubicType;
396 bool fTopsFound; 407 bool fTopsFound;
397 bool fVisited; // used by missing coincidence check 408 bool fVisited; // used by missing coincidence check
398 SkDEBUGCODE(int fID); 409 SkDEBUGCODE(int fID);
399 }; 410 };
400 411
401 #endif 412 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkOpContour.h ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698