aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-07 18:20:27 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-07 18:20:27 +0000
commit49e80830e9c633dcb8e7596bda17ea004ae48bd4 (patch)
treedbf4262c11ecd712eb2968a9716568264710be5b
parent6c1ee2d4e727357451c8a6fcf4a08e75890b5d6d (diff)
Fix for blinking/corrupted text in Canvas 2D.
Ensure that we update the drawToken for a glyph's plot every time it is used, not just when the glyph is first added. BUG=303803 R=junov@chromium.org, bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/26253003 git-svn-id: http://skia.googlecode.com/svn/trunk@11637 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/gpu/GrTextContext.cpp9
-rw-r--r--src/gpu/GrTextStrike.cpp9
-rw-r--r--src/gpu/GrTextStrike.h2
3 files changed, 8 insertions, 12 deletions
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 5a6183965c..8178032ae7 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -153,15 +153,14 @@ void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
}
}
- GrDrawTarget::DrawToken drawToken = fDrawTarget->getCurrentDrawToken();
if (NULL == glyph->fPlot) {
- if (fStrike->getGlyphAtlas(glyph, scaler, drawToken)) {
+ if (fStrike->getGlyphAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
// try to clear out an unused plot before we flush
fContext->getFontCache()->freePlotExceptFor(fStrike);
- if (fStrike->getGlyphAtlas(glyph, scaler, drawToken)) {
+ if (fStrike->getGlyphAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
@@ -178,7 +177,7 @@ void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
// try to purge
fContext->getFontCache()->purgeExceptFor(fStrike);
// need to use new flush count here
- if (fStrike->getGlyphAtlas(glyph, scaler, drawToken)) {
+ if (fStrike->getGlyphAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
@@ -205,6 +204,8 @@ void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
HAS_ATLAS:
SkASSERT(glyph->fPlot);
+ GrDrawTarget::DrawToken drawToken = fDrawTarget->getCurrentDrawToken();
+ glyph->fPlot->setDrawToken(drawToken);
// now promote them to fixed (TODO: Rethink using fixed pt).
width = SkIntToFixed(width);
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 4a56051264..ab7d8f06a6 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -259,8 +259,7 @@ bool GrTextStrike::removeUnusedPlots() {
return fAtlasMgr->removeUnusedPlots(&fAtlas);
}
-bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler,
- GrDrawTarget::DrawToken currentDrawToken) {
+bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
#if 0 // testing hack to force us to flush our cache often
static int gCounter;
if ((++gCounter % 10) == 0) return false;
@@ -269,10 +268,7 @@ bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler,
SkASSERT(glyph);
SkASSERT(scaler);
SkASSERT(fCache.contains(glyph));
- if (glyph->fPlot) {
- glyph->fPlot->setDrawToken(currentDrawToken);
- return true;
- }
+ SkASSERT(NULL == glyph->fPlot);
SkAutoRef ar(scaler);
@@ -294,6 +290,5 @@ bool GrTextStrike::getGlyphAtlas(GrGlyph* glyph, GrFontScaler* scaler,
}
glyph->fPlot = plot;
- plot->setDrawToken(currentDrawToken);
return true;
}
diff --git a/src/gpu/GrTextStrike.h b/src/gpu/GrTextStrike.h
index 35d50082b0..3d5bfdccf0 100644
--- a/src/gpu/GrTextStrike.h
+++ b/src/gpu/GrTextStrike.h
@@ -38,7 +38,7 @@ public:
GrMaskFormat getMaskFormat() const { return fMaskFormat; }
inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*);
- bool getGlyphAtlas(GrGlyph*, GrFontScaler*, GrDrawTarget::DrawToken currentDrawToken);
+ bool getGlyphAtlas(GrGlyph*, GrFontScaler*);
// testing
int countGlyphs() const { return fCache.getArray().count(); }