Expand testing of color initialized backend textures to include mip levels


Bug: skia:9141
Change-Id: Ie32bc5db357907ff65045b25d5d06d0ea47b94bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217456
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 2ad45bb..3dad9b6 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1663,7 +1663,7 @@
                                        config, currentRowBytes, currentRowBytes,
                                        currentWidth, currentHeight, &color);
         } else {
-            const size_t trimRowBytes = w * bpp;
+            const size_t trimRowBytes = bpp * currentWidth;
             if (!srcRowBytes) {
                 srcRowBytes = trimRowBytes;
             }
@@ -1716,7 +1716,7 @@
         region.bufferOffset = individualMipOffsets[currentMipLevel];
         region.bufferRowLength = currentWidth;
         region.bufferImageHeight = currentHeight;
-        region.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
+        region.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, currentMipLevel, 0, 1};
         region.imageOffset = {0, 0, 0};
         region.imageExtent = {(uint32_t)currentWidth, (uint32_t)currentHeight, 1};
         currentWidth = SkTMax(1, currentWidth / 2);