Rename GrBatchAtlas -> GrDrawOpAtlas.

Change-Id: I776f37e42dcab8b16535c48df9c405b1f211f6c9
Reviewed-on: https://skia-review.googlesource.com/6165
Commit-Queue: Brian Salomon <brian@thesalomons.net>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 1a4ba45..feb6691 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -12,36 +12,35 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-GrBatchAtlas::BatchPlot::BatchPlot(int index, uint64_t genID, int offX, int offY, int width,
-                                   int height, GrPixelConfig config)
-    : fLastUpload(GrDrawOpUploadToken::AlreadyFlushedToken())
-    , fLastUse(GrDrawOpUploadToken::AlreadyFlushedToken())
-    , fIndex(index)
-    , fGenID(genID)
-    , fID(CreateId(fIndex, fGenID))
-    , fData(nullptr)
-    , fWidth(width)
-    , fHeight(height)
-    , fX(offX)
-    , fY(offY)
-    , fRects(nullptr)
-    , fOffset(SkIPoint16::Make(fX * fWidth, fY * fHeight))
-    , fConfig(config)
-    , fBytesPerPixel(GrBytesPerPixel(config))
+GrDrawOpAtlas::Plot::Plot(int index, uint64_t genID, int offX, int offY, int width, int height,
+                          GrPixelConfig config)
+        : fLastUpload(GrDrawOpUploadToken::AlreadyFlushedToken())
+        , fLastUse(GrDrawOpUploadToken::AlreadyFlushedToken())
+        , fIndex(index)
+        , fGenID(genID)
+        , fID(CreateId(fIndex, fGenID))
+        , fData(nullptr)
+        , fWidth(width)
+        , fHeight(height)
+        , fX(offX)
+        , fY(offY)
+        , fRects(nullptr)
+        , fOffset(SkIPoint16::Make(fX * fWidth, fY * fHeight))
+        , fConfig(config)
+        , fBytesPerPixel(GrBytesPerPixel(config))
 #ifdef SK_DEBUG
-    , fDirty(false)
+        , fDirty(false)
 #endif
 {
     fDirtyRect.setEmpty();
 }
 
-GrBatchAtlas::BatchPlot::~BatchPlot() {
+GrDrawOpAtlas::Plot::~Plot() {
     sk_free(fData);
     delete fRects;
 }
 
-bool GrBatchAtlas::BatchPlot::addSubImage(int width, int height, const void* image,
-                                          SkIPoint16* loc) {
+bool GrDrawOpAtlas::Plot::addSubImage(int width, int height, const void* image, SkIPoint16* loc) {
     SkASSERT(width <= fWidth && height <= fHeight);
 
     if (!fRects) {
@@ -86,11 +85,11 @@
     return true;
 }
 
-void GrBatchAtlas::BatchPlot::uploadToTexture(GrDrawOp::WritePixelsFn& writePixels,
-                                              GrTexture* texture) {
+void GrDrawOpAtlas::Plot::uploadToTexture(GrDrawOp::WritePixelsFn& writePixels,
+                                          GrTexture* texture) {
     // We should only be issuing uploads if we are in fact dirty
     SkASSERT(fDirty && fData && texture);
-    TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrBatchPlot::uploadToTexture");
+    TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrDrawOpAtlas::Plot::uploadToTexture");
     size_t rowBytes = fBytesPerPixel * fWidth;
     const unsigned char* dataPtr = fData;
     dataPtr += rowBytes * fDirtyRect.fTop;
@@ -101,7 +100,7 @@
     SkDEBUGCODE(fDirty = false;)
 }
 
-void GrBatchAtlas::BatchPlot::resetRects() {
+void GrDrawOpAtlas::Plot::resetRects() {
     if (fRects) {
         fRects->reset();
     }
@@ -120,10 +119,8 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrBatchAtlas::GrBatchAtlas(sk_sp<GrTexture> texture, int numPlotsX, int numPlotsY)
-    : fTexture(std::move(texture))
-    , fAtlasGeneration(kInvalidAtlasGeneration + 1) {
-
+GrDrawOpAtlas::GrDrawOpAtlas(sk_sp<GrTexture> texture, int numPlotsX, int numPlotsY)
+        : fTexture(std::move(texture)), fAtlasGeneration(kInvalidAtlasGeneration + 1) {
     fPlotWidth = fTexture->width() / numPlotsX;
     fPlotHeight = fTexture->height() / numPlotsY;
     SkASSERT(numPlotsX * numPlotsY <= BulkUseTokenUpdater::kMaxPlots);
@@ -136,14 +133,14 @@
     SkASSERT(!GrPixelConfigIsCompressed(fTexture->desc().fConfig));
 
     // set up allocated plots
-    fPlotArray.reset(new sk_sp<BatchPlot>[numPlotsX * numPlotsY]);
+    fPlotArray.reset(new sk_sp<Plot>[ numPlotsX * numPlotsY ]);
 
-    sk_sp<BatchPlot>* currPlot = fPlotArray.get();
+    sk_sp<Plot>* currPlot = fPlotArray.get();
     for (int y = numPlotsY - 1, r = 0; y >= 0; --y, ++r) {
         for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) {
             uint32_t index = r * numPlotsX + c;
-            currPlot->reset(new BatchPlot(index, 1, x, y, fPlotWidth, fPlotHeight,
-                                          fTexture->desc().fConfig));
+            currPlot->reset(
+                    new Plot(index, 1, x, y, fPlotWidth, fPlotHeight, fTexture->desc().fConfig));
 
             // build LRU list
             fPlotList.addToHead(currPlot->get());
@@ -152,13 +149,13 @@
     }
 }
 
-void GrBatchAtlas::processEviction(AtlasID id) {
+void GrDrawOpAtlas::processEviction(AtlasID id) {
     for (int i = 0; i < fEvictionCallbacks.count(); i++) {
         (*fEvictionCallbacks[i].fFunc)(id, fEvictionCallbacks[i].fData);
     }
 }
 
-inline void GrBatchAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, BatchPlot* plot) {
+inline void GrDrawOpAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Plot* plot) {
     this->makeMRU(plot);
 
     // If our most recent upload has already occurred then we have to insert a new
@@ -166,7 +163,7 @@
     // This new update will piggy back on that previously scheduled update.
     if (target->hasDrawBeenFlushed(plot->lastUploadToken())) {
         // With c+14 we could move sk_sp into lamba to only ref once.
-        sk_sp<BatchPlot> plotsp(SkRef(plot));
+        sk_sp<Plot> plotsp(SkRef(plot));
         GrTexture* texture = fTexture.get();
         GrDrawOpUploadToken lastUploadToken = target->addAsapUpload(
             [plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) {
@@ -178,8 +175,8 @@
     *id = plot->id();
 }
 
-bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target,
-                              int width, int height, const void* image, SkIPoint16* loc) {
+bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, int height,
+                               const void* image, SkIPoint16* loc) {
     // We should already have a texture, TODO clean this up
     SkASSERT(fTexture);
     if (width > fPlotWidth || height > fPlotHeight) {
@@ -187,9 +184,9 @@
     }
 
     // now look through all allocated plots for one we can share, in Most Recently Refed order
-    GrBatchPlotList::Iter plotIter;
-    plotIter.init(fPlotList, GrBatchPlotList::Iter::kHead_IterStart);
-    BatchPlot* plot;
+    PlotList::Iter plotIter;
+    plotIter.init(fPlotList, PlotList::Iter::kHead_IterStart);
+    Plot* plot;
     while ((plot = plotIter.get())) {
         SkASSERT(GrBytesPerPixel(fTexture->desc().fConfig) == plot->bpp());
         if (plot->addSubImage(width, height, image, loc)) {
@@ -214,18 +211,18 @@
         return true;
     }
 
-    // If this plot has been used in a draw that is currently being prepared by a batch, then we
-    // have to fail. This gives the batch a chance to enqueue the draw, and call back into this
-    // function. When that draw is enqueued, the draw token advances, and the subsequent call will
-    // continue past this branch and prepare an inline upload that will occur after the enqueued
-    // draw which references the plot's pre-upload content.
+    // If this plot has been used in a draw that is currently being prepared by an op, then we have
+    // to fail. This gives the op a chance to enqueue the draw, and call back into this function.
+    // When that draw is enqueued, the draw token advances, and the subsequent call will continue
+    // past this branch and prepare an inline upload that will occur after the enqueued draw which
+    // references the plot's pre-upload content.
     if (plot->lastUseToken() == target->nextDrawToken()) {
         return false;
     }
 
     this->processEviction(plot->id());
     fPlotList.remove(plot);
-    sk_sp<BatchPlot>& newPlot = fPlotArray[plot->index()];
+    sk_sp<Plot>& newPlot = fPlotArray[plot->index()];
     newPlot.reset(plot->clone());
 
     fPlotList.addToHead(newPlot.get());
@@ -235,8 +232,8 @@
 
     // Note that this plot will be uploaded inline with the draws whereas the
     // one it displaced most likely was uploaded asap.
-    // With c+14 we could move sk_sp into lamba to only ref once.
-    sk_sp<BatchPlot> plotsp(SkRef(newPlot.get()));
+    // With c+14 we could move sk_sp into lambda to only ref once.
+    sk_sp<Plot> plotsp(SkRef(newPlot.get()));
     GrTexture* texture = fTexture.get();
     GrDrawOpUploadToken lastUploadToken = target->addInlineUpload(
         [plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) {