First pass at font cache refactor: Create an atlas manager per texture
This changes the AtlasMgr from a singleton class to one that is
created per-texture. This is the first step in allowing us to create
Atlases of other types (e.g., combine small icons into one big texture).
R=bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://chromiumcodereview.appspot.com/24608002
git-svn-id: http://skia.googlecode.com/svn/trunk@11468 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAtlas.h b/src/gpu/GrAtlas.h
index e4472e7..3f9da8c 100644
--- a/src/gpu/GrAtlas.h
+++ b/src/gpu/GrAtlas.h
@@ -64,25 +64,24 @@
class GrAtlasMgr {
public:
- GrAtlasMgr(GrGpu*);
+ GrAtlasMgr(GrGpu*, GrMaskFormat);
~GrAtlasMgr();
- GrAtlas* addToAtlas(GrAtlas**, int width, int height, const void*,
- GrMaskFormat, GrIPoint16*);
+ GrAtlas* addToAtlas(GrAtlas**, int width, int height, const void*, GrIPoint16*);
void deleteAtlas(GrAtlas* atlas) { delete atlas; }
- GrTexture* getTexture(GrMaskFormat format) const {
- SkASSERT((unsigned)format < kCount_GrMaskFormats);
- return fTexture[format];
+ GrTexture* getTexture() const {
+ return fTexture;
}
// to be called by ~GrAtlas()
- void freePlot(GrMaskFormat format, int x, int y);
+ void freePlot(int x, int y);
private:
- GrGpu* fGpu;
- GrTexture* fTexture[kCount_GrMaskFormats];
- GrPlotMgr* fPlotMgr[kCount_GrMaskFormats];
+ GrGpu* fGpu;
+ GrMaskFormat fMaskFormat;
+ GrTexture* fTexture;
+ GrPlotMgr* fPlotMgr;
};
#endif