Adjust the alpha type for pixelRefs.
Move SkBitmap's validate_alphaType to SkImageInfo, with the new
name SkColorTypeValidateAlphaType. Use it in SkPixelRef's constructors,
as well as in SkDecodingImageGenerator. This fixes a bug where an
SkPixelRef's SkAlphaType could get out of sync with its SkBitmap,
when both were assigned the same SkAlphaType.
R=reed@google.com, halcanary@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/346593003
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 17e1228..3d82dc8 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -124,6 +124,15 @@
///////////////////////////////////////////////////////////////////////////////
/**
+ * Return true if alphaType is supported by colorType. If there is a canonical
+ * alphaType for this colorType, return it in canonical.
+ */
+bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
+ SkAlphaType* canonical = NULL);
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
* Describe an image's dimensions and pixel type.
*/
struct SkImageInfo {