Clean up some "const SkISize& dimensions" usages w/in Ganesh

This is pulled out of the parameter reordering CL - which has become too large.

Change-Id: Id36875dd4a670611ab94a08a3a6df41c474e9022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266217
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/dawn/GrDawnCaps.cpp b/src/gpu/dawn/GrDawnCaps.cpp
index 4e6b1f3..cb4323a 100644
--- a/src/gpu/dawn/GrDawnCaps.cpp
+++ b/src/gpu/dawn/GrDawnCaps.cpp
@@ -130,12 +130,8 @@
 
 GrBackendFormat GrDawnCaps::onGetDefaultBackendFormat(GrColorType ct,
                                                       GrRenderable renderable) const {
-    GrPixelConfig config = GrColorTypeToPixelConfig(ct);
-    if (config == kUnknown_GrPixelConfig) {
-        return GrBackendFormat();
-    }
     wgpu::TextureFormat format;
-    if (!GrPixelConfigToDawnFormat(config, &format)) {
+    if (!GrColorTypeToDawnFormat(ct, &format)) {
         return GrBackendFormat();
     }
     return GrBackendFormat::MakeDawn(format);
@@ -161,7 +157,9 @@
     SkAssertResult(format.asDawnFormat(&dawnFormat));
 
     // Dawn max enum value should always fit in 32 bits.
-    SkASSERT(dawnFormat <= wgpu::WGPUTextureFormat_Force32);
+
+    // disabled: no member named 'WGPUTextureFormat_Force32' in namespace 'wgpu'
+    //SkASSERT(dawnFormat <= wgpu::WGPUTextureFormat_Force32);
     return (uint64_t)dawnFormat;
 }
 
diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp
index 815d2bd..ec2c46b 100644
--- a/src/gpu/dawn/GrDawnGpu.cpp
+++ b/src/gpu/dawn/GrDawnGpu.cpp
@@ -127,8 +127,8 @@
     if (!texture) {
         return false;
     }
-    texture->upload(texels, mipLevelCount, SkIRect::MakeXYWH(left, top, width, height),
-                    this->getCopyEncoder());
+    texture->upload(srcColorType, texels, mipLevelCount,
+                    SkIRect::MakeXYWH(left, top, width, height), this->getCopyEncoder());
     return true;
 }
 
@@ -166,7 +166,7 @@
         mipLevelCount > 1 ? GrMipMapsStatus::kDirty : GrMipMapsStatus::kNotAllocated;
 
     return GrDawnTexture::Make(this, { desc.fWidth, desc.fHeight },
-                                       desc.fConfig, format, renderable,
+                                       format, renderable,
                                        renderTargetSampleCnt, budgeted, mipLevelCount,
                                        mipMapsStatus);
 }
@@ -383,14 +383,13 @@
 
 GrBackendRenderTarget GrDawnGpu::createTestingOnlyBackendRenderTarget(int width, int height,
                                                                       GrColorType colorType) {
-    GrPixelConfig config = GrColorTypeToPixelConfig(colorType);
 
     if (width > this->caps()->maxTextureSize() || height > this->caps()->maxTextureSize()) {
         return GrBackendRenderTarget();
     }
 
     wgpu::TextureFormat format;
-    if (!GrPixelConfigToDawnFormat(config, &format)) {
+    if (!GrColorTypeToDawnFormat(colorType, &format)) {
         return GrBackendRenderTarget();
     }
 
diff --git a/src/gpu/dawn/GrDawnRenderTarget.cpp b/src/gpu/dawn/GrDawnRenderTarget.cpp
index f612e1e..94709c5 100644
--- a/src/gpu/dawn/GrDawnRenderTarget.cpp
+++ b/src/gpu/dawn/GrDawnRenderTarget.cpp
@@ -12,7 +12,7 @@
 #include "src/gpu/dawn/GrDawnUtil.h"
 
 GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu,
-                                       const SkISize& dimensions,
+                                       SkISize dimensions,
                                        int sampleCnt,
                                        const GrDawnImageInfo& info)
         : GrSurface(gpu, dimensions, GrProtected::kNo)
@@ -20,7 +20,7 @@
         , fInfo(info) {}
 
 sk_sp<GrDawnRenderTarget> GrDawnRenderTarget::MakeWrapped(GrDawnGpu* gpu,
-                                                          const SkISize& dimensions,
+                                                          SkISize dimensions,
                                                           int sampleCnt,
                                                           const GrDawnImageInfo& info) {
     sk_sp<GrDawnRenderTarget> rt(new GrDawnRenderTarget(gpu, dimensions, sampleCnt, info));
diff --git a/src/gpu/dawn/GrDawnRenderTarget.h b/src/gpu/dawn/GrDawnRenderTarget.h
index a892d84..5c7ed93 100644
--- a/src/gpu/dawn/GrDawnRenderTarget.h
+++ b/src/gpu/dawn/GrDawnRenderTarget.h
@@ -15,8 +15,10 @@
 
 class GrDawnRenderTarget: public GrRenderTarget {
 public:
-    static sk_sp<GrDawnRenderTarget> MakeWrapped(GrDawnGpu*, const SkISize& dimensions,
-                                                 int sampleCnt, const GrDawnImageInfo&);
+    static sk_sp<GrDawnRenderTarget> MakeWrapped(GrDawnGpu*,
+                                                 SkISize dimensions,
+                                                 int sampleCnt,
+                                                 const GrDawnImageInfo&);
 
     ~GrDawnRenderTarget() override;
 
@@ -30,7 +32,7 @@
 
 protected:
     GrDawnRenderTarget(GrDawnGpu* gpu,
-                       const SkISize& dimensions,
+                       SkISize dimensions,
                        int sampleCnt,
                        const GrDawnImageInfo& info);
 
diff --git a/src/gpu/dawn/GrDawnTexture.cpp b/src/gpu/dawn/GrDawnTexture.cpp
index 9dfeec6..4bbd5c2 100644
--- a/src/gpu/dawn/GrDawnTexture.cpp
+++ b/src/gpu/dawn/GrDawnTexture.cpp
@@ -13,7 +13,7 @@
 #include "src/gpu/dawn/GrDawnUtil.h"
 
 GrDawnTexture::GrDawnTexture(GrDawnGpu* gpu,
-                             const SkISize& dimensions,
+                             SkISize dimensions,
                              wgpu::TextureView textureView,
                              const GrDawnImageInfo& info,
                              GrMipMapsStatus mipMapsStatus)
@@ -22,9 +22,10 @@
         , fInfo(info)
         , fTextureView(textureView) {}
 
-sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, const SkISize& dimensions,
-                                         wgpu::TextureFormat format, GrRenderable renderable,
-                                         int sampleCnt, SkBudgeted budgeted, int mipLevels,
+sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, SkISize dimensions,
+                                         wgpu::TextureFormat format,
+                                         GrRenderable renderable, int sampleCnt,
+                                         SkBudgeted budgeted, int mipLevels,
                                          GrMipMapsStatus status) {
     bool renderTarget = renderable == GrRenderable::kYes;
     wgpu::TextureDescriptor textureDesc;
@@ -81,9 +82,10 @@
     return GrBackendFormat::MakeDawn(fInfo.fFormat);
 }
 
-sk_sp<GrDawnTexture> GrDawnTexture::MakeWrapped(GrDawnGpu* gpu, const SkISize& dimensions,
-                                                GrRenderable renderable, int sampleCnt,
-                                                GrMipMapsStatus status, GrWrapCacheable cacheable,
+sk_sp<GrDawnTexture> GrDawnTexture::MakeWrapped(GrDawnGpu* gpu, SkISize dimensions,
+                                                GrRenderable renderable,
+                                                int sampleCnt, GrMipMapsStatus status,
+                                                GrWrapCacheable cacheable,
                                                 const GrDawnImageInfo& info) {
     wgpu::TextureView textureView = info.fTexture.CreateView();
     if (!textureView) {
@@ -93,10 +95,10 @@
     sk_sp<GrDawnTexture> tex;
     if (GrRenderable::kYes == renderable) {
         tex = sk_sp<GrDawnTexture>(new GrDawnTextureRenderTarget(
-                gpu, dimensions, config, textureView, sampleCnt, info, status));
+                gpu, dimensions, textureView, sampleCnt, info, status));
     } else {
         tex = sk_sp<GrDawnTexture>(
-                new GrDawnTexture(gpu, dimensions, config, textureView, info, status));
+                new GrDawnTexture(gpu, dimensions, textureView, info, status));
     }
     tex->registerWithCacheWrapped(cacheable);
     return tex;
@@ -122,12 +124,14 @@
     return GrBackendTexture(this->width(), this->height(), fInfo);
 }
 
-void GrDawnTexture::upload(const GrMipLevel texels[], int mipLevels,
-                           wgpu::CommandEncoder copyEncoder) {
-    this->upload(texels, mipLevels, SkIRect::MakeWH(width(), height()), copyEncoder);
+void GrDawnTexture::upload(GrColorType srcColorType, const GrMipLevel texels[],
+                           int mipLevels, wgpu::CommandEncoder copyEncoder) {
+    this->upload(srcColorType, texels, mipLevels, SkIRect::MakeWH(width(), height()),
+                 copyEncoder);
 }
 
-void GrDawnTexture::upload(const GrMipLevel texels[], int mipLevels, const SkIRect& rect,
+void GrDawnTexture::upload(GrColorType srcColorType, const GrMipLevel texels[],
+                           int mipLevels, const SkIRect& rect,
                            wgpu::CommandEncoder copyEncoder) {
     wgpu::Device device = this->getDawnGpu()->device();
 
@@ -139,7 +143,7 @@
     for (int i = 0; i < mipLevels; i++) {
         const void* src = texels[i].fPixels;
         size_t srcRowBytes = texels[i].fRowBytes;
-        SkColorType colorType = GrColorTypeToSkColorType(GrPixelConfigToColorType(this->config()));
+        SkColorType colorType = GrColorTypeToSkColorType(srcColorType);
         size_t trimRowBytes = width * SkColorTypeBytesPerPixel(colorType);
         size_t dstRowBytes = GrDawnRoundRowBytes(trimRowBytes);
         size_t size = dstRowBytes * height;
diff --git a/src/gpu/dawn/GrDawnTexture.h b/src/gpu/dawn/GrDawnTexture.h
index aedcd13..1f11411 100644
--- a/src/gpu/dawn/GrDawnTexture.h
+++ b/src/gpu/dawn/GrDawnTexture.h
@@ -16,13 +16,14 @@
 
 class GrDawnTexture : public GrTexture {
 public:
-    static sk_sp<GrDawnTexture> Make(GrDawnGpu*, const SkISize& dimensions,
+    static sk_sp<GrDawnTexture> Make(GrDawnGpu*, SkISize dimensions,
                                      wgpu::TextureFormat format, GrRenderable, int sampleCnt,
                                      SkBudgeted, int mipLevels, GrMipMapsStatus);
 
-    static sk_sp<GrDawnTexture> MakeWrapped(GrDawnGpu*, const SkISize& dimensions,
-                                            GrRenderable, int sampleCnt, GrMipMapsStatus,
-                                            GrWrapCacheable, const GrDawnImageInfo&);
+    static sk_sp<GrDawnTexture> MakeWrapped(GrDawnGpu*, SkISize dimensions,
+                                            GrRenderable, int sampleCnt,
+                                            GrMipMapsStatus, GrWrapCacheable,
+                                            const GrDawnImageInfo&);
 
     ~GrDawnTexture() override;
 
@@ -31,14 +32,15 @@
 
     void textureParamsModified() override {}
 
-    void upload(const GrMipLevel texels[], int mipLevels, wgpu::CommandEncoder copyEncoder);
-    void upload(const GrMipLevel texels[], int mipLevels, const SkIRect& dstRect,
+    void upload(GrColorType, const GrMipLevel texels[], int mipLevels,
                 wgpu::CommandEncoder copyEncoder);
+    void upload(GrColorType, const GrMipLevel texels[], int mipLevels,
+                const SkIRect& dstRect, wgpu::CommandEncoder copyEncoder);
 
     wgpu::Texture texture() const { return fInfo.fTexture; }
     wgpu::TextureView textureView() const { return fTextureView; }
 protected:
-    GrDawnTexture(GrDawnGpu*, const SkISize& dimensions, wgpu::TextureView, const GrDawnImageInfo&,
+    GrDawnTexture(GrDawnGpu*, SkISize dimensions, wgpu::TextureView, const GrDawnImageInfo&,
                   GrMipMapsStatus);
 
     GrDawnGpu* getDawnGpu() const;
diff --git a/src/gpu/dawn/GrDawnTextureRenderTarget.cpp b/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
index 3a0dfac..a70b05e 100644
--- a/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
+++ b/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
@@ -13,7 +13,7 @@
 #include "src/gpu/dawn/GrDawnGpu.h"
 
 GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
-                                                     const SkISize& dimensions,
+                                                     SkISize dimensions,
                                                      wgpu::TextureView textureView,
                                                      int sampleCnt,
                                                      const GrDawnImageInfo& info,
diff --git a/src/gpu/dawn/GrDawnTextureRenderTarget.h b/src/gpu/dawn/GrDawnTextureRenderTarget.h
index 6189e6a..bc6dffc 100644
--- a/src/gpu/dawn/GrDawnTextureRenderTarget.h
+++ b/src/gpu/dawn/GrDawnTextureRenderTarget.h
@@ -22,7 +22,7 @@
 class GrDawnTextureRenderTarget : public GrDawnTexture, public GrDawnRenderTarget {
 public:
     GrDawnTextureRenderTarget(GrDawnGpu* gpu,
-                              const SkISize& dimensions,
+                              SkISize dimensions,
                               const wgpu::TextureView textureView,
                               int sampleCnt,
                               const GrDawnImageInfo& info,
diff --git a/src/gpu/dawn/GrDawnUtil.cpp b/src/gpu/dawn/GrDawnUtil.cpp
index 9ec9047..001568f 100644
--- a/src/gpu/dawn/GrDawnUtil.cpp
+++ b/src/gpu/dawn/GrDawnUtil.cpp
@@ -28,19 +28,18 @@
     return true;
 }
 
-bool GrPixelConfigToDawnFormat(GrPixelConfig config, wgpu::TextureFormat* format) {
-    switch (config) {
-        case kRGBA_8888_GrPixelConfig:
-        case kRGBA_4444_GrPixelConfig:
-        case kRGB_565_GrPixelConfig:
-        case kGray_8_GrPixelConfig:
+bool GrColorTypeToDawnFormat(GrColorType ct, wgpu::TextureFormat* format) {
+    switch (ct) {
+        case GrColorType::kRGBA_8888:
+        case GrColorType::kABGR_4444:
+        case GrColorType::kBGR_565:
+        case GrColorType::kGray_8:
             *format = wgpu::TextureFormat::RGBA8Unorm;
             return true;
-        case kBGRA_8888_GrPixelConfig:
+        case GrColorType::kBGRA_8888:
             *format = wgpu::TextureFormat::BGRA8Unorm;
             return true;
-        case kAlpha_8_GrPixelConfig:
-        case kAlpha_8_as_Red_GrPixelConfig:
+        case GrColorType::kAlpha_8:
             *format = wgpu::TextureFormat::R8Unorm;
             return true;
         default:
diff --git a/src/gpu/dawn/GrDawnUtil.h b/src/gpu/dawn/GrDawnUtil.h
index 7b14fff..a3f7df7 100644
--- a/src/gpu/dawn/GrDawnUtil.h
+++ b/src/gpu/dawn/GrDawnUtil.h
@@ -13,7 +13,7 @@
 
 size_t GrDawnBytesPerPixel(wgpu::TextureFormat format);
 bool GrDawnFormatIsRenderable(wgpu::TextureFormat format);
-bool GrPixelConfigToDawnFormat(GrPixelConfig config, wgpu::TextureFormat* format);
+bool GrColorTypeToDawnFormat(GrColorType colorType, wgpu::TextureFormat* format);
 size_t GrDawnRoundRowBytes(size_t rowBytes);
 #if GR_TEST_UTILS
 const char* GrDawnFormatToStr(wgpu::TextureFormat format);
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index bbed263a..58c255a 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1602,7 +1602,7 @@
 }
 
 GrGLuint GrGLGpu::createCompressedTexture2D(
-        const SkISize& dimensions,
+        SkISize dimensions,
         GrGLFormat format,
         GrMipMapped mipMapped,
         GrGLTextureParameters::SamplerOverriddenState* initialState,
@@ -1631,7 +1631,7 @@
     return id;
 }
 
-GrGLuint GrGLGpu::createTexture2D(const SkISize& dimensions,
+GrGLuint GrGLGpu::createTexture2D(SkISize dimensions,
                                   GrGLFormat format,
                                   GrRenderable renderable,
                                   GrGLTextureParameters::SamplerOverriddenState* initialState,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index c34251a..748eb34 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -231,13 +231,13 @@
     // returned. On failure, zero is returned.
     // The texture is populated with |texels|, if it is non-null.
     // The texture parameters are cached in |initialTexParams|.
-    GrGLuint createTexture2D(const SkISize& dimensions,
+    GrGLuint createTexture2D(SkISize dimensions,
                              GrGLFormat,
                              GrRenderable,
                              GrGLTextureParameters::SamplerOverriddenState*,
                              int mipLevelCount);
 
-    GrGLuint createCompressedTexture2D(const SkISize& dimensions,
+    GrGLuint createCompressedTexture2D(SkISize dimensions,
                                        GrGLFormat,
                                        GrMipMapped,
                                        GrGLTextureParameters::SamplerOverriddenState*,