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

Unified Diff: src/gpu/GrAtlas.h

Issue 21594005: GPU Font Cache improvements: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed some nits Created 7 years, 4 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') | no next file with comments »
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 40a21545e15e6e7d1d089a3eba6db51c274eb441..b6f25c210ab7fdccfa7a98a9b6ff1f22dfbc9341 100644
--- a/src/gpu/GrAtlas.h
+++ b/src/gpu/GrAtlas.h
@@ -20,8 +20,6 @@ class GrAtlasMgr;
class GrAtlas {
public:
- GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat);
-
int getPlotX() const { return fPlot.fX; }
int getPlotY() const { return fPlot.fY; }
GrMaskFormat getMaskFormat() const { return fMaskFormat; }
@@ -31,20 +29,34 @@ public:
bool addSubImage(int width, int height, const void*, GrIPoint16*);
static void FreeLList(GrAtlas* atlas) {
- while (atlas) {
+ while (NULL != atlas) {
GrAtlas* next = atlas->fNext;
delete atlas;
atlas = next;
}
}
- // testing
- GrAtlas* nextAtlas() const { return fNext; }
+ static void MarkAllUnused(GrAtlas* atlas) {
+ while (NULL != atlas) {
+ atlas->fUsed = false;
+ atlas = atlas->fNext;
+ }
+ }
+
+ static bool RemoveUnusedAtlases(GrAtlasMgr* atlasMgr, GrAtlas** startAtlas);
+
+ bool used() const { return fUsed; }
+ void setUsed(bool used) { fUsed = used; }
private:
+ GrAtlas(GrAtlasMgr*, int plotX, int plotY, GrMaskFormat format);
~GrAtlas(); // does not try to delete the fNext field
GrAtlas* fNext;
+
+ // for recycling
+ bool fUsed;
+
GrTexture* fTexture;
GrRectanizer* fRects;
GrAtlasMgr* fAtlasMgr;
@@ -61,8 +73,9 @@ public:
GrAtlasMgr(GrGpu*);
~GrAtlasMgr();
- GrAtlas* addToAtlas(GrAtlas*, int width, int height, const void*,
+ GrAtlas* addToAtlas(GrAtlas**, int width, int height, const void*,
GrMaskFormat, GrIPoint16*);
+ void deleteAtlas(GrAtlas* atlas) { delete atlas; }
GrTexture* getTexture(GrMaskFormat format) const {
GrAssert((unsigned)format < kCount_GrMaskFormats);
@@ -70,7 +83,7 @@ public:
}
// to be called by ~GrAtlas()
- void freePlot(int x, int y);
+ void freePlot(GrMaskFormat format, int x, int y);
private:
GrGpu* fGpu;
« no previous file with comments | « no previous file | src/gpu/GrAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698