aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-07-27 12:19:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-27 12:19:16 -0700
commitbca140010ff53f8c836956efe67e44871da9df3d (patch)
treeb07f87bce14fd6762e074015ed0308872c6a3974
parente9d6095674979a9b843c291b85746922e9ac181a (diff)
remove pixel assert from ctable validator
-rw-r--r--src/core/SkPixelRef.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 082435f8c7..6d36915d9a 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -160,12 +160,10 @@ void SkPixelRef::cloneGenID(const SkPixelRef& that) {
SkASSERT(!that. genIDIsUnique());
}
-static void validate_pixels_ctable(const SkImageInfo& info, const void* pixels,
- const SkColorTable* ctable) {
+static void validate_pixels_ctable(const SkImageInfo& info, const SkColorTable* ctable) {
if (info.isEmpty()) {
- return; // can't require pixels if the dimensions are empty
+ return; // can't require ctable if the dimensions are empty
}
- SkASSERT(pixels);
if (kIndex_8_SkColorType == info.colorType()) {
SkASSERT(ctable);
} else {
@@ -175,7 +173,8 @@ static void validate_pixels_ctable(const SkImageInfo& info, const void* pixels,
void SkPixelRef::setPreLocked(void* pixels, size_t rowBytes, SkColorTable* ctable) {
#ifndef SK_IGNORE_PIXELREF_SETPRELOCKED
- validate_pixels_ctable(fInfo, pixels, ctable);
+ SkASSERT(pixels);
+ validate_pixels_ctable(fInfo, ctable);
// only call me in your constructor, otherwise fLockCount tracking can get
// out of sync.
fRec.fPixels = pixels;
@@ -198,8 +197,11 @@ bool SkPixelRef::lockPixelsInsideMutex() {
return false;
}
}
- validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable);
- return fRec.fPixels != NULL;
+ if (fRec.fPixels) {
+ validate_pixels_ctable(fInfo, fRec.fColorTable);
+ return true;
+ }
+ return false;
}
// For historical reasons, we always inc fLockCount, even if we return false.
@@ -223,8 +225,11 @@ bool SkPixelRef::lockPixels() {
return false;
}
}
- validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable);
- return fRec.fPixels != NULL;
+ if (fRec.fPixels) {
+ validate_pixels_ctable(fInfo, fRec.fColorTable);
+ return true;
+ }
+ return false;
}
bool SkPixelRef::lockPixels(LockRec* rec) {
@@ -277,8 +282,11 @@ bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
return false;
}
}
- validate_pixels_ctable(fInfo, result->fPixels, result->fCTable);
- return result->fPixels != NULL;
+ if (result->fPixels) {
+ validate_pixels_ctable(fInfo, result->fCTable);
+ return true;
+ }
+ return false;
}
bool SkPixelRef::lockPixelsAreWritable() const {