Index: src/core/SkBitmap.cpp |
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp |
index ee741c3df09f4cf0a96b87d17e24d2482d59dcbe..c0d93957aca11292e2f6e52b17e9f7aa92783de7 100644 |
--- a/src/core/SkBitmap.cpp |
+++ b/src/core/SkBitmap.cpp |
@@ -402,6 +402,31 @@ SkPixelRef* SkBitmap::setPixelRef(SkPixelRef* pr, size_t offset) { |
if (NULL == pr) { |
offset = 0; |
} |
+#ifdef SK_DEBUG |
+ else { |
+ SkImageInfo info; |
+ if (this->asImageInfo(&info)) { |
+ const SkImageInfo& prInfo = pr->info(); |
+ SkASSERT(info.fWidth <= prInfo.fWidth); |
+ SkASSERT(info.fHeight <= prInfo.fHeight); |
+ SkASSERT(info.fColorType == prInfo.fColorType); |
+ switch (prInfo.fAlphaType) { |
+ case kIgnore_SkAlphaType: |
+ SkASSERT(fAlphaType == kIgnore_SkAlphaType); |
+ break; |
+ case kOpaque_SkAlphaType: |
+ case kPremul_SkAlphaType: |
hal.canary
2014/01/02 22:36:01
Under what circumstances will the alphatypes be !=
|
+ SkASSERT(info.fAlphaType == kOpaque_SkAlphaType || |
+ info.fAlphaType == kPremul_SkAlphaType); |
+ break; |
+ case kUnpremul_SkAlphaType: |
+ SkASSERT(info.fAlphaType == kOpaque_SkAlphaType || |
+ info.fAlphaType == kUnpremul_SkAlphaType); |
+ break; |
+ } |
+ } |
+ } |
+#endif |
if (fPixelRef != pr || fPixelRefOffset != offset) { |
if (fPixelRef != pr) { |