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

Unified Diff: src/gpu/GrAtlas.h

Issue 355673002: Rename GrAtlasMgr to GrAtlas (and other cleanup) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 6 years, 6 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 47048a81c7c32030c181720fd4c4f7d95c94d544..49a7bacf2768ad7b96416832718bb513ce65898a 100644
--- a/src/gpu/GrAtlas.h
+++ b/src/gpu/GrAtlas.h
@@ -16,18 +16,17 @@
class GrGpu;
class GrRectanizer;
-class GrAtlasMgr;
class GrAtlas;
// The backing GrTexture for a set of GrAtlases is broken into a spatial grid of GrPlots. When
// a GrAtlas needs space on the texture, it requests a GrPlot. Each GrAtlas can claim one
// or more GrPlots. The GrPlots keep track of subimage placement via their GrRectanizer. Once a
// GrPlot is "full" (i.e. there is no room for the new subimage according to the GrRectanizer), the
-// GrAtlas can request a new GrPlot via GrAtlasMgr::addToAtlas().
+// GrAtlas can request a new GrPlot via GrAtlas::addToAtlas().
//
// If all GrPlots are allocated, the replacement strategy is up to the client. The drawToken is
// available to ensure that all draw calls are finished for that particular GrPlot.
-// GrAtlasMgr::removeUnusedPlots() will free up any finished plots for a given GrAtlas.
+// GrAtlas::removeUnusedPlots() will free up any finished plots for a given GrAtlas.
class GrPlot {
public:
@@ -47,7 +46,7 @@ public:
private:
GrPlot();
~GrPlot(); // does not try to delete the fNext field
- void init(GrAtlasMgr* mgr, int offX, int offY, int width, int height, size_t bpp,
+ void init(GrAtlas* atlas, int offX, int offY, int width, int height, size_t bpp,
bool batchUploads);
// for recycling
@@ -56,30 +55,42 @@ private:
unsigned char* fPlotData;
GrTexture* fTexture;
GrRectanizer* fRects;
- GrAtlasMgr* fAtlasMgr;
+ GrAtlas* fAtlas;
SkIPoint16 fOffset; // the offset of the plot in the backing texture
size_t fBytesPerPixel;
SkIRect fDirtyRect;
bool fDirty;
bool fBatchUploads;
- friend class GrAtlasMgr;
+ friend class GrAtlas;
};
typedef SkTInternalLList<GrPlot> GrPlotList;
-class GrAtlasMgr {
+class GrAtlas {
public:
- GrAtlasMgr(GrGpu*, GrPixelConfig, const SkISize& backingTextureSize,
- int numPlotsX, int numPlotsY, bool batchUploads);
- ~GrAtlasMgr();
+ // This class allows each client to independently track the GrPlots in
+ // which its data is stored.
+ class ClientPlotUsage {
+ public:
+ bool isEmpty() const { return 0 == fPlots.count(); }
+
+ private:
+ SkTDArray<GrPlot*> fPlots;
+
+ friend class GrAtlas;
+ };
+
+ GrAtlas(GrGpu*, GrPixelConfig, const SkISize& backingTextureSize,
+ int numPlotsX, int numPlotsY, bool batchUploads);
+ ~GrAtlas();
// add subimage of width, height dimensions to atlas
// returns the containing GrPlot and location relative to the backing texture
- GrPlot* addToAtlas(GrAtlas*, int width, int height, const void*, SkIPoint16*);
+ GrPlot* addToAtlas(ClientPlotUsage*, int width, int height, const void*, SkIPoint16*);
// remove reference to this plot
- bool removePlot(GrAtlas* atlas, const GrPlot* plot);
+ void removePlot(ClientPlotUsage* usage, const GrPlot* plot);
// get a plot that's not being used by the current draw
// this allows us to overwrite this plot without flushing
@@ -92,7 +103,7 @@ public:
void uploadPlotsToTexture();
private:
- void moveToHead(GrPlot* plot);
+ void makeMRU(GrPlot* plot);
GrGpu* fGpu;
GrPixelConfig fPixelConfig;
@@ -104,21 +115,8 @@ private:
// allocated array of GrPlots
GrPlot* fPlotArray;
- // LRU list of GrPlots
+ // LRU list of GrPlots (MRU at head - LRU at tail)
GrPlotList fPlotList;
};
-class GrAtlas {
-public:
- GrAtlas() { }
- ~GrAtlas() { }
-
- bool isEmpty() { return 0 == fPlots.count(); }
-
-private:
- SkTDArray<GrPlot*> fPlots;
-
- friend class GrAtlasMgr;
-};
-
#endif
« 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