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

Side by Side Diff: src/pathops/SkOpSpan.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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/SkOpSpan.h ('k') | src/pdf/SkPDFDevice.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 2014 Google Inc. 2 * Copyright 2014 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 #include "SkOpCoincidence.h" 7 #include "SkOpCoincidence.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 void SkOpPtT::removeNext(SkOpPtT* kept) { 133 void SkOpPtT::removeNext(SkOpPtT* kept) {
134 SkASSERT(this->fNext); 134 SkASSERT(this->fNext);
135 SkOpPtT* next = this->fNext; 135 SkOpPtT* next = this->fNext;
136 SkASSERT(this != next->fNext); 136 SkASSERT(this != next->fNext);
137 this->fNext = next->fNext; 137 this->fNext = next->fNext;
138 SkOpSpanBase* span = next->span(); 138 SkOpSpanBase* span = next->span();
139 next->setDeleted(); 139 next->setDeleted();
140 if (span->ptT() == next) { 140 if (span->ptT() == next) {
141 span->upCast()->detach(kept); 141 span->upCast()->release(kept);
142 } 142 }
143 } 143 }
144 144
145 const SkOpSegment* SkOpPtT::segment() const { 145 const SkOpSegment* SkOpPtT::segment() const {
146 return span()->segment(); 146 return span()->segment();
147 } 147 }
148 148
149 SkOpSegment* SkOpPtT::segment() { 149 SkOpSegment* SkOpPtT::segment() {
150 return span()->segment(); 150 return span()->segment();
151 } 151 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 SkDEBUGCODE(fCount = 1); 286 SkDEBUGCODE(fCount = 1);
287 SkDEBUGCODE(fID = globalState()->nextSpanID()); 287 SkDEBUGCODE(fID = globalState()->nextSpanID());
288 } 288 }
289 289
290 // this pair of spans share a common t value or point; merge them and eliminate duplicates 290 // this pair of spans share a common t value or point; merge them and eliminate duplicates
291 // this does not compute the best t or pt value; this merely moves all data into a single list 291 // this does not compute the best t or pt value; this merely moves all data into a single list
292 void SkOpSpanBase::merge(SkOpSpan* span) { 292 void SkOpSpanBase::merge(SkOpSpan* span) {
293 SkOpPtT* spanPtT = span->ptT(); 293 SkOpPtT* spanPtT = span->ptT();
294 SkASSERT(this->t() != spanPtT->fT); 294 SkASSERT(this->t() != spanPtT->fT);
295 SkASSERT(!zero_or_one(spanPtT->fT)); 295 SkASSERT(!zero_or_one(spanPtT->fT));
296 span->detach(this->ptT()); 296 span->release(this->ptT());
297 SkOpPtT* remainder = spanPtT->next(); 297 SkOpPtT* remainder = spanPtT->next();
298 ptT()->insert(spanPtT); 298 ptT()->insert(spanPtT);
299 while (remainder != spanPtT) { 299 while (remainder != spanPtT) {
300 SkOpPtT* next = remainder->next(); 300 SkOpPtT* next = remainder->next();
301 SkOpPtT* compare = spanPtT->next(); 301 SkOpPtT* compare = spanPtT->next();
302 while (compare != spanPtT) { 302 while (compare != spanPtT) {
303 SkOpPtT* nextC = compare->next(); 303 SkOpPtT* nextC = compare->next();
304 if (nextC->span() == remainder->span() && nextC->fT == remainder->fT ) { 304 if (nextC->span() == remainder->span() && nextC->fT == remainder->fT ) {
305 goto tryNextRemainder; 305 goto tryNextRemainder;
306 } 306 }
(...skipping 20 matching lines...) Expand all
327 SkASSERT(this->segment() != segment); 327 SkASSERT(this->segment() != segment);
328 const SkOpSpan* next = fCoincident; 328 const SkOpSpan* next = fCoincident;
329 do { 329 do {
330 if (next->segment() == segment) { 330 if (next->segment() == segment) {
331 return true; 331 return true;
332 } 332 }
333 } while ((next = next->fCoincident) != this); 333 } while ((next = next->fCoincident) != this);
334 return false; 334 return false;
335 } 335 }
336 336
337 void SkOpSpan::detach(SkOpPtT* kept) { 337 void SkOpSpan::release(SkOpPtT* kept) {
338 SkASSERT(!final()); 338 SkASSERT(!final());
339 SkOpSpan* prev = this->prev(); 339 SkOpSpan* prev = this->prev();
340 SkASSERT(prev); 340 SkASSERT(prev);
341 SkOpSpanBase* next = this->next(); 341 SkOpSpanBase* next = this->next();
342 SkASSERT(next); 342 SkASSERT(next);
343 prev->setNext(next); 343 prev->setNext(next);
344 next->setPrev(prev); 344 next->setPrev(prev);
345 this->segment()->detach(this); 345 this->segment()->release(this);
346 SkOpCoincidence* coincidence = this->globalState()->coincidence(); 346 SkOpCoincidence* coincidence = this->globalState()->coincidence();
347 if (coincidence) { 347 if (coincidence) {
348 coincidence->fixUp(this->ptT(), kept); 348 coincidence->fixUp(this->ptT(), kept);
349 } 349 }
350 this->ptT()->setDeleted(); 350 this->ptT()->setDeleted();
351 } 351 }
352 352
353 void SkOpSpan::init(SkOpSegment* segment, SkOpSpan* prev, double t, const SkPoin t& pt) { 353 void SkOpSpan::init(SkOpSegment* segment, SkOpSpan* prev, double t, const SkPoin t& pt) {
354 SkASSERT(t != 1); 354 SkASSERT(t != 1);
355 initBase(segment, prev, t, pt); 355 initBase(segment, prev, t, pt);
(...skipping 20 matching lines...) Expand all
376 376
377 void SkOpSpan::setWindSum(int windSum) { 377 void SkOpSpan::setWindSum(int windSum) {
378 SkASSERT(!final()); 378 SkASSERT(!final());
379 if (fWindSum != SK_MinS32 && fWindSum != windSum) { 379 if (fWindSum != SK_MinS32 && fWindSum != windSum) {
380 this->globalState()->setWindingFailed(); 380 this->globalState()->setWindingFailed();
381 return; 381 return;
382 } 382 }
383 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM); 383 SkASSERT(!DEBUG_LIMIT_WIND_SUM || SkTAbs(windSum) <= DEBUG_LIMIT_WIND_SUM);
384 fWindSum = windSum; 384 fWindSum = windSum;
385 } 385 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSpan.h ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698