Remove some uses of GrBytesPerPixel (take 2)

GrPixelConfig needs to go away. Towards that end, switch the Vk and GL backends over to using their native formats.

Change-Id: Ie663d1ec64d19b8940925afc7c39bc057c4112cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213482
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index df55380..d28f527 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -35,11 +35,11 @@
 
 std::unique_ptr<GrDrawOpAtlas> GrDrawOpAtlas::Make(GrProxyProvider* proxyProvider,
                                                    const GrBackendFormat& format,
-                                                   GrPixelConfig config, int width,
+                                                   GrColorType colorType, int width,
                                                    int height, int plotWidth, int plotHeight,
                                                    AllowMultitexturing allowMultitexturing,
                                                    GrDrawOpAtlas::EvictionFunc func, void* data) {
-    std::unique_ptr<GrDrawOpAtlas> atlas(new GrDrawOpAtlas(proxyProvider, format, config, width,
+    std::unique_ptr<GrDrawOpAtlas> atlas(new GrDrawOpAtlas(proxyProvider, format, colorType, width,
                                                            height, plotWidth, plotHeight,
                                                            allowMultitexturing));
     if (!atlas->getProxies()[0]) {
@@ -56,7 +56,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 GrDrawOpAtlas::Plot::Plot(int pageIndex, int plotIndex, uint64_t genID, int offX, int offY,
-                          int width, int height, GrPixelConfig config)
+                          int width, int height, GrColorType colorType)
         : fLastUpload(GrDeferredUploadToken::AlreadyFlushedToken())
         , fLastUse(GrDeferredUploadToken::AlreadyFlushedToken())
         , fFlushesSinceLastUse(0)
@@ -71,8 +71,8 @@
         , fY(offY)
         , fRects(nullptr)
         , fOffset(SkIPoint16::Make(fX * fWidth, fY * fHeight))
-        , fConfig(config)
-        , fBytesPerPixel(GrBytesPerPixel(config))
+        , fColorType(colorType)
+        , fBytesPerPixel(GrColorTypeBytesPerPixel(colorType))
 #ifdef SK_DEBUG
         , fDirty(false)
 #endif
@@ -150,10 +150,9 @@
     // Set up dataPtr
     dataPtr += rowBytes * fDirtyRect.fTop;
     dataPtr += fBytesPerPixel * fDirtyRect.fLeft;
-    // TODO: Make GrDrawOpAtlas store a GrColorType rather than GrPixelConfig.
-    auto colorType = GrPixelConfigToColorType(fConfig);
+
     writePixels(proxy, fOffset.fX + fDirtyRect.fLeft, fOffset.fY + fDirtyRect.fTop,
-                fDirtyRect.width(), fDirtyRect.height(), colorType, dataPtr, rowBytes);
+                fDirtyRect.width(), fDirtyRect.height(), fColorType, dataPtr, rowBytes);
     fDirtyRect.setEmpty();
     SkDEBUGCODE(fDirty = false;)
 }
@@ -180,10 +179,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 GrDrawOpAtlas::GrDrawOpAtlas(GrProxyProvider* proxyProvider, const GrBackendFormat& format,
-                             GrPixelConfig config, int width, int height,
+                             GrColorType colorType, int width, int height,
                              int plotWidth, int plotHeight, AllowMultitexturing allowMultitexturing)
         : fFormat(format)
-        , fPixelConfig(config)
+        , fColorType(colorType)
         , fTextureWidth(width)
         , fTextureHeight(height)
         , fPlotWidth(plotWidth)
@@ -524,7 +523,7 @@
     }
     desc.fWidth = fTextureWidth;
     desc.fHeight = fTextureHeight;
-    desc.fConfig = fPixelConfig;
+    desc.fConfig = GrColorTypeToPixelConfig(fColorType, GrSRGBEncoded::kNo);
 
     int numPlotsX = fTextureWidth/fPlotWidth;
     int numPlotsY = fTextureHeight/fPlotHeight;
@@ -546,7 +545,7 @@
             for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) {
                 uint32_t plotIndex = r * numPlotsX + c;
                 currPlot->reset(new Plot(i, plotIndex, 1, x, y, fPlotWidth, fPlotHeight,
-                                         fPixelConfig));
+                                         fColorType));
 
                 // build LRU list
                 fPages[i].fPlotList.addToHead(currPlot->get());