OLD | NEW |
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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 * constructor a SkAutoTUnref, which may be updated to point to a new SkPathRef
after the editor's | 29 * constructor a SkAutoTUnref, which may be updated to point to a new SkPathRef
after the editor's |
30 * constructor returns. | 30 * constructor returns. |
31 * | 31 * |
32 * The points and verbs are stored in a single allocation. The points are at the
begining of the | 32 * The points and verbs are stored in a single allocation. The points are at the
begining of the |
33 * allocation while the verbs are stored at end of the allocation, in reverse or
der. Thus the points | 33 * allocation while the verbs are stored at end of the allocation, in reverse or
der. Thus the points |
34 * and verbs both grow into the middle of the allocation until the meet. To acce
ss verb i in the | 34 * and verbs both grow into the middle of the allocation until the meet. To acce
ss verb i in the |
35 * verb array use ref.verbs()[~i] (because verbs() returns a pointer just beyond
the first | 35 * verb array use ref.verbs()[~i] (because verbs() returns a pointer just beyond
the first |
36 * logical verb or the last verb in memory). | 36 * logical verb or the last verb in memory). |
37 */ | 37 */ |
38 | 38 |
39 class SK_API SkPathRef : public ::SkRefCnt { | 39 class SK_API SkPathRef : public SkNVRefCnt<SkPathRef> { |
40 public: | 40 public: |
41 class Editor { | 41 class Editor { |
42 public: | 42 public: |
43 Editor(SkAutoTUnref<SkPathRef>* pathRef, | 43 Editor(SkAutoTUnref<SkPathRef>* pathRef, |
44 int incReserveVerbs = 0, | 44 int incReserveVerbs = 0, |
45 int incReservePoints = 0); | 45 int incReservePoints = 0); |
46 | 46 |
47 ~Editor() { SkDEBUGCODE(sk_atomic_dec(&fPathRef->fEditorsAttached);) } | 47 ~Editor() { SkDEBUGCODE(sk_atomic_dec(&fPathRef->fEditorsAttached);) } |
48 | 48 |
49 /** | 49 /** |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 static SkPathRef* CreateFromBuffer(SkRBuffer* buffer); | 237 static SkPathRef* CreateFromBuffer(SkRBuffer* buffer); |
238 | 238 |
239 /** | 239 /** |
240 * Rollsback a path ref to zero verbs and points with the assumption that th
e path ref will be | 240 * Rollsback a path ref to zero verbs and points with the assumption that th
e path ref will be |
241 * repopulated with approximately the same number of verbs and points. A new
path ref is created | 241 * repopulated with approximately the same number of verbs and points. A new
path ref is created |
242 * only if necessary. | 242 * only if necessary. |
243 */ | 243 */ |
244 static void Rewind(SkAutoTUnref<SkPathRef>* pathRef); | 244 static void Rewind(SkAutoTUnref<SkPathRef>* pathRef); |
245 | 245 |
246 virtual ~SkPathRef(); | 246 ~SkPathRef(); |
247 int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; } | 247 int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; } |
248 int countVerbs() const { SkDEBUGCODE(this->validate();) return fVerbCnt; } | 248 int countVerbs() const { SkDEBUGCODE(this->validate();) return fVerbCnt; } |
249 int countWeights() const { SkDEBUGCODE(this->validate();) return fConicWeigh
ts.count(); } | 249 int countWeights() const { SkDEBUGCODE(this->validate();) return fConicWeigh
ts.count(); } |
250 | 250 |
251 /** | 251 /** |
252 * Returns a pointer one beyond the first logical verb (last verb in memory
order). | 252 * Returns a pointer one beyond the first logical verb (last verb in memory
order). |
253 */ | 253 */ |
254 const uint8_t* verbs() const { SkDEBUGCODE(this->validate();) return fVerbs;
} | 254 const uint8_t* verbs() const { SkDEBUGCODE(this->validate();) return fVerbs;
} |
255 | 255 |
256 /** | 256 /** |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 SkBool8 fIsOval; | 536 SkBool8 fIsOval; |
537 SkBool8 fIsRRect; | 537 SkBool8 fIsRRect; |
538 // Both the circle and rrect special cases have a notion of direction and st
arting point | 538 // Both the circle and rrect special cases have a notion of direction and st
arting point |
539 // The next two variables store that information for either. | 539 // The next two variables store that information for either. |
540 SkBool8 fRRectOrOvalIsCCW; | 540 SkBool8 fRRectOrOvalIsCCW; |
541 uint8_t fRRectOrOvalStartIdx; | 541 uint8_t fRRectOrOvalStartIdx; |
542 uint8_t fSegmentMask; | 542 uint8_t fSegmentMask; |
543 | 543 |
544 friend class PathRefTest_Private; | 544 friend class PathRefTest_Private; |
545 friend class ForceIsRRect_Private; // unit test isRRect | 545 friend class ForceIsRRect_Private; // unit test isRRect |
546 typedef SkRefCnt INHERITED; | |
547 }; | 546 }; |
548 | 547 |
549 #endif | 548 #endif |
OLD | NEW |