Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: src/gpu/GrTextStrike.cpp

Issue 24047005: Have multiple plotmgrs, one for each mask format. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAtlas.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrAtlas.h" 8 #include "GrAtlas.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "GrRectanizer.h" 10 #include "GrRectanizer.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 void GrFontCache::freeAll() { 63 void GrFontCache::freeAll() {
64 fCache.deleteAll(); 64 fCache.deleteAll();
65 delete fAtlasMgr; 65 delete fAtlasMgr;
66 fAtlasMgr = NULL; 66 fAtlasMgr = NULL;
67 fHead = NULL; 67 fHead = NULL;
68 fTail = NULL; 68 fTail = NULL;
69 } 69 }
70 70
71 void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) { 71 void GrFontCache::purgeExceptFor(GrTextStrike* preserveStrike) {
72 SkASSERT(NULL != preserveStrike);
72 GrTextStrike* strike = fTail; 73 GrTextStrike* strike = fTail;
73 bool purge = true; 74 bool purge = true;
75 GrMaskFormat maskFormat = preserveStrike->fMaskFormat;
74 while (strike) { 76 while (strike) {
75 if (strike == preserveStrike) { 77 if (strike == preserveStrike || maskFormat != strike->fMaskFormat) {
76 strike = strike->fPrev; 78 strike = strike->fPrev;
77 continue; 79 continue;
78 } 80 }
79 GrTextStrike* strikeToPurge = strike; 81 GrTextStrike* strikeToPurge = strike;
80 strike = strikeToPurge->fPrev; 82 strike = strikeToPurge->fPrev;
81 if (purge) { 83 if (purge) {
82 // keep purging if we won't free up any atlases with this strike. 84 // keep purging if we won't free up any atlases with this strike.
83 purge = (NULL == strikeToPurge->fAtlas); 85 purge = (NULL == strikeToPurge->fAtlas);
84 int index = fCache.slowFindIndex(strikeToPurge); 86 int index = fCache.slowFindIndex(strikeToPurge);
85 SkASSERT(index >= 0); 87 SkASSERT(index >= 0);
86 fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash()); 88 fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash());
87 this->detachStrikeFromList(strikeToPurge); 89 this->detachStrikeFromList(strikeToPurge);
88 delete strikeToPurge; 90 delete strikeToPurge;
89 } 91 }
90 } 92 }
91 #if FONT_CACHE_STATS 93 #if FONT_CACHE_STATS
92 ++g_PurgeCount; 94 ++g_PurgeCount;
93 #endif 95 #endif
94 } 96 }
95 97
96 void GrFontCache::freeAtlasExceptFor(GrTextStrike* preserveStrike) { 98 void GrFontCache::freeAtlasExceptFor(GrTextStrike* preserveStrike) {
99 SkASSERT(NULL != preserveStrike);
97 GrTextStrike* strike = fTail; 100 GrTextStrike* strike = fTail;
101 GrMaskFormat maskFormat = preserveStrike->fMaskFormat;
98 while (strike) { 102 while (strike) {
99 if (strike == preserveStrike) { 103 if (strike == preserveStrike || maskFormat != strike->fMaskFormat) {
100 strike = strike->fPrev; 104 strike = strike->fPrev;
101 continue; 105 continue;
102 } 106 }
103 GrTextStrike* strikeToPurge = strike; 107 GrTextStrike* strikeToPurge = strike;
104 strike = strikeToPurge->fPrev; 108 strike = strikeToPurge->fPrev;
105 if (strikeToPurge->removeUnusedAtlases()) { 109 if (strikeToPurge->removeUnusedAtlases()) {
106 if (NULL == strikeToPurge->fAtlas) { 110 if (NULL == strikeToPurge->fAtlas) {
107 int index = fCache.slowFindIndex(strikeToPurge); 111 int index = fCache.slowFindIndex(strikeToPurge);
108 SkASSERT(index >= 0); 112 SkASSERT(index >= 0);
109 fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash()) ; 113 fCache.removeAt(index, strikeToPurge->fFontScalerKey->getHash()) ;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 fMaskFormat, 252 fMaskFormat,
249 &glyph->fAtlasLocation); 253 &glyph->fAtlasLocation);
250 if (NULL == atlas) { 254 if (NULL == atlas) {
251 return false; 255 return false;
252 } 256 }
253 257
254 glyph->fAtlas = atlas; 258 glyph->fAtlas = atlas;
255 atlas->setDrawToken(currentDrawToken); 259 atlas->setDrawToken(currentDrawToken);
256 return true; 260 return true;
257 } 261 }
OLDNEW
« no previous file with comments | « src/gpu/GrAtlas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698