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

Unified Diff: src/core/SkPixelRef.cpp

Issue 346593003: Adjust the alpha type for pixelRefs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix alignment. Created 6 years, 6 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 | « src/core/SkImageInfo.cpp ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | 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 bfa4ae24d944cbeb39bcdd21fd5b817db7949293..829c3f1b12b21944dbbce747e63307a2a342dc56 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -84,6 +84,9 @@ void SkPixelRef::setMutex(SkBaseMutex* mutex) {
#define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789
SkPixelRef::SkPixelRef(const SkImageInfo& info) : fInfo(info) {
+ SkAssertResult(SkColorTypeValidateAlphaType(fInfo.colorType(), fInfo.alphaType(),
+ const_cast<SkAlphaType*>(&fInfo.fAlphaType)));
+
this->setMutex(NULL);
fRec.zero();
fLockCount = 0;
@@ -94,6 +97,9 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info) : fInfo(info) {
SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) : fInfo(info) {
+ SkAssertResult(SkColorTypeValidateAlphaType(fInfo.colorType(), fInfo.alphaType(),
+ const_cast<SkAlphaType*>(&fInfo.fAlphaType)));
+
this->setMutex(mutex);
fRec.zero();
fLockCount = 0;
@@ -112,6 +118,10 @@ SkPixelRef::SkPixelRef(SkReadBuffer& buffer, SkBaseMutex* mutex)
: INHERITED(buffer)
, fInfo(read_info(buffer))
{
+ SkDEBUGCODE(SkAlphaType alphaType;)
+ SkASSERT(SkColorTypeValidateAlphaType(fInfo.colorType(), fInfo.alphaType(), &alphaType));
+ SkASSERT(fInfo.fAlphaType == alphaType);
+
this->setMutex(mutex);
fRec.zero();
fLockCount = 0;
« no previous file with comments | « src/core/SkImageInfo.cpp ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698