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

Unified Diff: src/gpu/GrAtlas.h

Issue 177463003: New approach for GPU font atlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary method declarations. Created 6 years, 10 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
« no previous file with comments | « no previous file | src/gpu/GrAtlas.cpp » ('j') | src/gpu/GrAtlas.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « no previous file | src/gpu/GrAtlas.cpp » ('j') | src/gpu/GrAtlas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698