| Index: src/gpu/GrTextStrike.cpp
|
| diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
|
| index b03d14f96fd950e24a2b3533e420da18a9325bc9..fb9d631b601ad1397aa8473252d421676f631ab5 100644
|
| --- a/src/gpu/GrTextStrike.cpp
|
| +++ b/src/gpu/GrTextStrike.cpp
|
| @@ -32,7 +32,7 @@ static int g_PurgeCount = 0;
|
| GrFontCache::GrFontCache(GrGpu* gpu) : fGpu(gpu) {
|
| gpu->ref();
|
| for (int i = 0; i < kAtlasCount; ++i) {
|
| - fAtlasMgr[i] = NULL;
|
| + fAtlases[i] = NULL;
|
| }
|
|
|
| fHead = fTail = NULL;
|
| @@ -41,7 +41,7 @@ GrFontCache::GrFontCache(GrGpu* gpu) : fGpu(gpu) {
|
| GrFontCache::~GrFontCache() {
|
| fCache.deleteAll();
|
| for (int i = 0; i < kAtlasCount; ++i) {
|
| - delete fAtlasMgr[i];
|
| + delete fAtlases[i];
|
| }
|
| fGpu->unref();
|
| #if FONT_CACHE_STATS
|
| @@ -79,17 +79,17 @@ GrTextStrike* GrFontCache::generateStrike(GrFontScaler* scaler,
|
| GrMaskFormat format = scaler->getMaskFormat();
|
| GrPixelConfig config = mask_format_to_pixel_config(format);
|
| int atlasIndex = mask_format_to_atlas_index(format);
|
| - if (NULL == fAtlasMgr[atlasIndex]) {
|
| + if (NULL == fAtlases[atlasIndex]) {
|
| SkISize textureSize = SkISize::Make(GR_ATLAS_TEXTURE_WIDTH,
|
| GR_ATLAS_TEXTURE_HEIGHT);
|
| - fAtlasMgr[atlasIndex] = SkNEW_ARGS(GrAtlasMgr, (fGpu, config,
|
| - textureSize,
|
| - GR_NUM_PLOTS_X,
|
| - GR_NUM_PLOTS_Y,
|
| - true));
|
| + fAtlases[atlasIndex] = SkNEW_ARGS(GrAtlas, (fGpu, config,
|
| + textureSize,
|
| + GR_NUM_PLOTS_X,
|
| + GR_NUM_PLOTS_Y,
|
| + true));
|
| }
|
| GrTextStrike* strike = SkNEW_ARGS(GrTextStrike,
|
| - (this, scaler->getKey(), format, fAtlasMgr[atlasIndex]));
|
| + (this, scaler->getKey(), format, fAtlases[atlasIndex]));
|
| fCache.insert(key, strike);
|
|
|
| if (fHead) {
|
| @@ -108,8 +108,8 @@ GrTextStrike* GrFontCache::generateStrike(GrFontScaler* scaler,
|
| void GrFontCache::freeAll() {
|
| fCache.deleteAll();
|
| for (int i = 0; i < kAtlasCount; ++i) {
|
| - delete fAtlasMgr[i];
|
| - fAtlasMgr[i] = NULL;
|
| + delete fAtlases[i];
|
| + fAtlases[i] = NULL;
|
| }
|
| fHead = NULL;
|
| fTail = NULL;
|
| @@ -125,8 +125,8 @@ void GrFontCache::purgeStrike(GrTextStrike* strike) {
|
| bool GrFontCache::freeUnusedPlot(GrTextStrike* preserveStrike) {
|
| SkASSERT(NULL != preserveStrike);
|
|
|
| - GrAtlasMgr* atlasMgr = preserveStrike->fAtlasMgr;
|
| - GrPlot* plot = atlasMgr->getUnusedPlot();
|
| + GrAtlas* atlas = preserveStrike->fAtlas;
|
| + GrPlot* plot = atlas->getUnusedPlot();
|
| if (NULL == plot) {
|
| return false;
|
| }
|
| @@ -145,7 +145,7 @@ bool GrFontCache::freeUnusedPlot(GrTextStrike* preserveStrike) {
|
| strikeToPurge->removePlot(plot);
|
|
|
| // clear out any empty strikes (except this one)
|
| - if (strikeToPurge != preserveStrike && strikeToPurge->fAtlas.isEmpty()) {
|
| + if (strikeToPurge != preserveStrike && strikeToPurge->fPlotUsage.isEmpty()) {
|
| this->purgeStrike(strikeToPurge);
|
| }
|
| }
|
| @@ -190,8 +190,8 @@ void GrFontCache::validate() const {
|
| void GrFontCache::dump() const {
|
| static int gDumpCount = 0;
|
| for (int i = 0; i < kAtlasCount; ++i) {
|
| - if (NULL != fAtlasMgr[i]) {
|
| - GrTexture* texture = fAtlasMgr[i]->getTexture();
|
| + if (NULL != fAtlases[i]) {
|
| + GrTexture* texture = fAtlases[i]->getTexture();
|
| if (NULL != texture) {
|
| SkString filename;
|
| #ifdef SK_BUILD_FOR_ANDROID
|
| @@ -222,12 +222,12 @@ void GrFontCache::dump() const {
|
|
|
| GrTextStrike::GrTextStrike(GrFontCache* cache, const GrKey* key,
|
| GrMaskFormat format,
|
| - GrAtlasMgr* atlasMgr) : fPool(64) {
|
| + GrAtlas* atlas) : fPool(64) {
|
| fFontScalerKey = key;
|
| fFontScalerKey->ref();
|
|
|
| fFontCache = cache; // no need to ref, it won't go away before we do
|
| - fAtlasMgr = atlasMgr; // no need to ref, it won't go away before we do
|
| + fAtlas = atlas; // no need to ref, it won't go away before we do
|
|
|
| fMaskFormat = format;
|
|
|
| @@ -278,7 +278,7 @@ void GrTextStrike::removePlot(const GrPlot* plot) {
|
| }
|
| }
|
|
|
| - fAtlasMgr->removePlot(&fAtlas, plot);
|
| + fAtlas->removePlot(&fPlotUsage, plot);
|
| }
|
|
|
|
|
| @@ -314,9 +314,9 @@ bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
|
| }
|
| }
|
|
|
| - GrPlot* plot = fAtlasMgr->addToAtlas(&fAtlas, glyph->width(),
|
| - glyph->height(), storage.get(),
|
| - &glyph->fAtlasLocation);
|
| + GrPlot* plot = fAtlas->addToAtlas(&fPlotUsage, glyph->width(),
|
| + glyph->height(), storage.get(),
|
| + &glyph->fAtlasLocation);
|
|
|
| if (NULL == plot) {
|
| return false;
|
|
|