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

Unified Diff: include/core/SkImageInfo.h

Issue 966753002: Revert of replace kIgnore_SkAlphaType with kUnknown_SkAlphaType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « include/core/SkCanvas.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageInfo.h
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index d915c09255f345abe86d419153ba96c7a52360a2..f928416fe7bd1c9df84ef431ee13229f35c184d1 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -19,7 +19,12 @@
* Describes how to interpret the alpha compoent of a pixel.
*/
enum SkAlphaType {
- kUnknown_SkAlphaType,
+ /**
+ * All pixels should be treated as opaque, regardless of the value stored
+ * in their alpha field. Used for legacy images that wrote 0 or garbarge
+ * in their alpha field, but intended the RGB to be treated as opaque.
+ */
+ kIgnore_SkAlphaType,
/**
* All pixels are stored as opaque. This differs slightly from kIgnore in
@@ -48,7 +53,11 @@
};
static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) {
- return kOpaque_SkAlphaType == at;
+ SK_COMPILE_ASSERT(kIgnore_SkAlphaType < kOpaque_SkAlphaType, bad_alphatype_order);
+ SK_COMPILE_ASSERT(kPremul_SkAlphaType > kOpaque_SkAlphaType, bad_alphatype_order);
+ SK_COMPILE_ASSERT(kUnpremul_SkAlphaType > kOpaque_SkAlphaType, bad_alphatype_order);
+
+ return (unsigned)at <= kOpaque_SkAlphaType;
}
static inline bool SkAlphaTypeIsValid(unsigned value) {
@@ -152,7 +161,7 @@
: fWidth(0)
, fHeight(0)
, fColorType(kUnknown_SkColorType)
- , fAlphaType(kUnknown_SkAlphaType)
+ , fAlphaType(kIgnore_SkAlphaType)
, fProfileType(kLinear_SkColorProfileType)
{}
@@ -191,7 +200,7 @@
}
static SkImageInfo MakeUnknown(int width, int height) {
- return SkImageInfo(width, height, kUnknown_SkColorType, kUnknown_SkAlphaType,
+ return SkImageInfo(width, height, kUnknown_SkColorType, kIgnore_SkAlphaType,
kLinear_SkColorProfileType);
}
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698