Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: src/gpu/GrBatchAtlas.cpp

Issue 1050113004: Adding bulk plot reffer to cached textblobs (Closed) Base URL: https://skia.googlesource.com/skia.git@atlastext
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
+}
« src/gpu/GrBatchAtlas.h ('K') | « src/gpu/GrBatchAtlas.h ('k') | src/gpu/GrBatchFontCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698