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

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

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