Revise GrDataUtils to be more self-contained (take 3)

This makes the GL and Vk backends share more code and sets up for the Metal implementation.

Change-Id: I781d5b6188fb2d46ae4ec48204fda74fe28b18c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218964
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDataUtils.h b/src/gpu/GrDataUtils.h
index bdcbd66..b79e84c 100644
--- a/src/gpu/GrDataUtils.h
+++ b/src/gpu/GrDataUtils.h
@@ -11,15 +11,26 @@
 #include "include/core/SkColor.h"
 #include "include/private/GrTypesPriv.h"
 
-// Fill in the width x height 'dest' with the munged version of 'color' that matches 'config'
-bool GrFillBufferWithColor(GrPixelConfig config, int width, int height,
-                           const SkColor4f& color, void* dest);
-
 // TODO: consolidate all the backend-specific flavors of this method to this
 size_t GrETC1CompressedDataSize(int w, int h);
 
-// Fill in 'dest' with ETC1 blocks derived from 'color'
-void GrFillInETC1WithColor(int width, int height,
-                           const SkColor4f& color, void* dest);
+// TODO: should this be grown into a replacement for GrPixelConfig?
+enum class GrCompression {
+    kNone,
+    kETC1,
+};
+
+// Compute the size of the buffer required to hold all the mipLevels of the specified type
+// of data when all rowBytes are tight.
+// Note there may still be padding between the mipLevels to meet alignment requirements.
+size_t GrComputeTightCombinedBufferSize(GrCompression, size_t bytesPerPixel,
+                                        int baseWidth, int baseHeight,
+                                        SkTArray<size_t>* individualMipOffsets,
+                                        int mipLevelCount);
+
+void GrFillInData(GrCompression, GrPixelConfig,
+                  int baseWidth, int baseHeight,
+                  const SkTArray<size_t>& individualMipOffsets,
+                  char* dest, const SkColor4f& color);
 
 #endif