| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 */ | 246 */ |
| 247 uint32_t writeSize() const; | 247 uint32_t writeSize() const; |
| 248 | 248 |
| 249 /** | 249 /** |
| 250 * Gets an ID that uniquely identifies the contents of the path ref. If two
path refs have the | 250 * Gets an ID that uniquely identifies the contents of the path ref. If two
path refs have the |
| 251 * same ID then they have the same verbs and points. However, two path refs
may have the same | 251 * same ID then they have the same verbs and points. However, two path refs
may have the same |
| 252 * contents but different genIDs. | 252 * contents but different genIDs. |
| 253 */ | 253 */ |
| 254 uint32_t genID() const; | 254 uint32_t genID() const; |
| 255 | 255 |
| 256 SkDEBUGCODE(void validate() const;) |
| 257 |
| 256 private: | 258 private: |
| 257 enum SerializationOffsets { | 259 enum SerializationOffsets { |
| 258 kIsFinite_SerializationShift = 25, // requires 1 bit | 260 kIsFinite_SerializationShift = 25, // requires 1 bit |
| 259 kIsOval_SerializationShift = 24, // requires 1 bit | 261 kIsOval_SerializationShift = 24, // requires 1 bit |
| 260 kSegmentMask_SerializationShift = 0 // requires 4 bits | 262 kSegmentMask_SerializationShift = 0 // requires 4 bits |
| 261 }; | 263 }; |
| 262 | 264 |
| 263 SkPathRef() { | 265 SkPathRef() { |
| 264 fBoundsIsDirty = true; // this also invalidates fIsFinite | 266 fBoundsIsDirty = true; // this also invalidates fIsFinite |
| 265 fPointCnt = 0; | 267 fPointCnt = 0; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 return fVerbs - fVerbCnt; | 410 return fVerbs - fVerbCnt; |
| 409 } | 411 } |
| 410 | 412 |
| 411 /** | 413 /** |
| 412 * Gets the total amount of space allocated for verbs, points, and reserve. | 414 * Gets the total amount of space allocated for verbs, points, and reserve. |
| 413 */ | 415 */ |
| 414 size_t currSize() const { | 416 size_t currSize() const { |
| 415 return reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(f
Points); | 417 return reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(f
Points); |
| 416 } | 418 } |
| 417 | 419 |
| 418 SkDEBUGCODE(void validate() const;) | |
| 419 | |
| 420 /** | 420 /** |
| 421 * Called the first time someone calls CreateEmpty to actually create the si
ngleton. | 421 * Called the first time someone calls CreateEmpty to actually create the si
ngleton. |
| 422 */ | 422 */ |
| 423 friend SkPathRef* sk_create_empty_pathref(); | 423 friend SkPathRef* sk_create_empty_pathref(); |
| 424 | 424 |
| 425 void setIsOval(bool isOval) { fIsOval = isOval; } | 425 void setIsOval(bool isOval) { fIsOval = isOval; } |
| 426 | 426 |
| 427 SkPoint* getPoints() { | 427 SkPoint* getPoints() { |
| 428 SkDEBUGCODE(this->validate();) | 428 SkDEBUGCODE(this->validate();) |
| 429 fIsOval = false; | 429 fIsOval = false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 452 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer
o verbs. | 452 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer
o verbs. |
| 453 }; | 453 }; |
| 454 mutable uint32_t fGenerationID; | 454 mutable uint32_t fGenerationID; |
| 455 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use
at any time. | 455 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use
at any time. |
| 456 | 456 |
| 457 friend class PathRefTest_Private; | 457 friend class PathRefTest_Private; |
| 458 typedef SkRefCnt INHERITED; | 458 typedef SkRefCnt INHERITED; |
| 459 }; | 459 }; |
| 460 | 460 |
| 461 #endif | 461 #endif |
| OLD | NEW |