aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2010-12-10 09:05:41 -0800
committerChet Haase <chet@google.com>2010-12-10 16:42:05 -0800
commit9717bd93d86e12d2b9a506179493dd50613e99b2 (patch)
treecc2a5f376ee08b9ac2db9b46a0cb80ad071b0b1e /include
parent029fadbd02346019e9c7f18509b81144ea7ea4c2 (diff)
downloadexternal_skia-9717bd93d86e12d2b9a506179493dd50613e99b2.zip
external_skia-9717bd93d86e12d2b9a506179493dd50613e99b2.tar.gz
external_skia-9717bd93d86e12d2b9a506179493dd50613e99b2.tar.bz2
Allow bitmap reuse with PNG decoding
Change-Id: I8ba53eb6d4b99ce6352358b666d30b7668aa834f
Diffstat (limited to 'include')
-rw-r--r--include/core/SkTemplates.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h
index 27ebd41..d484389 100644
--- a/include/core/SkTemplates.h
+++ b/include/core/SkTemplates.h
@@ -61,8 +61,10 @@ private:
template <typename T> class SkAutoTDelete : SkNoncopyable {
public:
- SkAutoTDelete(T* obj) : fObj(obj) {}
- ~SkAutoTDelete() { delete fObj; }
+ SkAutoTDelete(T* obj, bool deleteWhenDone = true) : fObj(obj) {
+ this->deleteWhenDone = deleteWhenDone;
+ }
+ ~SkAutoTDelete() { if (deleteWhenDone) delete fObj; }
T* get() const { return fObj; }
void free() { delete fObj; fObj = NULL; }
@@ -70,6 +72,7 @@ public:
private:
T* fObj;
+ bool deleteWhenDone;
};
template <typename T> class SkAutoTDeleteArray : SkNoncopyable {