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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 SkASSERT(fRowBytes >= (unsigned)ComputeRowBytes((Config)fConfig, fWidth)); 1606 SkASSERT(fRowBytes >= (unsigned)ComputeRowBytes((Config)fConfig, fWidth));
1607 uint8_t allFlags = kImageIsOpaque_Flag | kImageIsVolatile_Flag | kImageIsImm utable_Flag; 1607 uint8_t allFlags = kImageIsOpaque_Flag | kImageIsVolatile_Flag | kImageIsImm utable_Flag;
1608 #ifdef SK_BUILD_FOR_ANDROID 1608 #ifdef SK_BUILD_FOR_ANDROID
1609 allFlags |= kHasHardwareMipMap_Flag; 1609 allFlags |= kHasHardwareMipMap_Flag;
1610 #endif 1610 #endif
1611 SkASSERT(fFlags <= allFlags); 1611 SkASSERT(fFlags <= allFlags);
1612 SkASSERT(fPixelLockCount >= 0); 1612 SkASSERT(fPixelLockCount >= 0);
1613 SkASSERT(NULL == fColorTable || (unsigned)fColorTable->getRefCnt() < 10000); 1613 SkASSERT(NULL == fColorTable || (unsigned)fColorTable->getRefCnt() < 10000);
1614 SkASSERT((uint8_t)ComputeBytesPerPixel((Config)fConfig) == fBytesPerPixel); 1614 SkASSERT((uint8_t)ComputeBytesPerPixel((Config)fConfig) == fBytesPerPixel);
1615 1615
1616 #if 0 // these asserts are not thread-correct, so disable for now 1616 if (fPixels) {
1617 if (fPixelRef) { 1617 SkASSERT(fPixelRef);
1618 if (fPixelLockCount > 0) { 1618 SkASSERT(fPixelLockCount > 0);
1619 SkASSERT(fPixelRef->isLocked()); 1619 SkASSERT(fPixelRef->isLocked());
1620 } else { 1620 SkASSERT(fPixelRef->rowBytes() == fRowBytes);
1621 SkASSERT(NULL == fPixels); 1621 SkASSERT(fPixelRefOrigin.fX >= 0);
1622 SkASSERT(NULL == fColorTable); 1622 SkASSERT(fPixelRefOrigin.fY >= 0);
1623 } 1623 SkASSERT(fPixelRef->info().fWidth >= (int)fWidth + fPixelRefOrigin.fX);
1624 SkASSERT(fPixelRef->info().fHeight >= (int)fHeight + fPixelRefOrigin.fY) ;
1625 SkASSERT(fPixelRef->rowBytes() >= fWidth * fBytesPerPixel);
1626 } else {
1627 SkASSERT(NULL == fColorTable);
1624 } 1628 }
1625 #endif
1626 } 1629 }
1627 #endif 1630 #endif
1628 1631
1629 #ifdef SK_DEVELOPER 1632 #ifdef SK_DEVELOPER
1630 void SkBitmap::toString(SkString* str) const { 1633 void SkBitmap::toString(SkString* str) const {
1631 1634
1632 static const char* gConfigNames[kConfigCount] = { 1635 static const char* gConfigNames[kConfigCount] = {
1633 "NONE", "A8", "INDEX8", "565", "4444", "8888" 1636 "NONE", "A8", "INDEX8", "565", "4444", "8888"
1634 }; 1637 };
1635 1638
(...skipping 22 matching lines...) Expand all
1658 if (NULL != uri) { 1661 if (NULL != uri) {
1659 str->appendf(" uri:\"%s\"", uri); 1662 str->appendf(" uri:\"%s\"", uri);
1660 } else { 1663 } else {
1661 str->appendf(" pixelref:%p", pr); 1664 str->appendf(" pixelref:%p", pr);
1662 } 1665 }
1663 } 1666 }
1664 1667
1665 str->append(")"); 1668 str->append(")");
1666 } 1669 }
1667 #endif 1670 #endif
OLDNEW
« 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