Index: src/gpu/GrAtlas.h |
diff --git a/src/gpu/GrAtlas.h b/src/gpu/GrAtlas.h |
index e290822fe1216c99859cb1b5cbbb1ddbe450dbbe..dbb2bb2ec0b27a7e068406eb7ef2cff88907dbaa 100644 |
--- a/src/gpu/GrAtlas.h |
+++ b/src/gpu/GrAtlas.h |
@@ -41,6 +41,8 @@ public: |
GrDrawTarget::DrawToken drawToken() const { return fDrawToken; } |
void setDrawToken(GrDrawTarget::DrawToken draw) { fDrawToken = draw; } |
+ void resetRects(); |
+ |
private: |
GrPlot(); |
~GrPlot(); // does not try to delete the fNext field |
@@ -48,6 +50,7 @@ private: |
// for recycling |
GrDrawTarget::DrawToken fDrawToken; |
+ GrPlot* fPrev; // for the LRU list |
GrPlot* fNext; |
GrTexture* fTexture; |
@@ -68,19 +71,18 @@ public: |
// returns the containing GrPlot and location relative to the backing texture |
GrPlot* addToAtlas(GrAtlas*, int width, int height, const void*, GrIPoint16*); |
- // free up any plots that are not waiting on a draw call |
- bool removeUnusedPlots(GrAtlas* atlas); |
+ // remove reference to this plot |
+ bool removePlot(GrAtlas* atlas, const GrPlot* plot); |
- // to be called by ~GrAtlas() |
- void deletePlotList(GrPlot* plot); |
+ // get a plot that only contains drawn content |
+ GrPlot* getUnusedPlot(); |
bsalomon
2014/02/28 16:28:53
This seems a little confusing to me. I read the co
jvanverth1
2014/02/28 19:55:27
I've revised the comment -- I can't think of a bet
|
GrTexture* getTexture() const { |
return fTexture; |
} |
private: |
- GrPlot* allocPlot(); |
- void freePlot(GrPlot* plot); |
+ void moveToHead(GrPlot* plot); |
GrGpu* fGpu; |
GrPixelConfig fPixelConfig; |
@@ -88,22 +90,23 @@ private: |
// allocated array of GrPlots |
GrPlot* fPlots; |
- // linked list of free GrPlots |
- GrPlot* fFreePlots; |
+ // LRU list of GrPlots |
+ GrPlot* fHead; |
+ GrPlot* fTail; |
}; |
class GrAtlas { |
public: |
- GrAtlas(GrAtlasMgr* mgr) : fPlots(NULL), fAtlasMgr(mgr) { } |
- ~GrAtlas() { fAtlasMgr->deletePlotList(fPlots); } |
+ GrAtlas(GrAtlasMgr* mgr) : fAtlasMgr(mgr) { } |
+ ~GrAtlas() { } |
- bool isEmpty() { return NULL == fPlots; } |
+ bool isEmpty() { return 0 == fPlots.count(); } |
SkISize getSize() const; |
private: |
- GrPlot* fPlots; |
- GrAtlasMgr* fAtlasMgr; |
+ SkTDArray<GrPlot*> fPlots; |
+ GrAtlasMgr* fAtlasMgr; |
friend class GrAtlasMgr; |
}; |