diff options
author | 2011-12-15 20:14:06 +0000 | |
---|---|---|
committer | 2011-12-15 20:14:06 +0000 | |
commit | b052129a4121c1e3f051e374541a93d3d7a98064 (patch) | |
tree | 1d831ca914d2c682b99d2b8c6048d578cd650e18 /src/core/SkBitmap.cpp | |
parent | c315aeb48070b4ab6c4b0075f939dbb5a3a8192d (diff) |
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
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r-- | src/core/SkBitmap.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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: |