GrColorSpaceInfo stores SkAlphaType.

This means GrSurfaceContext's know their alpha type.
All GrRenderTargetSurfaceContexts are kPremul.

Make GrTextureProducer store GrColorSpaceInfo.

Bug: skia:7580
Change-Id: I5ff321ef52c0edd32e5fac99dff95d44aa66f592
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223184
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index b3ee025..8279a30 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -17,12 +17,15 @@
 #include "src/gpu/GrSurfaceContext.h"
 #include "src/gpu/SkGr.h"
 
-static bool bmp_is_alpha_only(const SkBitmap& bm) { return kAlpha_8_SkColorType == bm.colorType(); }
+static GrColorSpaceInfo make_info(const SkBitmap& bm) {
+    return GrColorSpaceInfo(bm.alphaType(), bm.refColorSpace(),
+                            SkImageInfo2GrPixelConfig(bm.info()));
+}
 
 GrBitmapTextureMaker::GrBitmapTextureMaker(GrRecordingContext* context, const SkBitmap& bitmap,
                                            bool useDecal)
-    : INHERITED(context, bitmap.width(), bitmap.height(), bmp_is_alpha_only(bitmap), useDecal)
-    , fBitmap(bitmap) {
+        : INHERITED(context, bitmap.width(), bitmap.height(), make_info(bitmap), useDecal)
+        , fBitmap(bitmap) {
     if (!bitmap.isVolatile()) {
         SkIPoint origin = bitmap.pixelRefOrigin();
         SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(),
@@ -106,11 +109,3 @@
 void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) {
     GrInstallBitmapUniqueKeyInvalidator(copyKey, contextUniqueID, fBitmap.pixelRef());
 }
-
-SkAlphaType GrBitmapTextureMaker::alphaType() const {
-    return fBitmap.alphaType();
-}
-
-SkColorSpace* GrBitmapTextureMaker::colorSpace() const {
-    return fBitmap.colorSpace();
-}