aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextStrike.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-16 15:53:46 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-16 15:53:46 +0000
commita8916ffd90c04dc6cc1fb9ba94af2ff950284fad (patch)
tree1103abb2a3409cadf8e3c7aacc84c5ecfd8dcf38 /src/gpu/GrTextStrike.cpp
parent2276c01920ab48b589941b4e930a087cc163a77e (diff)
Change Atlas recycling to track current flush count and recycle if Atlas not used in current flush.
BUG= R=bsalomon@google.com, robertphillips@google.com Author: jvanverth@google.com Review URL: https://chromiumcodereview.appspot.com/23120004 git-svn-id: http://skia.googlecode.com/svn/trunk@10777 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrTextStrike.cpp')
-rw-r--r--src/gpu/GrTextStrike.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 9373351f22..1fe83c96d7 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -86,9 +86,6 @@ void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) {
fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash());
this->detachStrikeFromList(strikeToPurge);
delete strikeToPurge;
- } else {
- // for the remaining strikes, we just mark them unused
- GrAtlas::MarkAllUnused(strikeToPurge->fAtlas);
}
}
#if FONT_CACHE_STATS
@@ -185,7 +182,7 @@ GrTextStrike::GrTextStrike(GrFontCache* cache, const GrKey* key,
static void free_glyph(GrGlyph*& glyph) { glyph->free(); }
static void invalidate_glyph(GrGlyph*& glyph) {
- if (glyph->fAtlas && !glyph->fAtlas->used()) {
+ if (glyph->fAtlas && glyph->fAtlas->drawToken().isIssued()) {
glyph->fAtlas = NULL;
}
}
@@ -217,11 +214,10 @@ GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed,
bool GrTextStrike::removeUnusedAtlases() {
fCache.getArray().visitAll(invalidate_glyph);
return GrAtlas::RemoveUnusedAtlases(fAtlasMgr, &fAtlas);
-
- return false;
}
-bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
+bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler,
+ GrDrawTarget::DrawToken currentDrawToken) {
#if 0 // testing hack to force us to flush our cache often
static int gCounter;
if ((++gCounter % 10) == 0) return false;
@@ -231,7 +227,7 @@ bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
GrAssert(scaler);
GrAssert(fCache.contains(glyph));
if (glyph->fAtlas) {
- glyph->fAtlas->setUsed(true);
+ glyph->fAtlas->setDrawToken(currentDrawToken);
return true;
}
@@ -256,6 +252,6 @@ bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
}
glyph->fAtlas = atlas;
- atlas->setUsed(true);
+ atlas->setDrawToken(currentDrawToken);
return true;
}