From 02f55841854ae32f21a13417e9ee711463e488cf Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Tue, 4 Oct 2011 21:25:00 +0000 Subject: Change SkAutoMaskImage so that we're less likely to write leaky code. http://codereview.appspot.com/5180047/ git-svn-id: http://skia.googlecode.com/svn/trunk@2409 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkMaskFilter.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'include/core') diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h index b32f4d3926..0f1321e086 100644 --- a/include/core/SkMaskFilter.h +++ b/include/core/SkMaskFilter.h @@ -97,16 +97,13 @@ protected: Stack class used to manage the fImage buffer in a SkMask. When this object loses scope, the buffer is freed with SkMask::FreeImage(). */ -class SkAutoMaskImage { +class SkAutoMaskFreeImage { public: - SkAutoMaskImage(SkMask* mask, bool alloc) { - if (alloc) { - mask->fImage = SkMask::AllocImage(mask->computeImageSize()); - } - fImage = mask->fImage; + SkAutoMaskFreeImage(uint8_t* maskImage) { + fImage = maskImage; } - ~SkAutoMaskImage() { + ~SkAutoMaskFreeImage() { SkMask::FreeImage(fImage); } private: -- cgit v1.2.3