Make read/write/transfer pixels functions take surface color type

Bug: skia:6718
Change-Id: I9cac1b9dc8c04969719c79b7b7ce10c18fb428d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231563
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index efac602..8fd5f59 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -66,23 +66,25 @@
 
 class TransferFrom : public GrVkPrimaryCommandBufferTask {
 public:
-    TransferFrom(const SkIRect& srcRect, GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
-                 size_t offset)
+    TransferFrom(const SkIRect& srcRect, GrColorType surfaceColorType, GrColorType bufferColorType,
+                 GrGpuBuffer* transferBuffer, size_t offset)
             : fTransferBuffer(sk_ref_sp(transferBuffer))
             , fOffset(offset)
             , fSrcRect(srcRect)
+            , fSurfaceColorType(surfaceColorType)
             , fBufferColorType(bufferColorType) {}
 
     void execute(const Args& args) override {
         args.fGpu->transferPixelsFrom(args.fSurface, fSrcRect.fLeft, fSrcRect.fTop,
-                                      fSrcRect.width(), fSrcRect.height(), fBufferColorType,
-                                      fTransferBuffer.get(), fOffset);
+                                      fSrcRect.width(), fSrcRect.height(), fSurfaceColorType,
+                                      fBufferColorType, fTransferBuffer.get(), fOffset);
     }
 
 private:
     sk_sp<GrGpuBuffer> fTransferBuffer;
     size_t fOffset;
     SkIRect fSrcRect;
+    GrColorType fSurfaceColorType;
     GrColorType fBufferColorType;
 };
 
@@ -96,9 +98,11 @@
     fTasks.emplace<Copy>(src, srcRect, dstPoint, false);
 }
 
-void GrVkGpuTextureCommandBuffer::transferFrom(const SkIRect& srcRect, GrColorType bufferColorType,
+void GrVkGpuTextureCommandBuffer::transferFrom(const SkIRect& srcRect, GrColorType surfaceColorType,
+                                               GrColorType bufferColorType,
                                                GrGpuBuffer* transferBuffer, size_t offset) {
-    fTasks.emplace<TransferFrom>(srcRect, bufferColorType, transferBuffer, offset);
+    fTasks.emplace<TransferFrom>(srcRect, surfaceColorType, bufferColorType, transferBuffer,
+                                 offset);
 }
 
 void GrVkGpuTextureCommandBuffer::insertEventMarker(const char* msg) {
@@ -621,13 +625,15 @@
     }
 }
 
-void GrVkGpuRTCommandBuffer::transferFrom(const SkIRect& srcRect, GrColorType bufferColorType,
-                                          GrGpuBuffer* transferBuffer, size_t offset) {
+void GrVkGpuRTCommandBuffer::transferFrom(const SkIRect& srcRect, GrColorType surfaceColorType,
+                                          GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
+                                          size_t offset) {
     CommandBufferInfo& cbInfo = fCommandBufferInfos[fCurrentCmdInfo];
     if (!cbInfo.fIsEmpty) {
         this->addAdditionalRenderPass();
     }
-    fPreCommandBufferTasks.emplace<TransferFrom>(srcRect, bufferColorType, transferBuffer, offset);
+    fPreCommandBufferTasks.emplace<TransferFrom>(srcRect, surfaceColorType, bufferColorType,
+                                                 transferBuffer, offset);
     ++fCommandBufferInfos[fCurrentCmdInfo].fNumPreCmds;
 }