aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMask.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-02-04 09:07:17 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-04 09:07:17 -0800
commitb0df8be137d8fb49436e46d1fd1a5aec8b7ab562 (patch)
treeb56df14fae666ac8c6c56ee3fe7d6bdc8d64f4f2 /src/core/SkMask.cpp
parent1a481fe4bf632ed4f76cb337691236fabfd4ab03 (diff)
return reference to cache instead of copying the mask
Diffstat (limited to 'src/core/SkMask.cpp')
-rw-r--r--src/core/SkMask.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp
index 4ae65c7a9c..111508074a 100644
--- a/src/core/SkMask.cpp
+++ b/src/core/SkMask.cpp
@@ -7,6 +7,8 @@
#include "SkMask.h"
+//#define TRACK_SKMASK_LIFETIME
+
/** returns the product if it is positive and fits in 31 bits. Otherwise this
returns 0.
*/
@@ -30,10 +32,17 @@ size_t SkMask::computeTotalImageSize() const {
return size;
}
+#ifdef TRACK_SKMASK_LIFETIME
+ static int gCounter;
+#endif
+
/** We explicitly use this allocator for SkBimap pixels, so that we can
freely assign memory allocated by one class to the other.
*/
uint8_t* SkMask::AllocImage(size_t size) {
+#ifdef TRACK_SKMASK_LIFETIME
+ SkDebugf("SkMask::AllocImage %d\n", gCounter++);
+#endif
return (uint8_t*)sk_malloc_throw(SkAlign4(size));
}
@@ -41,6 +50,11 @@ uint8_t* SkMask::AllocImage(size_t size) {
freely assign memory allocated by one class to the other.
*/
void SkMask::FreeImage(void* image) {
+#ifdef TRACK_SKMASK_LIFETIME
+ if (image) {
+ SkDebugf("SkMask::FreeImage %d\n", --gCounter);
+ }
+#endif
sk_free(image);
}