Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: src/core/SkMask.cpp

Issue 889303005: return reference to cache instead of copying the mask (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reorder declarations Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkMaskFilter.h ('k') | src/core/SkMaskFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMask.cpp
diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp
index 4ae65c7a9cc871b64952e7e90c8a295f9855e43f..111508074a3e7f34cc2849ac77609eee0efce49e 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);
}
« no previous file with comments | « include/core/SkMaskFilter.h ('k') | src/core/SkMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698