Clean update ETC1 data utilities (take 2)

Change-Id: Idb84867cf1a701bd2f0ffff863fd78c3caf0739e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217376
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDataUtils.cpp b/src/gpu/GrDataUtils.cpp
index 4815714..b03a79a 100644
--- a/src/gpu/GrDataUtils.cpp
+++ b/src/gpu/GrDataUtils.cpp
@@ -10,6 +10,11 @@
 #include "include/private/GrColor.h"
 #include "src/core/SkUtils.h"
 
+struct ETC1Block {
+    uint32_t fHigh;
+    uint32_t fLow;
+};
+
 static const int kNumModifierTables = 8;
 static const int kNumPixelIndices = 4;
 
@@ -88,7 +93,7 @@
     }
 }
 
-int GrNumETC1Blocks(int w, int h) {
+static int num_ETC1_blocks(int w, int h) {
     if (w < 4) {
         w = 1;
     } else {
@@ -106,12 +111,20 @@
     return w * h;
 }
 
-void GrFillInETC1WithColor(const SkColor4f& colorf, void* dest, int numBlocks) {
+size_t GrETC1CompressedDataSize(int width, int height) {
+    int numBlocks = num_ETC1_blocks(width, height);
+
+    return numBlocks * sizeof(ETC1Block);
+}
+
+void GrFillInETC1WithColor(int width, int height, const SkColor4f& colorf, void* dest) {
     SkColor color = colorf.toSkColor();
 
     ETC1Block block;
     create_etc1_block(color, &block);
 
+    int numBlocks = num_ETC1_blocks(width, height);
+
     for (int i = 0; i < numBlocks; ++i) {
         ((ETC1Block*)dest)[i] = block;
     }