Index: src/gpu/GrBatchAtlas.cpp |
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp |
index 3374e00a9f7080f143057c792abdca4dfe992ef6..0166fcec86b9a20a461c1feeb5ca085df1522e35 100644 |
--- a/src/gpu/GrBatchAtlas.cpp |
+++ b/src/gpu/GrBatchAtlas.cpp |
@@ -229,6 +229,7 @@ GrBatchAtlas::GrBatchAtlas(GrTexture* texture, int numPlotsX, int numPlotsY) |
, fPlotWidth(texture->width() / numPlotsX) |
, fPlotHeight(texture->height() / numPlotsY) |
, fAtlasGeneration(kInvalidAtlasGeneration + 1) { |
+ SkASSERT(fNumPlotsX * fNumPlotsY <= BulkTokenReffer::kMaxPlots); |
SkASSERT(fPlotWidth * fNumPlotsX == texture->width()); |
SkASSERT(fPlotHeight * fNumPlotsY == texture->height()); |
@@ -359,14 +360,29 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrBatchTarget* batchTarget, |
} |
bool GrBatchAtlas::hasID(AtlasID id) { |
- int index = this->getIndexFromID(id); |
+ int index = this->GetIndexFromID(id); |
SkASSERT(index < fNumPlotsX * fNumPlotsY); |
- return fPlotArray[index]->genID() == this->getGenerationFromID(id); |
+ return fPlotArray[index]->genID() == this->GetGenerationFromID(id); |
} |
void GrBatchAtlas::setLastRefToken(AtlasID id, BatchToken batchToken) { |
SkASSERT(this->hasID(id)); |
- int index = this->getIndexFromID(id); |
+ int index = this->GetIndexFromID(id); |
this->makeMRU(fPlotArray[index]); |
bsalomon
2015/04/01 20:21:31
Call setLastRefTokenInternal() here?
|
fPlotArray[index]->setLastRefToken(batchToken); |
} |
+ |
+void GrBatchAtlas::setLastRefTokenInternal(int index, BatchToken batchToken) { |
bsalomon
2015/04/01 20:21:31
tiny nit, I think we more often say "internalSetLa
|
+ SkASSERT(index < fNumPlotsX * fNumPlotsY); |
+ this->makeMRU(fPlotArray[index]); |
+ fPlotArray[index]->setLastRefToken(batchToken); |
+} |
+ |
+void GrBatchAtlas::setLastRefTokenBulk(const BulkTokenReffer& reffer) { |
+ int plotsToUpdateCount = reffer.fPlotsToUpdate.count(); |
+ for (int i = 0; i < plotsToUpdateCount; i++) { |
+ BatchPlot* plot = fPlotArray[reffer.fPlotsToUpdate[i]]; |
+ this->makeMRU(plot); |
+ plot->setLastRefToken(reffer.fBatchToken); |
+ } |
+} |