Index: src/core/SkDescriptor.h |
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h |
index 22ec29316fd30094ed6ad36cff8150acde8808cd..0693ccfe60d82226b95eb5f73e69fc16b46cd9de 100644 |
--- a/src/core/SkDescriptor.h |
+++ b/src/core/SkDescriptor.h |
@@ -134,7 +134,13 @@ private: |
class SkAutoDescriptor : SkNoncopyable { |
public: |
- SkAutoDescriptor(size_t size) { |
+ SkAutoDescriptor() : fDesc(NULL) {} |
+ SkAutoDescriptor(size_t size) : fDesc(NULL) { this->reset(size); } |
+ |
+ ~SkAutoDescriptor() { this->free(); } |
+ |
+ void reset(size_t size) { |
+ this->free(); |
if (size <= sizeof(fStorage)) { |
fDesc = (SkDescriptor*)(void*)fStorage; |
} else { |
@@ -142,14 +148,14 @@ public: |
} |
} |
- ~SkAutoDescriptor() { |
+ SkDescriptor* getDesc() const { SkASSERT(fDesc); return fDesc; } |
+private: |
+ void free() { |
if (fDesc != (SkDescriptor*)(void*)fStorage) { |
SkDescriptor::Free(fDesc); |
} |
} |
- SkDescriptor* getDesc() const { return fDesc; } |
-private: |
enum { |
kStorageSize = sizeof(SkDescriptor) |
+ sizeof(SkDescriptor::Entry) + sizeof(SkScalerContext::Rec) // for rec |