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

Side by Side Diff: include/core/SkPathRef.h

Issue 377693005: Revert of Add SkRacy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « include/core/SkMatrix.h ('k') | include/core/SkPixelRef.h » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkPathRef_DEFINED 9 #ifndef SkPathRef_DEFINED
10 #define SkPathRef_DEFINED 10 #define SkPathRef_DEFINED
11 11
12 #include "SkDynamicAnnotations.h"
13 #include "SkMatrix.h" 12 #include "SkMatrix.h"
14 #include "SkPoint.h" 13 #include "SkPoint.h"
15 #include "SkRect.h" 14 #include "SkRect.h"
16 #include "SkRefCnt.h" 15 #include "SkRefCnt.h"
17 #include "SkTDArray.h" 16 #include "SkTDArray.h"
18 #include <stddef.h> // ptrdiff_t 17 #include <stddef.h> // ptrdiff_t
19 18
20 class SkRBuffer; 19 class SkRBuffer;
21 class SkWBuffer; 20 class SkWBuffer;
22 21
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } else { 285 } else {
287 return bounds->setBoundsCheck(ref.points(), count); 286 return bounds->setBoundsCheck(ref.points(), count);
288 } 287 }
289 } 288 }
290 289
291 // called, if dirty, by getBounds() 290 // called, if dirty, by getBounds()
292 void computeBounds() const { 291 void computeBounds() const {
293 SkDEBUGCODE(this->validate();) 292 SkDEBUGCODE(this->validate();)
294 SkASSERT(fBoundsIsDirty); 293 SkASSERT(fBoundsIsDirty);
295 294
296 fIsFinite = ComputePtBounds(fBounds.get(), *this); 295 fIsFinite = ComputePtBounds(&fBounds, *this);
297 fBoundsIsDirty = false; 296 fBoundsIsDirty = false;
298 } 297 }
299 298
300 void setBounds(const SkRect& rect) { 299 void setBounds(const SkRect& rect) {
301 SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom); 300 SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom);
302 fBounds = rect; 301 fBounds = rect;
303 fBoundsIsDirty = false; 302 fBoundsIsDirty = false;
304 fIsFinite = fBounds->isFinite(); 303 fIsFinite = fBounds.isFinite();
305 } 304 }
306 305
307 /** Makes additional room but does not change the counts or change the genID */ 306 /** Makes additional room but does not change the counts or change the genID */
308 void incReserve(int additionalVerbs, int additionalPoints) { 307 void incReserve(int additionalVerbs, int additionalPoints) {
309 SkDEBUGCODE(this->validate();) 308 SkDEBUGCODE(this->validate();)
310 size_t space = additionalVerbs * sizeof(uint8_t) + additionalPoints * si zeof (SkPoint); 309 size_t space = additionalVerbs * sizeof(uint8_t) + additionalPoints * si zeof (SkPoint);
311 this->makeSpace(space); 310 this->makeSpace(space);
312 SkDEBUGCODE(this->validate();) 311 SkDEBUGCODE(this->validate();)
313 } 312 }
314 313
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 SkPoint* getPoints() { 425 SkPoint* getPoints() {
427 SkDEBUGCODE(this->validate();) 426 SkDEBUGCODE(this->validate();)
428 fIsOval = false; 427 fIsOval = false;
429 return fPoints; 428 return fPoints;
430 } 429 }
431 430
432 enum { 431 enum {
433 kMinSize = 256, 432 kMinSize = 256,
434 }; 433 };
435 434
436 mutable SkTRacy<SkRect> fBounds; 435 mutable SkRect fBounds;
437 mutable SkTRacy<uint8_t> fBoundsIsDirty; 436 uint8_t fSegmentMask;
438 mutable SkTRacy<SkBool8> fIsFinite; // only meaningful if bounds are valid 437 mutable uint8_t fBoundsIsDirty;
439 438 mutable SkBool8 fIsFinite; // only meaningful if bounds are valid
440 SkBool8 fIsOval; 439 mutable SkBool8 fIsOval;
441 uint8_t fSegmentMask;
442 440
443 SkPoint* fPoints; // points to begining of the allocation 441 SkPoint* fPoints; // points to begining of the allocation
444 uint8_t* fVerbs; // points just past the end of the allocation (v erbs grow backwards) 442 uint8_t* fVerbs; // points just past the end of the allocation (v erbs grow backwards)
445 int fVerbCnt; 443 int fVerbCnt;
446 int fPointCnt; 444 int fPointCnt;
447 size_t fFreeSpace; // redundant but saves computation 445 size_t fFreeSpace; // redundant but saves computation
448 SkTDArray<SkScalar> fConicWeights; 446 SkTDArray<SkScalar> fConicWeights;
449 447
450 enum { 448 enum {
451 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer o verbs. 449 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer o verbs.
452 }; 450 };
453 mutable uint32_t fGenerationID; 451 mutable uint32_t fGenerationID;
454 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time. 452 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time.
455 453
456 friend class PathRefTest_Private; 454 friend class PathRefTest_Private;
457 typedef SkRefCnt INHERITED; 455 typedef SkRefCnt INHERITED;
458 }; 456 };
459 457
460 #endif 458 #endif
OLDNEW
« no previous file with comments | « include/core/SkMatrix.h ('k') | include/core/SkPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698