From b052129a4121c1e3f051e374541a93d3d7a98064 Mon Sep 17 00:00:00 2001 From: "junov@chromium.org" Date: Thu, 15 Dec 2011 20:14:06 +0000 Subject: Exposing the isImmutable/setImmutable API of SkPixelRef in SkBitmap REVIEW=http://codereview.appspot.com/5491055/ git-svn-id: http://skia.googlecode.com/svn/trunk@2883 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkBitmap.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/core/SkBitmap.cpp') diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 24a1839ff2..2376dd3117 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -409,6 +409,7 @@ uint32_t SkBitmap::getGenerationID() const { } void SkBitmap::notifyPixelsChanged() const { + SkASSERT(!this->isImmutable()); if (fPixelRef) { fPixelRef->notifyPixelsChanged(); } else { @@ -504,6 +505,19 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, /////////////////////////////////////////////////////////////////////////////// +bool SkBitmap::isImmutable() const { + return fPixelRef ? fPixelRef->isImmutable() : + fFlags & kImageIsImmutable_Flag; +} + +void SkBitmap::setImmutable() { + if (fPixelRef) { + fPixelRef->setImmutable(); + } else { + fFlags |= kImageIsImmutable_Flag; + } +} + bool SkBitmap::isOpaque() const { switch (fConfig) { case kNo_Config: -- cgit v1.2.3