From 0ebe81a2b7a2dfd3b978520c2594e448bdbadca0 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 4 Apr 2011 20:06:59 +0000 Subject: always flush accumulated draws before we purge the font cache git-svn-id: http://skia.googlecode.com/svn/trunk@1051 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/src/GrInOrderDrawBuffer.cpp | 6 +----- gpu/src/GrTextContext.cpp | 8 +++----- gpu/src/GrTextStrike.cpp | 5 +++++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gpu/src/GrInOrderDrawBuffer.cpp b/gpu/src/GrInOrderDrawBuffer.cpp index 8225425b41..8191814a58 100644 --- a/gpu/src/GrInOrderDrawBuffer.cpp +++ b/gpu/src/GrInOrderDrawBuffer.cpp @@ -316,6 +316,7 @@ void GrInOrderDrawBuffer::reset() { } void GrInOrderDrawBuffer::playback(GrDrawTarget* target) { + GrAssert(!fReservedGeometry.fLocked); GrAssert(NULL != target); GrAssert(target != this); // not considered and why? @@ -346,8 +347,6 @@ void GrInOrderDrawBuffer::playback(GrDrawTarget* target) { ++currClip; target->setClip(fClips[currClip]); } - uint32_t vertexReserveCount = 0; - uint32_t indexReserveCount = 0; target->setVertexSourceToBuffer(draw.fVertexLayout, draw.fVertexBuffer); @@ -366,9 +365,6 @@ void GrInOrderDrawBuffer::playback(GrDrawTarget* target) { draw.fStartVertex, draw.fVertexCount); } - if (vertexReserveCount || indexReserveCount) { - target->releaseReservedGeometry(); - } } } diff --git a/gpu/src/GrTextContext.cpp b/gpu/src/GrTextContext.cpp index 2230af2346..e2c81c7700 100644 --- a/gpu/src/GrTextContext.cpp +++ b/gpu/src/GrTextContext.cpp @@ -176,7 +176,9 @@ void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed, if (fStrike->getGlyphAtlas(glyph, scaler)) { goto HAS_ATLAS; } - // must do this to flush inorder buffering before we purge + + // before we purge the cache, we must flush any accumulated draws + this->flushGlyphs(); fContext->flushText(); // try to purge @@ -185,11 +187,7 @@ void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed, goto HAS_ATLAS; } - // Draw as a path, so we flush any accumulated glyphs first - this->flushGlyphs(); - if (NULL == glyph->fPath) { - GrPath* path = new GrPath; if (!scaler->getGlyphPath(glyph->glyphID(), path)) { // flag the glyph as being dead? diff --git a/gpu/src/GrTextStrike.cpp b/gpu/src/GrTextStrike.cpp index a245997d20..7aae7571a3 100644 --- a/gpu/src/GrTextStrike.cpp +++ b/gpu/src/GrTextStrike.cpp @@ -169,6 +169,11 @@ GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, } 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; +#endif + GrAssert(glyph); GrAssert(scaler); GrAssert(fCache.contains(glyph)); -- cgit v1.2.3