Chromium Code Reviews| Index: src/gpu/GrBatchAtlas.cpp |
| diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp |
| index 4b242820e33699c07a2d97e6e6a91193fbdc9163..b4284016afcb7ad87d9684fd04824dbb8ead35c1 100644 |
| --- a/src/gpu/GrBatchAtlas.cpp |
| +++ b/src/gpu/GrBatchAtlas.cpp |
| @@ -227,7 +227,8 @@ GrBatchAtlas::GrBatchAtlas(GrTexture* texture, int numPlotsX, int numPlotsY) |
| , fNumPlotsX(numPlotsX) |
| , fNumPlotsY(numPlotsY) |
| , fPlotWidth(texture->width() / numPlotsX) |
| - , fPlotHeight(texture->height() / numPlotsY) { |
| + , fPlotHeight(texture->height() / numPlotsY) |
| + , fAtlasGeneration(kInvalidAtlasGeneration + 1) { |
| SkASSERT(fPlotWidth * fNumPlotsX == texture->width()); |
| SkASSERT(fPlotHeight * fNumPlotsY == texture->height()); |
| @@ -243,7 +244,8 @@ GrBatchAtlas::GrBatchAtlas(GrTexture* texture, int numPlotsX, int numPlotsY) |
| for (int x = fNumPlotsX - 1, c = 0; x >= 0; --x, ++c) { |
| int id = r * fNumPlotsX + c; |
| currPlot->reset(SkNEW(BatchPlot)); |
| - (*currPlot)->init(this, texture, id, 0, x, y, fPlotWidth, fPlotHeight, fBPP); |
| + // Generation starts at 1 so we can use AtlasGeneration 0 for kInvalidAtlasGeneration |
|
robertphillips
2015/03/23 19:03:11
not sure how this comment maps to the code ?
joshualitt
2015/03/23 19:56:08
Acknowledged.
|
| + (*currPlot)->init(this, texture, id, 1, x, y, fPlotWidth, fPlotHeight, fBPP); |
| // build LRU list |
| fPlotList.addToHead(currPlot->get()); |
| @@ -318,6 +320,7 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrBatchTarget* batchTarget, |
| SkDEBUGCODE(bool verify = )plot->addSubImage(width, height, image, loc, fBPP * width); |
| SkASSERT(verify); |
| this->updatePlot(batchTarget, id, plot); |
| + fAtlasGeneration++; |
| return true; |
| } |
| @@ -352,6 +355,7 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrBatchTarget* batchTarget, |
| batchTarget->upload(uploader); |
| *id = newPlot->id(); |
| plot->unref(); |
| + fAtlasGeneration++; |
| return true; |
| } |