Reland "Add idea of DataType to SkYUVAPixmapInfo."

This is a reland of ed6344458750c0389b7ccce588b96d0c25397b19

Original change's description:
> Add idea of DataType to SkYUVAPixmapInfo.
> 
> DataType describes the data type of YUVA channels
> independent of how they are grouped into planes.
> 
> Adds mapping functions between SkColorType/channel count
> and DataType.
> 
> SkYUVAPixmapInfo can be constructed from DataType and will
> choose appropriate SkColorTypes for each plane.
> 
> Valid SkYUVAPixmapInfos now have the same DataType for each
> plane (could relax this in the future, esp for alpha plane).
> 
> SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
> combinations of SkYUVAInfo::PlanarConfig and
> kYUVAPixmapInfo::DataType supported by a GrContext (based on
> supported texture formats).
> 
> SkImageGenerator/SkCodec YUVA query API now takes a
> SupportedDataTypes.
> 
> Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:10632
Change-Id: I35b55b7477c11c822fdb3729a9f84acff1eb785d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315284
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 53b5cae..d7b3974 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -745,6 +745,7 @@
 
 static bool is_yuv_supported(const jpeg_decompress_struct* dinfo,
                              const SkJpegCodec& codec,
+                             const SkYUVAPixmapInfo::SupportedDataTypes* supportedDataTypes,
                              SkYUVAPixmapInfo* yuvaPixmapInfo) {
     // Scaling is not supported in raw data mode.
     SkASSERT(dinfo->scale_num == dinfo->scale_denom);
@@ -811,6 +812,10 @@
     } else {
         return false;
     }
+    if (supportedDataTypes &&
+        !supportedDataTypes->supported(tempPlanarConfig, SkYUVAPixmapInfo::DataType::kUnorm8)) {
+        return false;
+    }
     if (yuvaPixmapInfo) {
         SkColorType colorTypes[SkYUVAPixmapInfo::kMaxPlanes];
         size_t rowBytes[SkYUVAPixmapInfo::kMaxPlanes];
@@ -829,15 +834,16 @@
     return true;
 }
 
-bool SkJpegCodec::onQueryYUVAInfo(SkYUVAPixmapInfo* yuvaPixmapInfo) const {
+bool SkJpegCodec::onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes& supportedDataTypes,
+                                  SkYUVAPixmapInfo* yuvaPixmapInfo) const {
     jpeg_decompress_struct* dinfo = fDecoderMgr->dinfo();
-    return is_yuv_supported(dinfo, *this, yuvaPixmapInfo);
+    return is_yuv_supported(dinfo, *this, &supportedDataTypes, yuvaPixmapInfo);
 }
 
 SkCodec::Result SkJpegCodec::onGetYUVAPlanes(const SkYUVAPixmaps& yuvaPixmaps) {
     // Get a pointer to the decompress info since we will use it quite frequently
     jpeg_decompress_struct* dinfo = fDecoderMgr->dinfo();
-    if (!is_yuv_supported(dinfo, *this, nullptr)) {
+    if (!is_yuv_supported(dinfo, *this, nullptr, nullptr)) {
         return fDecoderMgr->returnFailure("onGetYUVAPlanes", kInvalidInput);
     }
     // Set the jump location for libjpeg errors
@@ -860,7 +866,7 @@
         // was caused by a bug in the old code, but we'll be safe and check here.
         // Also check that pixmap properties agree with expectations.
         SkYUVAPixmapInfo info;
-        SkASSERT(is_yuv_supported(dinfo, *this,  &info));
+        SkASSERT(is_yuv_supported(dinfo, *this, nullptr, &info));
         SkASSERT(info.yuvaInfo() == yuvaPixmaps.yuvaInfo());
         for (int i = 0; i < info.numPlanes(); ++i) {
             SkASSERT(planes[i].colorType() == kAlpha_8_SkColorType);