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

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

Issue 1394503003: fix some pathops bugs found in 1M skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init to avoid warning Created 5 years, 2 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 const SkPathOpsBounds& bounds() const { 109 const SkPathOpsBounds& bounds() const {
110 return fBounds; 110 return fBounds;
111 } 111 }
112 112
113 void bumpCount() { 113 void bumpCount() {
114 ++fCount; 114 ++fCount;
115 } 115 }
116 116
117 void calcAngles(SkChunkAlloc*); 117 void calcAngles(SkChunkAlloc*);
118 void checkAngleCoin(SkOpCoincidence* coincidences, SkChunkAlloc* allocator);
119 void checkNearCoincidence(SkOpAngle* );
120 bool collapsed() const; 118 bool collapsed() const;
121 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, 119 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle,
122 SkOpAngle::IncludeType ); 120 SkOpAngle::IncludeType );
123 static void ComputeOneSumReverse(SkOpAngle* baseAngle, SkOpAngle* nextAngle, 121 static void ComputeOneSumReverse(SkOpAngle* baseAngle, SkOpAngle* nextAngle,
124 SkOpAngle::IncludeType ); 122 SkOpAngle::IncludeType );
125 int computeSum(SkOpSpanBase* start, SkOpSpanBase* end, SkOpAngle::IncludeTyp e includeType); 123 int computeSum(SkOpSpanBase* start, SkOpSpanBase* end, SkOpAngle::IncludeTyp e includeType);
126 124
127 SkOpContour* contour() const { 125 SkOpContour* contour() const {
128 return fContour; 126 return fContour;
129 } 127 }
130 128
131 int count() const { 129 int count() const {
132 return fCount; 130 return fCount;
133 } 131 }
134 132
135 void debugAddAngle(double startT, double endT, SkChunkAlloc*); 133 void debugAddAngle(double startT, double endT, SkChunkAlloc*);
134 void debugAddAlignIntersection(const char* id, SkPathOpsDebug::GlitchLog* gl itches,
135 const SkOpPtT& endPtT, const SkPoint& oldPt,
136 const SkOpContourHead* ) const;
137
138 void debugAddAlignIntersections(const char* id, SkPathOpsDebug::GlitchLog* g litches,
139 SkOpContourHead* contourList) const {
140 this->debugAddAlignIntersection(id, glitches, *fHead.ptT(), fOriginal[0] , contourList);
141 this->debugAddAlignIntersection(id, glitches, *fTail.ptT(), fOriginal[1] , contourList);
142 }
143
144 bool debugAddMissing(double t, const SkOpSegment* opp) const;
145 void debugAlign(const char* id, SkPathOpsDebug::GlitchLog* glitches) const;
136 const SkOpAngle* debugAngle(int id) const; 146 const SkOpAngle* debugAngle(int id) const;
147 #if DEBUG_ANGLE
148 void debugCheckAngleCoin() const;
149 #endif
150 void debugCheckHealth(const char* id, SkPathOpsDebug::GlitchLog* ) const;
137 SkOpContour* debugContour(int id); 151 SkOpContour* debugContour(int id);
152 void debugFindCollapsed(const char* id, SkPathOpsDebug::GlitchLog* glitches) const;
138 153
139 int debugID() const { 154 int debugID() const {
140 return SkDEBUGRELEASE(fID, -1); 155 return SkDEBUGRELEASE(fID, -1);
141 } 156 }
142 157
143 SkOpAngle* debugLastAngle(); 158 SkOpAngle* debugLastAngle();
159 void debugMissingCoincidence(const char* id, SkPathOpsDebug::GlitchLog* glit ches,
160 const SkOpCoincidence* coincidences) const;
161 void debugMoveMultiples(const char* id, SkPathOpsDebug::GlitchLog* glitches) const;
162 void debugMoveNearby(const char* id, SkPathOpsDebug::GlitchLog* glitches) co nst;
144 const SkOpPtT* debugPtT(int id) const; 163 const SkOpPtT* debugPtT(int id) const;
145 void debugReset(); 164 void debugReset();
146 const SkOpSegment* debugSegment(int id) const; 165 const SkOpSegment* debugSegment(int id) const;
147 166
148 #if DEBUG_ACTIVE_SPANS 167 #if DEBUG_ACTIVE_SPANS
149 void debugShowActiveSpans() const; 168 void debugShowActiveSpans() const;
150 #endif 169 #endif
151 #if DEBUG_MARK_DONE 170 #if DEBUG_MARK_DONE
152 void debugShowNewWinding(const char* fun, const SkOpSpan* span, int winding) ; 171 void debugShowNewWinding(const char* fun, const SkOpSpan* span, int winding) ;
153 void debugShowNewWinding(const char* fun, const SkOpSpan* span, int winding, int oppWinding); 172 void debugShowNewWinding(const char* fun, const SkOpSpan* span, int winding, int oppWinding);
154 #endif 173 #endif
155 174
156 const SkOpSpanBase* debugSpan(int id) const; 175 const SkOpSpanBase* debugSpan(int id) const;
157 void debugValidate() const; 176 void debugValidate() const;
158 void detach(const SkOpSpan* ); 177 void detach(const SkOpSpan* );
159 double distSq(double t, SkOpAngle* opp); 178 double distSq(double t, const SkOpAngle* opp) const;
160 179
161 bool done() const { 180 bool done() const {
162 SkASSERT(fDoneCount <= fCount); 181 SkASSERT(fDoneCount <= fCount);
163 return fDoneCount == fCount; 182 return fDoneCount == fCount;
164 } 183 }
165 184
166 bool done(const SkOpAngle* angle) const { 185 bool done(const SkOpAngle* angle) const {
167 return angle->start()->starter(angle->end())->done(); 186 return angle->start()->starter(angle->end())->done();
168 } 187 }
169 188
170 SkDPoint dPtAtT(double mid) const { 189 SkDPoint dPtAtT(double mid) const {
171 return (*CurveDPointAtT[fVerb])(fPts, fWeight, mid); 190 return (*CurveDPointAtT[fVerb])(fPts, fWeight, mid);
172 } 191 }
173 192
174 SkDVector dSlopeAtT(double mid) const { 193 SkDVector dSlopeAtT(double mid) const {
175 return (*CurveDSlopeAtT[fVerb])(fPts, fWeight, mid); 194 return (*CurveDSlopeAtT[fVerb])(fPts, fWeight, mid);
176 } 195 }
177 196
178 void dump() const; 197 void dump() const;
179 void dumpAll() const; 198 void dumpAll() const;
180 void dumpAngles() const; 199 void dumpAngles() const;
181 void dumpCoin() const; 200 void dumpCoin() const;
182 void dumpPts() const; 201 void dumpPts(const char* prefix = "seg") const;
183 void dumpPtsInner() const; 202 void dumpPtsInner(const char* prefix = "seg") const;
184 203
185 void findCollapsed(); 204 void findCollapsed();
186 SkOpSegment* findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** next Start, 205 SkOpSegment* findNextOp(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** next Start,
187 SkOpSpanBase** nextEnd, bool* unsortable, SkPathOp op, 206 SkOpSpanBase** nextEnd, bool* unsortable, SkPathOp op,
188 int xorMiMask, int xorSuMask); 207 int xorMiMask, int xorSuMask);
189 SkOpSegment* findNextWinding(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** nextStart, 208 SkOpSegment* findNextWinding(SkTDArray<SkOpSpanBase*>* chase, SkOpSpanBase** nextStart,
190 SkOpSpanBase** nextEnd, bool* unsortable); 209 SkOpSpanBase** nextEnd, bool* unsortable);
191 SkOpSegment* findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** nextEnd, b ool* unsortable); 210 SkOpSegment* findNextXor(SkOpSpanBase** nextStart, SkOpSpanBase** nextEnd, b ool* unsortable);
192 SkOpSpan* findSortableTop(SkOpContour* ); 211 SkOpSpan* findSortableTop(SkOpContour* );
193 SkOpGlobalState* globalState() const; 212 SkOpGlobalState* globalState() const;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 SkPathOpsBounds fBounds; // tight bounds 417 SkPathOpsBounds fBounds; // tight bounds
399 SkScalar fWeight; 418 SkScalar fWeight;
400 int fCount; // number of spans (one for a non-intersecting segment) 419 int fCount; // number of spans (one for a non-intersecting segment)
401 int fDoneCount; // number of processed spans (zero initially) 420 int fDoneCount; // number of processed spans (zero initially)
402 SkPath::Verb fVerb; 421 SkPath::Verb fVerb;
403 bool fVisited; // used by missing coincidence check 422 bool fVisited; // used by missing coincidence check
404 SkDEBUGCODE(int fID); 423 SkDEBUGCODE(int fID);
405 }; 424 };
406 425
407 #endif 426 #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