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

Unified Diff: src/core/SkBitmap.cpp

Issue 139063003: add asserts to validate (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 9fb29eefa7f799e407e5a68eb674a5d9876ebd80..27ea35e974b8c4423ed58671e4b22b936cf00c75 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1613,16 +1613,19 @@ void SkBitmap::validate() const {
SkASSERT(NULL == fColorTable || (unsigned)fColorTable->getRefCnt() < 10000);
SkASSERT((uint8_t)ComputeBytesPerPixel((Config)fConfig) == fBytesPerPixel);
-#if 0 // these asserts are not thread-correct, so disable for now
- if (fPixelRef) {
- if (fPixelLockCount > 0) {
- SkASSERT(fPixelRef->isLocked());
- } else {
- SkASSERT(NULL == fPixels);
- SkASSERT(NULL == fColorTable);
- }
+ if (fPixels) {
+ SkASSERT(fPixelRef);
+ SkASSERT(fPixelLockCount > 0);
+ SkASSERT(fPixelRef->isLocked());
+ SkASSERT(fPixelRef->rowBytes() == fRowBytes);
+ SkASSERT(fPixelRefOrigin.fX >= 0);
+ SkASSERT(fPixelRefOrigin.fY >= 0);
+ SkASSERT(fPixelRef->info().fWidth >= (int)fWidth + fPixelRefOrigin.fX);
+ SkASSERT(fPixelRef->info().fHeight >= (int)fHeight + fPixelRefOrigin.fY);
+ SkASSERT(fPixelRef->rowBytes() >= fWidth * fBytesPerPixel);
+ } else {
+ SkASSERT(NULL == fColorTable);
}
-#endif
}
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698