diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
commit | 52e935d04c59135739c3a68fb6e19d313dc6d5ad (patch) | |
tree | 95f7ab178b045bef4456cbf92c6aa7e476becd99 /skia/gl/SkGLTextCache.cpp | |
parent | 30fab79877b4bb067944b74d98346ac9bb6bfc7e (diff) | |
download | chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.zip chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.gz chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.bz2 |
New drop of Skia. This is up to CL 121320.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/gl/SkGLTextCache.cpp')
-rw-r--r-- | skia/gl/SkGLTextCache.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/skia/gl/SkGLTextCache.cpp b/skia/gl/SkGLTextCache.cpp index 25f822e..141e100 100644 --- a/skia/gl/SkGLTextCache.cpp +++ b/skia/gl/SkGLTextCache.cpp @@ -84,7 +84,7 @@ SkGLTextCache::Strike::addGlyphAndBind(const SkGlyph& glyph, if (fGlyphCount == kMaxGlyphCount || fNextFreeOffsetX + rowBytes >= fStrikeWidth) { // this will bind the next texture for us - SkDebugf("--- extend strike %p\n", this); +// SkDebugf("--- extend strike %p\n", this); strike = SkNEW_ARGS(Strike, (this, rowBytes, glyph.fHeight)); } else { glBindTexture(GL_TEXTURE_2D, fTexName); @@ -127,36 +127,30 @@ SkGLTextCache::Strike::addGlyphAndBind(const SkGlyph& glyph, /////////////////////////////////////////////////////////////////////////////// SkGLTextCache::SkGLTextCache() { - fCtx = SkGetGLContext(); bzero(fStrikeList, sizeof(fStrikeList)); } SkGLTextCache::~SkGLTextCache() { - SkDebugf("--- delete textcache %p\n", this); - - // if true, we need to not call glDeleteTexture, since they will have - // already gone out of scope - bool zap = SkGetGLContext() != fCtx; + this->deleteAllStrikes(true); +} +void SkGLTextCache::deleteAllStrikes(bool texturesAreValid) { for (size_t i = 0; i < SK_ARRAY_COUNT(fStrikeList); i++) { Strike* strike = fStrikeList[i]; while (strike != NULL) { Strike* next = strike->fNext; - if (zap) { - strike->zapTexture(); + if (!texturesAreValid) { + strike->abandonTexture(); } SkDELETE(strike); strike = next; } } + bzero(fStrikeList, sizeof(fStrikeList)); } SkGLTextCache::Strike* SkGLTextCache::findGlyph(const SkGlyph& glyph, int* offset) { - if (SkGetGLContext() != fCtx) { - SkDebugf("====== stale context for text texture\n"); - } - SkASSERT(glyph.fWidth != 0); SkASSERT(glyph.fHeight != 0); @@ -175,10 +169,6 @@ SkGLTextCache::Strike* SkGLTextCache::findGlyph(const SkGlyph& glyph, SkGLTextCache::Strike* SkGLTextCache::addGlyphAndBind(const SkGlyph& glyph, const uint8_t image[], int* offset) { - if (SkGetGLContext() != fCtx) { - SkDebugf("====== stale context for text texture\n"); - } - SkASSERT(image != NULL); SkASSERT(glyph.fWidth != 0); SkASSERT(glyph.fHeight != 0); |