Move uses of functions taking SkColorType to GrColorType versions in GrCaps.

Change-Id: I4feda6277cf14be0d32a8ce22257902483d7ae1a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225734
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 6bf0b2c..4f4e931 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -96,7 +96,7 @@
                                                                              false);
 
     GrPixelConfig pixelConfig = context->priv().caps()->getConfigFromBackendFormat(
-            backendFormat, this->getInfo().colorType());
+            backendFormat, SkColorTypeToGrColorType(this->getInfo().colorType()));
 
     if (pixelConfig == kUnknown_GrPixelConfig) {
         return nullptr;
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 6320809..c673053 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -56,7 +56,8 @@
         return nullptr;
     }
     backendTexture.fConfig =
-            context->priv().caps()->getConfigFromBackendFormat(backendFormat, colorType);
+            context->priv().caps()->getConfigFromBackendFormat(backendFormat,
+                                                               SkColorTypeToGrColorType(colorType));
     if (backendTexture.fConfig == kUnknown_GrPixelConfig) {
         return nullptr;
     }
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 75cb089..8871092 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -369,8 +369,8 @@
     return true;
 }
 
-GrBackendFormat GrCaps::getBackendFormatFromColorType(SkColorType ct) const {
-    return this->getBackendFormatFromGrColorType(SkColorTypeToGrColorType(ct), GrSRGBEncoded::kNo);
+GrBackendFormat GrCaps::getBackendFormatFromColorType(GrColorType ct) const {
+    return this->getBackendFormatFromColorType(ct, GrSRGBEncoded::kNo);
 }
 
 GrCaps::SupportedRead GrCaps::supportedReadPixelsColorType(GrPixelConfig config,
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index ac353f5..c39a1d7 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -360,33 +360,26 @@
     virtual GrPixelConfig validateBackendRenderTarget(const GrBackendRenderTarget&,
                                                       GrColorType) const = 0;
 
-    bool areColorTypeAndFormatCompatible(SkColorType skCT,
+    bool areColorTypeAndFormatCompatible(GrColorType grCT,
                                          const GrBackendFormat& format) const {
-        GrColorType grCT = SkColorTypeToGrColorType(skCT);
         if (GrColorType::kUnknown == grCT) {
             return false;
         }
 
-        return this->areColorTypeAndFormatCompatible(grCT, format);
-    }
-
-    virtual bool areColorTypeAndFormatCompatible(GrColorType ct, const GrBackendFormat&) const = 0;
-
-    GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat& format,
-                                             SkColorType skCT) const {
-        GrColorType grCT = SkColorTypeToGrColorType(skCT);
-        if (GrColorType::kUnknown == grCT) {
-            return kUnknown_GrPixelConfig;
-        }
-
-        return this->getConfigFromBackendFormat(format, grCT);
+        return this->onAreColorTypeAndFormatCompatible(grCT, format);
     }
 
     // TODO: replace validateBackendRenderTarget with calls to getConfigFromBackendFormat?
     // TODO: it seems like we could pass the full SkImageInfo and validate its colorSpace too
     // Returns kUnknown if a valid config could not be determined.
-    virtual GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat& format,
-                                                     GrColorType ct) const = 0;
+    GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat& format,
+                                             GrColorType grCT) const {
+        if (GrColorType::kUnknown == grCT) {
+            return kUnknown_GrPixelConfig;
+        }
+
+        return this->onGetConfigFromBackendFormat(format, grCT);
+    }
 
     /**
      * Special method only for YUVA images. Returns a config that matches the backend format or
@@ -395,9 +388,9 @@
     virtual GrPixelConfig getYUVAConfigFromBackendFormat(const GrBackendFormat& format) const = 0;
 
     /** These are used when creating a new texture internally. */
-    virtual GrBackendFormat getBackendFormatFromGrColorType(GrColorType ct,
-                                                            GrSRGBEncoded srgbEncoded) const = 0;
-    GrBackendFormat getBackendFormatFromColorType(SkColorType ct) const;
+    virtual GrBackendFormat getBackendFormatFromColorType(GrColorType ct,
+                                                          GrSRGBEncoded srgbEncoded) const = 0;
+    GrBackendFormat getBackendFormatFromColorType(GrColorType ct) const;
 
     virtual GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const = 0;
 
@@ -510,6 +503,12 @@
         return true;
     }
 
+    virtual GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat& format,
+                                                       GrColorType ct) const = 0;
+
+    virtual bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const = 0;
+
+
     bool fSuppressPrints : 1;
     bool fWireframeMode  : 1;
 
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 6e455d5..3c282d5 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -495,7 +495,7 @@
         desc.fConfig = kAlpha_8_GrPixelConfig;
 
         GrBackendFormat format =
-                context->priv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
+                context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
 
         // MDB TODO: We're going to fill this proxy with an ASAP upload (which is out of order wrt
         // to ops), so it can't have any pending IO.
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 604eab0..43f8319 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -355,7 +355,8 @@
         return GrBackendTexture();
     }
 
-    GrBackendFormat format = this->caps()->getBackendFormatFromColorType(colorType);
+    GrBackendFormat format =
+            this->caps()->getBackendFormatFromColorType(SkColorTypeToGrColorType(colorType));
     if (!format.isValid()) {
         return GrBackendTexture();
     }
@@ -383,7 +384,8 @@
         return {};
     }
 
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(c.colorType());
+    const GrBackendFormat format =
+            caps->getBackendFormatFromColorType(SkColorTypeToGrColorType(c.colorType()));
     if (!format.isValid()) {
         return GrBackendTexture();
     }
@@ -422,7 +424,8 @@
         return {};
     }
 
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(c.colorType());
+    const GrBackendFormat format =
+            caps->getBackendFormatFromColorType(SkColorTypeToGrColorType(c.colorType()));
     if (!format.isValid()) {
         return GrBackendTexture();
     }
@@ -478,7 +481,8 @@
         return GrBackendTexture();
     }
 
-    GrBackendFormat format = this->caps()->getBackendFormatFromColorType(colorType);
+    GrBackendFormat format =
+            this->caps()->getBackendFormatFromColorType(SkColorTypeToGrColorType(colorType));
     if (!format.isValid()) {
         return GrBackendTexture();
     }
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index e0bb319..47e481b 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -416,7 +416,8 @@
         }
     }
 
-    GrBackendFormat backendFormat = this->caps()->getBackendFormatFromColorType(colorType);
+    GrBackendFormat backendFormat =
+            this->caps()->getBackendFormatFromColorType(SkColorTypeToGrColorType(colorType));
     if (!backendFormat.isValid()) {
         return {};
     }
diff --git a/src/gpu/GrContextThreadSafeProxy.cpp b/src/gpu/GrContextThreadSafeProxy.cpp
index 920d6fb..f01e8d6 100644
--- a/src/gpu/GrContextThreadSafeProxy.cpp
+++ b/src/gpu/GrContextThreadSafeProxy.cpp
@@ -55,7 +55,7 @@
 
     GrColorType grColorType = SkColorTypeToGrColorType(ii.colorType());
 
-    if (!this->caps()->areColorTypeAndFormatCompatible(ii.colorType(), backendFormat)) {
+    if (!this->caps()->areColorTypeAndFormatCompatible(grColorType, backendFormat)) {
         return SkSurfaceCharacterization(); // return an invalid characterization
     }
 
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 24bcb0a..25d8839 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -213,7 +213,7 @@
     SkColorType ct = info.colorType();
     GrColorType grCT = SkColorTypeToGrColorType(ct);
 
-    GrBackendFormat format = this->caps()->getBackendFormatFromColorType(ct);
+    GrBackendFormat format = this->caps()->getBackendFormatFromColorType(grCT);
     if (!format.isValid()) {
         return nullptr;
     }
@@ -227,7 +227,8 @@
         copy8888.setImmutable();
         srcImage = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode);
         ct = kRGBA_8888_SkColorType;
-        format = this->caps()->getBackendFormatFromColorType(ct);
+        grCT = GrColorType::kRGBA_8888;
+        format = this->caps()->getBackendFormatFromColorType(grCT);
         if (!format.isValid()) {
             return nullptr;
         }
@@ -331,9 +332,8 @@
                                         SkBudgeted::kYes, SkBackingFit::kExact);
     }
 
-    SkColorType colorType = bitmap.info().colorType();
-    GrColorType grColorType = SkColorTypeToGrColorType(colorType);
-    GrBackendFormat format = this->caps()->getBackendFormatFromColorType(colorType);
+    GrColorType grColorType = SkColorTypeToGrColorType(bitmap.info().colorType());
+    GrBackendFormat format = this->caps()->getBackendFormatFromColorType(grColorType);
     if (!format.isValid()) {
         return nullptr;
     }
@@ -348,8 +348,8 @@
         copy8888.setImmutable();
         baseLevel = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode);
         desc.fConfig = kRGBA_8888_GrPixelConfig;
-        colorType = kRGBA_8888_SkColorType;
-        format = this->caps()->getBackendFormatFromColorType(colorType);
+        grColorType = GrColorType::kRGBA_8888;
+        format = this->caps()->getBackendFormatFromColorType(grColorType);
         if (!format.isValid()) {
             return nullptr;
         }
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 6cfd49c..f676f01 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -214,7 +214,7 @@
         return nullptr;
     }
 
-    auto format = this->caps()->getBackendFormatFromGrColorType(colorType, GrSRGBEncoded::kNo);
+    auto format = this->caps()->getBackendFormatFromColorType(colorType, GrSRGBEncoded::kNo);
     if (!format.isValid()) {
         return nullptr;
     }
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index e45d479..22b359b 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1745,9 +1745,9 @@
     GrPixelConfig configOfFinalContext = fRenderTargetProxy->config();
     auto backendFormatOfFinalContext = fRenderTargetProxy->backendFormat();
     if (needsRescale) {
-        backendFormatOfFinalContext = this->caps()->getBackendFormatFromColorType(info.colorType());
+        backendFormatOfFinalContext = this->caps()->getBackendFormatFromColorType(dstCT);
         configOfFinalContext = this->caps()->getConfigFromBackendFormat(backendFormatOfFinalContext,
-                                                                        info.colorType());
+                                                                        dstCT);
     }
     auto readInfo = this->caps()->supportedReadPixelsColorType(configOfFinalContext,
                                                                backendFormatOfFinalContext, dstCT);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 578fd7c..1811154 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -182,7 +182,7 @@
     desc.fConfig = kAlpha_8_GrPixelConfig;
 
     const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
+            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
 
     return proxyProvider->createProxy(format, desc, kTopLeft_GrSurfaceOrigin, fit,
                                       SkBudgeted::kYes);
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index a3dd91a..708002e 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -288,7 +288,7 @@
         if (canvas2DFastPath) {
             desc.fConfig = kRGBA_8888_GrPixelConfig;
             colorType = GrColorType::kRGBA_8888;
-            format = caps->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
+            format = caps->getBackendFormatFromColorType(colorType);
             alphaType = kUnpremul_SkAlphaType;
         } else {
             desc.fConfig =  dstProxy->config();
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 3095939..bcf9bc1 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -79,7 +79,7 @@
     GrColorType colorType = (CoverageType::kFP16_CoverageCount == fCoverageType)
             ? GrColorType::kAlpha_F16 : GrColorType::kAlpha_8;
     const GrBackendFormat format =
-            caps.getBackendFormatFromGrColorType(colorType, GrSRGBEncoded::kNo);
+            caps.getBackendFormatFromColorType(colorType, GrSRGBEncoded::kNo);
     GrPixelConfig pixelConfig = (CoverageType::kFP16_CoverageCount == fCoverageType)
             ? kAlpha_half_GrPixelConfig : kAlpha_8_GrPixelConfig;
 
diff --git a/src/gpu/ccpr/GrCCClipPath.cpp b/src/gpu/ccpr/GrCCClipPath.cpp
index fc73699..574d744 100644
--- a/src/gpu/ccpr/GrCCClipPath.cpp
+++ b/src/gpu/ccpr/GrCCClipPath.cpp
@@ -16,8 +16,8 @@
                         int rtHeight, const GrCaps& caps) {
     SkASSERT(!this->isInitialized());
 
-    const GrBackendFormat format = caps.getBackendFormatFromGrColorType(GrColorType::kAlpha_F16,
-                                                                        GrSRGBEncoded::kNo);
+    const GrBackendFormat format = caps.getBackendFormatFromColorType(GrColorType::kAlpha_F16,
+                                                                      GrSRGBEncoded::kNo);
 
     fAtlasLazyProxy = GrProxyProvider::MakeFullyLazyProxy(
             [this](GrResourceProvider* resourceProvider)
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index f28ad2a..22e81ee 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -3835,8 +3835,8 @@
     return validate_sized_format(fbInfo.fFormat, ct, fStandard);
 }
 
-bool GrGLCaps::areColorTypeAndFormatCompatible(GrColorType ct,
-                                               const GrBackendFormat& format) const {
+bool GrGLCaps::onAreColorTypeAndFormatCompatible(GrColorType ct,
+                                                 const GrBackendFormat& format) const {
     const GrGLenum* glFormat = format.getGLFormat();
     if (!glFormat) {
         return false;
@@ -3845,8 +3845,8 @@
     return kUnknown_GrPixelConfig != validate_sized_format(*glFormat, ct, fStandard);
 }
 
-GrPixelConfig GrGLCaps::getConfigFromBackendFormat(const GrBackendFormat& format,
-                                                   GrColorType ct) const {
+GrPixelConfig GrGLCaps::onGetConfigFromBackendFormat(const GrBackendFormat& format,
+                                                     GrColorType ct) const {
     const GrGLenum* glFormat = format.getGLFormat();
     if (!glFormat) {
         return kUnknown_GrPixelConfig;
@@ -3908,8 +3908,8 @@
     return get_yuva_config(*glFormat);
 }
 
-GrBackendFormat GrGLCaps::getBackendFormatFromGrColorType(GrColorType ct,
-                                                          GrSRGBEncoded srgbEncoded) const {
+GrBackendFormat GrGLCaps::getBackendFormatFromColorType(GrColorType ct,
+                                                        GrSRGBEncoded srgbEncoded) const {
     GrPixelConfig config = GrColorTypeToPixelConfig(ct, srgbEncoded);
     if (config == kUnknown_GrPixelConfig) {
         return GrBackendFormat();
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index c6fc099..be1ceaf 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -423,13 +423,10 @@
     GrPixelConfig validateBackendRenderTarget(const GrBackendRenderTarget&,
                                               GrColorType) const override;
 
-    bool areColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
-
-    GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
     GrPixelConfig getYUVAConfigFromBackendFormat(const GrBackendFormat&) const override;
 
-    GrBackendFormat getBackendFormatFromGrColorType(GrColorType ct,
-                                                    GrSRGBEncoded srgbEncoded) const override;
+    GrBackendFormat getBackendFormatFromColorType(GrColorType ct,
+                                                  GrSRGBEncoded srgbEncoded) const override;
     GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
 
     GrSwizzle getTextureSwizzle(const GrBackendFormat&, GrColorType) const override;
@@ -483,6 +480,8 @@
     bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
                           const SkIRect& srcRect, const SkIPoint& dstPoint) const override;
     size_t onTransferFromOffsetAlignment(GrColorType bufferColorType) const override;
+    GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
+    bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
 
     bool isGLFormatTexturable(GrColorType, GrGLenum glFormat) const;
     bool glFormatSupportsTexStorage(GrGLenum glFormat) const;
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index 91116ab..601988c 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -124,8 +124,62 @@
         return kUnknown_GrPixelConfig;
     }
 
-    bool areColorTypeAndFormatCompatible(GrColorType ct,
-                                         const GrBackendFormat& format) const override {
+    GrPixelConfig getYUVAConfigFromBackendFormat(const GrBackendFormat& format) const override {
+        const GrPixelConfig* mockFormat = format.getMockFormat();
+        if (!mockFormat) {
+            return kUnknown_GrPixelConfig;
+        }
+        return *mockFormat;
+    }
+
+    GrBackendFormat getBackendFormatFromColorType(GrColorType ct,
+                                                  GrSRGBEncoded srgbEncoded) const override {
+        GrPixelConfig config = GrColorTypeToPixelConfig(ct, srgbEncoded);
+        if (config == kUnknown_GrPixelConfig) {
+            return GrBackendFormat();
+        }
+        return GrBackendFormat::MakeMock(config);
+    }
+
+    GrBackendFormat getBackendFormatFromCompressionType(
+            SkImage::CompressionType compressionType) const override {
+        switch (compressionType) {
+            case SkImage::kETC1_CompressionType:
+                return GrBackendFormat::MakeMock(kRGB_ETC1_GrPixelConfig);
+        }
+        SK_ABORT("Invalid compression type");
+        return {};
+    }
+
+    GrSwizzle getTextureSwizzle(const GrBackendFormat&, GrColorType) const override {
+        return GrSwizzle();
+    }
+    GrSwizzle getOutputSwizzle(const GrBackendFormat&, GrColorType) const override {
+        return GrSwizzle();
+    }
+
+private:
+    bool onSurfaceSupportsWritePixels(const GrSurface*) const override { return true; }
+    bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
+                          const SkIRect& srcRect, const SkIPoint& dstPoint) const override {
+        return true;
+    }
+    size_t onTransferFromOffsetAlignment(GrColorType bufferColorType) const override {
+        // arbitrary
+        return GrSizeAlignUp(GrColorTypeBytesPerPixel(bufferColorType), 4);
+    }
+
+    GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat& format,
+                                               GrColorType) const override {
+        const GrPixelConfig* mockFormat = format.getMockFormat();
+        if (!mockFormat) {
+            return kUnknown_GrPixelConfig;
+        }
+        return *mockFormat;
+    }
+
+    bool onAreColorTypeAndFormatCompatible(GrColorType ct,
+                                           const GrBackendFormat& format) const override {
         const GrPixelConfig* mockFormat = format.getMockFormat();
         if (!mockFormat) {
             return kUnknown_GrPixelConfig;
@@ -234,59 +288,7 @@
         return false;
     }
 
-    GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat& format,
-                                             GrColorType) const override {
-        const GrPixelConfig* mockFormat = format.getMockFormat();
-        if (!mockFormat) {
-            return kUnknown_GrPixelConfig;
-        }
-        return *mockFormat;
-    }
 
-    GrPixelConfig getYUVAConfigFromBackendFormat(const GrBackendFormat& format) const override {
-        const GrPixelConfig* mockFormat = format.getMockFormat();
-        if (!mockFormat) {
-            return kUnknown_GrPixelConfig;
-        }
-        return *mockFormat;
-    }
-
-    GrBackendFormat getBackendFormatFromGrColorType(GrColorType ct,
-                                                    GrSRGBEncoded srgbEncoded) const override {
-        GrPixelConfig config = GrColorTypeToPixelConfig(ct, srgbEncoded);
-        if (config == kUnknown_GrPixelConfig) {
-            return GrBackendFormat();
-        }
-        return GrBackendFormat::MakeMock(config);
-    }
-
-    GrBackendFormat getBackendFormatFromCompressionType(
-            SkImage::CompressionType compressionType) const override {
-        switch (compressionType) {
-            case SkImage::kETC1_CompressionType:
-                return GrBackendFormat::MakeMock(kRGB_ETC1_GrPixelConfig);
-        }
-        SK_ABORT("Invalid compression type");
-        return {};
-    }
-
-    GrSwizzle getTextureSwizzle(const GrBackendFormat&, GrColorType) const override {
-        return GrSwizzle();
-    }
-    GrSwizzle getOutputSwizzle(const GrBackendFormat&, GrColorType) const override {
-        return GrSwizzle();
-    }
-
-private:
-    bool onSurfaceSupportsWritePixels(const GrSurface*) const override { return true; }
-    bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
-                          const SkIRect& srcRect, const SkIPoint& dstPoint) const override {
-        return true;
-    }
-    size_t onTransferFromOffsetAlignment(GrColorType bufferColorType) const override {
-        // arbitrary
-        return GrSizeAlignUp(GrColorTypeBytesPerPixel(bufferColorType), 4);
-    }
 
     static const int kMaxSampleCnt = 16;
 
diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h
index 38b9701..04b5213 100644
--- a/src/gpu/mtl/GrMtlCaps.h
+++ b/src/gpu/mtl/GrMtlCaps.h
@@ -67,14 +67,10 @@
     GrPixelConfig validateBackendRenderTarget(const GrBackendRenderTarget&,
                                               GrColorType) const override;
 
-    bool areColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
-
-    GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
-
     GrPixelConfig getYUVAConfigFromBackendFormat(const GrBackendFormat&) const override;
 
-    GrBackendFormat getBackendFormatFromGrColorType(GrColorType ct,
-                                                    GrSRGBEncoded srgbEncoded) const override;
+    GrBackendFormat getBackendFormatFromColorType(GrColorType ct,
+                                                  GrSRGBEncoded srgbEncoded) const override;
     GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
 
     GrSwizzle getTextureSwizzle(const GrBackendFormat&, GrColorType) const override;
@@ -97,6 +93,8 @@
         // Transfer buffers not yet supported.
         return 0;
     }
+    GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
+    bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
 
     struct ConfigInfo {
         ConfigInfo() : fFlags(0) {}
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index 8703117..ea5de88 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -618,8 +618,8 @@
     return validate_sized_format(texture.pixelFormat, ct);
 }
 
-bool GrMtlCaps::areColorTypeAndFormatCompatible(GrColorType ct,
-                                                const GrBackendFormat& format) const {
+bool GrMtlCaps::onAreColorTypeAndFormatCompatible(GrColorType ct,
+                                                  const GrBackendFormat& format) const {
     const GrMTLPixelFormat* mtlFormat = format.getMtlFormat();
     if (!mtlFormat) {
         return false;
@@ -629,8 +629,8 @@
 }
 
 
-GrPixelConfig GrMtlCaps::getConfigFromBackendFormat(const GrBackendFormat& format,
-                                                    GrColorType ct) const {
+GrPixelConfig GrMtlCaps::onGetConfigFromBackendFormat(const GrBackendFormat& format,
+                                                      GrColorType ct) const {
     const GrMTLPixelFormat* mtlFormat = format.getMtlFormat();
     if (!mtlFormat) {
         return kUnknown_GrPixelConfig;
@@ -687,8 +687,8 @@
     return get_yuva_config(*mtlFormat);
 }
 
-GrBackendFormat GrMtlCaps::getBackendFormatFromGrColorType(GrColorType ct,
-                                                           GrSRGBEncoded srgbEncoded) const {
+GrBackendFormat GrMtlCaps::getBackendFormatFromColorType(GrColorType ct,
+                                                         GrSRGBEncoded srgbEncoded) const {
     GrPixelConfig config = GrColorTypeToPixelConfig(ct, srgbEncoded);
     if (config == kUnknown_GrPixelConfig) {
         return GrBackendFormat();
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 96c9a72..432f01c 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -407,7 +407,7 @@
     GrSurfaceOrigin origin =
             random->nextBool() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
     const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
+            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
     auto proxy = context->priv().proxyProvider()->createProxy(
             format, desc, origin, SkBackingFit::kExact, SkBudgeted::kYes);
 
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index f148ce0..c9c3d08 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -876,7 +876,7 @@
     if (!fAtlas) {
         const GrBackendFormat format =
                 args.fContext->priv().caps()->getBackendFormatFromColorType(
-                        kAlpha_8_SkColorType);
+                        GrColorType::kAlpha_8);
         fAtlas = GrDrawOpAtlas::Make(args.fContext->priv().proxyProvider(),
                                      format,
                                      GrColorType::kAlpha_8,
@@ -966,7 +966,7 @@
         gTestStruct.fContextID = context->priv().contextID();
         gTestStruct.reset();
         const GrBackendFormat format =
-                context->priv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
+                context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
         gTestStruct.fAtlas = GrDrawOpAtlas::Make(context->priv().proxyProvider(),
                                                  format, GrColorType::kAlpha_8,
                                                  ATLAS_TEXTURE_WIDTH, ATLAS_TEXTURE_HEIGHT,
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 0544fc1..f88dd36 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -690,7 +690,7 @@
     }
 
     const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
+            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
 
     GrProxyProvider* proxyProvider = context->priv().proxyProvider();
     sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format, desc, origin, mipMapped, fit,
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index 5ca8495..f3696d7 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -166,8 +166,8 @@
         SkISize atlasDimensions = fAtlasConfig.atlasDimensions(format);
         SkISize plotDimensions = fAtlasConfig.plotDimensions(format);
 
-        const GrBackendFormat format = fCaps->getBackendFormatFromGrColorType(grColorType,
-                                                                              GrSRGBEncoded::kNo);
+        const GrBackendFormat format = fCaps->getBackendFormatFromColorType(grColorType,
+                                                                            GrSRGBEncoded::kNo);
 
         fAtlases[index] = GrDrawOpAtlas::Make(
                 fProxyProvider, format, grColorType,
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index c2df040..85229c3 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -1065,8 +1065,8 @@
     return validate_image_info(imageInfo.fFormat, ct, imageInfo.fYcbcrConversionInfo.isValid());
 }
 
-bool GrVkCaps::areColorTypeAndFormatCompatible(GrColorType ct,
-                                               const GrBackendFormat& format) const {
+bool GrVkCaps::onAreColorTypeAndFormatCompatible(GrColorType ct,
+                                                 const GrBackendFormat& format) const {
     const VkFormat* vkFormat = format.getVkFormat();
     const GrVkYcbcrConversionInfo* ycbcrInfo = format.getVkYcbcrConversionInfo();
     if (!vkFormat || !ycbcrInfo) {
@@ -1077,8 +1077,8 @@
 }
 
 
-GrPixelConfig GrVkCaps::getConfigFromBackendFormat(const GrBackendFormat& format,
-                                                   GrColorType ct) const {
+GrPixelConfig GrVkCaps::onGetConfigFromBackendFormat(const GrBackendFormat& format,
+                                                     GrColorType ct) const {
     const VkFormat* vkFormat = format.getVkFormat();
     const GrVkYcbcrConversionInfo* ycbcrInfo = format.getVkYcbcrConversionInfo();
     if (!vkFormat || !ycbcrInfo) {
@@ -1123,8 +1123,8 @@
     return get_yuva_config(*vkFormat);
 }
 
-GrBackendFormat GrVkCaps::getBackendFormatFromGrColorType(GrColorType ct,
-                                                          GrSRGBEncoded srgbEncoded) const {
+GrBackendFormat GrVkCaps::getBackendFormatFromColorType(GrColorType ct,
+                                                        GrSRGBEncoded srgbEncoded) const {
     GrPixelConfig config = GrColorTypeToPixelConfig(ct, srgbEncoded);
     if (config == kUnknown_GrPixelConfig) {
         return GrBackendFormat();
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index 8cb75f4..e1dc4c3 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -164,13 +164,10 @@
     GrPixelConfig validateBackendRenderTarget(const GrBackendRenderTarget&,
                                               GrColorType) const override;
 
-    bool areColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
-
-    GrPixelConfig getConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
     GrPixelConfig getYUVAConfigFromBackendFormat(const GrBackendFormat&) const override;
 
-    GrBackendFormat getBackendFormatFromGrColorType(GrColorType ct,
-                                                    GrSRGBEncoded srgbEncoded) const override;
+    GrBackendFormat getBackendFormatFromColorType(GrColorType ct,
+                                                  GrSRGBEncoded srgbEncoded) const override;
     GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
 
     GrSwizzle getTextureSwizzle(const GrBackendFormat&, GrColorType) const override;
@@ -209,6 +206,9 @@
                           const SkIRect& srcRect, const SkIPoint& dstPoint) const override;
     size_t onTransferFromOffsetAlignment(GrColorType bufferColorType) const override;
 
+    GrPixelConfig onGetConfigFromBackendFormat(const GrBackendFormat&, GrColorType) const override;
+    bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
+
     struct FormatInfo {
         FormatInfo() : fOptimalFlags(0), fLinearFlags(0) {}
 
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 3533b39..2c74b90 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1320,14 +1320,14 @@
     if (!backendFormat.isValid()) {
         return nullptr;
     }
+    GrColorType grColorType = SkColorTypeToGrColorType(imageInfo.colorType());
     int sampleCnt = this->caps()->getRenderTargetSampleCount(1, imageInfo.colorType(),
                                                              backendFormat);
     if (!sampleCnt) {
         return nullptr;
     }
 
-    GrPixelConfig config = this->caps()->getConfigFromBackendFormat(backendFormat,
-                                                                    imageInfo.colorType());
+    GrPixelConfig config = this->caps()->getConfigFromBackendFormat(backendFormat, grColorType);
     if (config == kUnknown_GrPixelConfig) {
         return nullptr;
     }