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

Unified Diff: src/core/SkPixelRef.cpp

Issue 1252973003: remove pixel assert from ctable validator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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/SkPixelRef.cpp
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 082435f8c778cf2bfb60ecf1f75f7a3fad2c3a3a..6d36915d9afc37e4878ef5bb98dff2f27c03641a 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 {
« 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