| OLD | NEW |
| 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 "GrGpu.h" | 8 #include "GrGpu.h" |
| 9 #include "GrRectanizer.h" | 9 #include "GrRectanizer.h" |
| 10 #include "GrTextStrike.h" | 10 #include "GrTextStrike.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 fTail = NULL; | 123 fTail = NULL; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void GrFontCache::purgeStrike(GrTextStrike* strike) { | 126 void GrFontCache::purgeStrike(GrTextStrike* strike) { |
| 127 fCache.remove(*(strike->fFontScalerKey)); | 127 fCache.remove(*(strike->fFontScalerKey)); |
| 128 this->detachStrikeFromList(strike); | 128 this->detachStrikeFromList(strike); |
| 129 delete strike; | 129 delete strike; |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool GrFontCache::freeUnusedPlot(GrTextStrike* preserveStrike) { | 132 bool GrFontCache::freeUnusedPlot(GrTextStrike* preserveStrike) { |
| 133 SkASSERT(NULL != preserveStrike); | 133 SkASSERT(preserveStrike); |
| 134 | 134 |
| 135 GrAtlas* atlas = preserveStrike->fAtlas; | 135 GrAtlas* atlas = preserveStrike->fAtlas; |
| 136 GrPlot* plot = atlas->getUnusedPlot(); | 136 GrPlot* plot = atlas->getUnusedPlot(); |
| 137 if (NULL == plot) { | 137 if (NULL == plot) { |
| 138 return false; | 138 return false; |
| 139 } | 139 } |
| 140 plot->resetRects(); | 140 plot->resetRects(); |
| 141 | 141 |
| 142 GrTextStrike* strike = fHead; | 142 GrTextStrike* strike = fHead; |
| 143 GrMaskFormat maskFormat = preserveStrike->fMaskFormat; | 143 GrMaskFormat maskFormat = preserveStrike->fMaskFormat; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 count2 += 1; | 190 count2 += 1; |
| 191 strike = strike->fPrev; | 191 strike = strike->fPrev; |
| 192 } | 192 } |
| 193 SkASSERT(count == count2); | 193 SkASSERT(count == count2); |
| 194 } | 194 } |
| 195 #endif | 195 #endif |
| 196 | 196 |
| 197 void GrFontCache::dump() const { | 197 void GrFontCache::dump() const { |
| 198 static int gDumpCount = 0; | 198 static int gDumpCount = 0; |
| 199 for (int i = 0; i < kAtlasCount; ++i) { | 199 for (int i = 0; i < kAtlasCount; ++i) { |
| 200 if (NULL != fAtlases[i]) { | 200 if (fAtlases[i]) { |
| 201 GrTexture* texture = fAtlases[i]->getTexture(); | 201 GrTexture* texture = fAtlases[i]->getTexture(); |
| 202 if (NULL != texture) { | 202 if (texture) { |
| 203 SkString filename; | 203 SkString filename; |
| 204 #ifdef SK_BUILD_FOR_ANDROID | 204 #ifdef SK_BUILD_FOR_ANDROID |
| 205 filename.printf("/sdcard/fontcache_%d%d.png", gDumpCount, i); | 205 filename.printf("/sdcard/fontcache_%d%d.png", gDumpCount, i); |
| 206 #else | 206 #else |
| 207 filename.printf("fontcache_%d%d.png", gDumpCount, i); | 207 filename.printf("fontcache_%d%d.png", gDumpCount, i); |
| 208 #endif | 208 #endif |
| 209 texture->savePixels(filename.c_str()); | 209 texture->savePixels(filename.c_str()); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 } | 212 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 glyph->height(), storage.get(), | 327 glyph->height(), storage.get(), |
| 328 &glyph->fAtlasLocation); | 328 &glyph->fAtlasLocation); |
| 329 | 329 |
| 330 if (NULL == plot) { | 330 if (NULL == plot) { |
| 331 return false; | 331 return false; |
| 332 } | 332 } |
| 333 | 333 |
| 334 glyph->fPlot = plot; | 334 glyph->fPlot = plot; |
| 335 return true; | 335 return true; |
| 336 } | 336 } |
| OLD | NEW |