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

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

Issue 1129193006: fix winding for path ops builder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix compile bug Created 5 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
« no previous file with comments | « src/pathops/SkOpBuilder.cpp ('k') | src/pathops/SkOpContour.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 2013 Google Inc. 2 * Copyright 2013 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 SkOpContour_DEFINED 7 #ifndef SkOpContour_DEFINED
8 #define SkOpContour_DEFINED 8 #define SkOpContour_DEFINED
9 9
10 #include "SkOpSegment.h" 10 #include "SkOpSegment.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 SkDEBUGCODE(fDebugIndent += 2); 200 SkDEBUGCODE(fDebugIndent += 2);
201 } 201 }
202 202
203 void init(SkOpGlobalState* globalState, bool operand, bool isXor) { 203 void init(SkOpGlobalState* globalState, bool operand, bool isXor) {
204 fState = globalState; 204 fState = globalState;
205 fOperand = operand; 205 fOperand = operand;
206 fXor = isXor; 206 fXor = isXor;
207 SkDEBUGCODE(fID = globalState->nextContourID()); 207 SkDEBUGCODE(fID = globalState->nextContourID());
208 } 208 }
209 209
210 int isCcw() const {
211 return fCcw;
212 }
213
210 bool isXor() const { 214 bool isXor() const {
211 return fXor; 215 return fXor;
212 } 216 }
213 217
218 void markDone() {
219 SkOpSegment* segment = &fHead;
220 do {
221 segment->markAllDone();
222 } while ((segment = segment->next()));
223 }
224
214 void missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc* allocat or) { 225 void missingCoincidence(SkOpCoincidence* coincidences, SkChunkAlloc* allocat or) {
215 SkASSERT(fCount > 0); 226 SkASSERT(fCount > 0);
216 SkOpSegment* segment = &fHead; 227 SkOpSegment* segment = &fHead;
217 do { 228 do {
218 if (fState->angleCoincidence()) { 229 if (fState->angleCoincidence()) {
219 segment->checkAngleCoin(coincidences, allocator); 230 segment->checkAngleCoin(coincidences, allocator);
220 } else { 231 } else {
221 segment->missingCoincidence(coincidences, allocator); 232 segment->missingCoincidence(coincidences, allocator);
222 } 233 }
223 } while ((segment = segment->next())); 234 } while ((segment = segment->next()));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 fTail = NULL; 293 fTail = NULL;
283 fNext = NULL; 294 fNext = NULL;
284 fCount = 0; 295 fCount = 0;
285 fDone = false; 296 fDone = false;
286 fTopsFound = false; 297 fTopsFound = false;
287 SkDEBUGCODE(fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMin, SK_Sca larMin)); 298 SkDEBUGCODE(fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMin, SK_Sca larMin));
288 SkDEBUGCODE(fFirstSorted = -1); 299 SkDEBUGCODE(fFirstSorted = -1);
289 SkDEBUGCODE(fDebugIndent = 0); 300 SkDEBUGCODE(fDebugIndent = 0);
290 } 301 }
291 302
303 void resetReverse() {
304 SkOpContour* next = this;
305 do {
306 next->fCcw = -1;
307 next->fReverse = false;
308 } while ((next = next->next()));
309 }
310
311 bool reversed() const {
312 return fReverse;
313 }
314
292 void setBounds() { 315 void setBounds() {
293 SkASSERT(fCount > 0); 316 SkASSERT(fCount > 0);
294 const SkOpSegment* segment = &fHead; 317 const SkOpSegment* segment = &fHead;
295 fBounds = segment->bounds(); 318 fBounds = segment->bounds();
296 while ((segment = segment->next())) { 319 while ((segment = segment->next())) {
297 fBounds.add(segment->bounds()); 320 fBounds.add(segment->bounds());
298 } 321 }
299 } 322 }
300 323
324 void setCcw(int ccw) {
325 fCcw = ccw;
326 }
327
301 void setGlobalState(SkOpGlobalState* state) { 328 void setGlobalState(SkOpGlobalState* state) {
302 fState = state; 329 fState = state;
303 } 330 }
304 331
305 void setNext(SkOpContour* contour) { 332 void setNext(SkOpContour* contour) {
306 // SkASSERT(!fNext == !!contour); 333 // SkASSERT(!fNext == !!contour);
307 fNext = contour; 334 fNext = contour;
308 } 335 }
309 336
310 void setOperand(bool isOp) { 337 void setOperand(bool isOp) {
311 fOperand = isOp; 338 fOperand = isOp;
312 } 339 }
313 340
314 void setOppXor(bool isOppXor) { 341 void setOppXor(bool isOppXor) {
315 fOppXor = isOppXor; 342 fOppXor = isOppXor;
316 } 343 }
317 344
345 void setReverse() {
346 fReverse = true;
347 }
348
318 void setXor(bool isXor) { 349 void setXor(bool isXor) {
319 fXor = isXor; 350 fXor = isXor;
320 } 351 }
321 352
322 SkPath::Verb simplifyCubic(SkPoint pts[4]); 353 SkPath::Verb simplifyCubic(SkPoint pts[4]);
323 354
324 void sortAngles() { 355 void sortAngles() {
325 SkASSERT(fCount > 0); 356 SkASSERT(fCount > 0);
326 SkOpSegment* segment = &fHead; 357 SkOpSegment* segment = &fHead;
327 do { 358 do {
(...skipping 12 matching lines...) Expand all
340 } while ((segment = segment->prev())); 371 } while ((segment = segment->prev()));
341 } 372 }
342 373
343 void toPartialForward(SkPathWriter* path) const { 374 void toPartialForward(SkPathWriter* path) const {
344 const SkOpSegment* segment = &fHead; 375 const SkOpSegment* segment = &fHead;
345 do { 376 do {
346 segment->addCurveTo(segment->head(), segment->tail(), path, true); 377 segment->addCurveTo(segment->head(), segment->tail(), path, true);
347 } while ((segment = segment->next())); 378 } while ((segment = segment->next()));
348 } 379 }
349 380
381 void toReversePath(SkPathWriter* path) const;
350 void toPath(SkPathWriter* path) const; 382 void toPath(SkPathWriter* path) const;
351 SkOpSegment* undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr); 383 SkOpSegment* undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr);
352 384
353 private: 385 private:
354 SkOpGlobalState* fState; 386 SkOpGlobalState* fState;
355 SkOpSegment fHead; 387 SkOpSegment fHead;
356 SkOpSegment* fTail; 388 SkOpSegment* fTail;
357 SkOpContour* fNext; 389 SkOpContour* fNext;
358 SkPathOpsBounds fBounds; 390 SkPathOpsBounds fBounds;
391 int fCcw;
359 int fCount; 392 int fCount;
360 int fFirstSorted; 393 int fFirstSorted;
361 bool fDone; // set by find top segment 394 bool fDone; // set by find top segment
362 bool fTopsFound; 395 bool fTopsFound;
363 bool fOperand; // true for the second argument to a binary operator 396 bool fOperand; // true for the second argument to a binary operator
397 bool fReverse; // true if contour should be reverse written to path (used o nly by fix winding)
364 bool fXor; // set if original path had even-odd fill 398 bool fXor; // set if original path had even-odd fill
365 bool fOppXor; // set if opposite path had even-odd fill 399 bool fOppXor; // set if opposite path had even-odd fill
366 SkDEBUGCODE(int fID); 400 SkDEBUGCODE(int fID);
367 SkDEBUGCODE(mutable int fDebugIndent); 401 SkDEBUGCODE(mutable int fDebugIndent);
368 }; 402 };
369 403
370 class SkOpContourHead : public SkOpContour { 404 class SkOpContourHead : public SkOpContour {
371 }; 405 };
372 406
373 #endif 407 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkOpBuilder.cpp ('k') | src/pathops/SkOpContour.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698