From 4314e088689dae2fdf8d28415503f710563aaf5c Mon Sep 17 00:00:00 2001 From: joshualitt Date: Thu, 23 Apr 2015 08:03:35 -0700 Subject: [PATCH] small fix for perf regression in GrAtlasTextContext.cpp BUG=skia: Review URL: https://codereview.chromium.org/1080673005 --- src/gpu/GrBatchAtlas.cpp | 3 ++- src/gpu/GrBatchAtlas.h | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp index 53ed177..0bcd2f9 100644 --- a/src/gpu/GrBatchAtlas.cpp +++ b/src/gpu/GrBatchAtlas.cpp @@ -366,7 +366,8 @@ void GrBatchAtlas::setLastUseToken(AtlasID id, BatchToken batchToken) { } void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, BatchToken batchToken) { - for (int i = 0; i < updater.fCount; i++) { + int count = updater.fPlotsToUpdate.count(); + for (int i = 0; i < count; i++) { BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; this->makeMRU(plot); plot->setLastUseToken(batchToken); diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h index 7a89f78..83ef5ec 100644 --- a/src/gpu/GrBatchAtlas.h +++ b/src/gpu/GrBatchAtlas.h @@ -66,7 +66,7 @@ public: */ class BulkUseTokenUpdater { public: - BulkUseTokenUpdater() : fPlotAlreadyUpdated(0), fCount(0), fAllocated(kMinItems) {} + BulkUseTokenUpdater() : fPlotAlreadyUpdated(0) {} void add(AtlasID id) { int index = GrBatchAtlas::GetIndexFromID(id); if (!this->find(index)) { @@ -75,9 +75,7 @@ public: } void reset() { - fPlotsToUpdate.reset(kMinItems); - fAllocated = kMinItems; - fCount = 0; + fPlotsToUpdate.reset(); fPlotAlreadyUpdated = 0; } @@ -97,8 +95,6 @@ public: static const int kMaxPlots = 32; SkSTArray fPlotsToUpdate; uint32_t fPlotAlreadyUpdated; - int fCount; - int fAllocated; friend class GrBatchAtlas; }; -- 2.7.4