Switch gradients from GrColor4f to SkPMColor4f

This is the most misleading use-case, because these values are either
premul or unpremul depending on the gradient's flags. It turns out that
we only need to "lie" and alias in one spot, though, so I think this is
better than adding an entirely new kUnknown_SkAlphaType specialization
of SkRGBA4f.

Bug: skia:
Change-Id: I4b7e280355219d439f50a7fe54230ea17715abc3
Reviewed-on: https://skia-review.googlesource.com/c/162745
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gradients/GrGradientBitmapCache.cpp b/src/gpu/gradients/GrGradientBitmapCache.cpp
index 9caa081..f9d0bce 100644
--- a/src/gpu/gradients/GrGradientBitmapCache.cpp
+++ b/src/gpu/gradients/GrGradientBitmapCache.cpp
@@ -125,7 +125,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 
-void GrGradientBitmapCache::fillGradient(const GrColor4f* colors, const SkScalar* positions,
+void GrGradientBitmapCache::fillGradient(const SkPMColor4f* colors, const SkScalar* positions,
                                          int count, SkColorType colorType, SkBitmap* bitmap) {
     SkHalf* pixelsF16 = reinterpret_cast<SkHalf*>(bitmap->getPixels());
     uint32_t* pixels32 = reinterpret_cast<uint32_t*>(bitmap->getPixels());
@@ -155,8 +155,8 @@
                                SkIntToScalar(fResolution - 1));
 
         if (nextIndex > prevIndex) {
-            Sk4f          c0 = Sk4f::Load(colors[i - 1].fRGBA),
-                          c1 = Sk4f::Load(colors[i    ].fRGBA);
+            Sk4f          c0 = Sk4f::Load(colors[i - 1].vec()),
+                          c1 = Sk4f::Load(colors[i    ].vec());
 
             Sk4f step = Sk4f(1.0f / static_cast<float>(nextIndex - prevIndex));
             Sk4f delta = (c1 - c0) * step;
@@ -171,11 +171,11 @@
     SkASSERT(prevIndex == fResolution - 1);
 }
 
-void GrGradientBitmapCache::getGradient(const GrColor4f* colors, const SkScalar* positions,
+void GrGradientBitmapCache::getGradient(const SkPMColor4f* colors, const SkScalar* positions,
         int count, SkColorType colorType, SkAlphaType alphaType, SkBitmap* bitmap) {
     // build our key: [numColors + colors[] + positions[] + alphaType + colorType ]
-    static_assert(sizeof(GrColor4f) % sizeof(int32_t) == 0, "");
-    const int colorsAsIntCount = count * sizeof(GrColor4f) / sizeof(int32_t);
+    static_assert(sizeof(SkPMColor4f) % sizeof(int32_t) == 0, "");
+    const int colorsAsIntCount = count * sizeof(SkPMColor4f) / sizeof(int32_t);
     int keyCount = 1 + colorsAsIntCount + 1 + 1;
     if (count > 2) {
         keyCount += count - 1;
@@ -185,7 +185,7 @@
     int32_t* buffer = storage.get();
 
     *buffer++ = count;
-    memcpy(buffer, colors, count * sizeof(GrColor4f));
+    memcpy(buffer, colors, count * sizeof(SkPMColor4f));
     buffer += colorsAsIntCount;
     if (count > 2) {
         for (int i = 1; i < count; i++) {