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 "GrSurfacePriv.h" | 10 #include "GrSurfacePriv.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 SkTDynamicHash<GrTextStrike, GrFontDescKey>::Iter iter(&fCache); | 43 SkTDynamicHash<GrTextStrike, GrFontDescKey>::Iter iter(&fCache); |
44 while (!iter.done()) { | 44 while (!iter.done()) { |
45 SkDELETE(&(*iter)); | 45 SkDELETE(&(*iter)); |
46 ++iter; | 46 ++iter; |
47 } | 47 } |
48 for (int i = 0; i < kAtlasCount; ++i) { | 48 for (int i = 0; i < kAtlasCount; ++i) { |
49 delete fAtlases[i]; | 49 delete fAtlases[i]; |
50 } | 50 } |
51 fGpu->unref(); | 51 fGpu->unref(); |
52 #if FONT_CACHE_STATS | 52 #if FONT_CACHE_STATS |
53 GrPrintf("Num purges: %d\n", g_PurgeCount); | 53 SkDebugf("Num purges: %d\n", g_PurgeCount); |
54 #endif | 54 #endif |
55 } | 55 } |
56 | 56 |
57 static GrPixelConfig mask_format_to_pixel_config(GrMaskFormat format) { | 57 static GrPixelConfig mask_format_to_pixel_config(GrMaskFormat format) { |
58 static const GrPixelConfig sPixelConfigs[] = { | 58 static const GrPixelConfig sPixelConfigs[] = { |
59 kAlpha_8_GrPixelConfig, | 59 kAlpha_8_GrPixelConfig, |
60 kRGB_565_GrPixelConfig, | 60 kRGB_565_GrPixelConfig, |
61 kSkia8888_GrPixelConfig, | 61 kSkia8888_GrPixelConfig, |
62 kSkia8888_GrPixelConfig | 62 kSkia8888_GrPixelConfig |
63 }; | 63 }; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 atlas and a position within that texture. | 229 atlas and a position within that texture. |
230 */ | 230 */ |
231 | 231 |
232 GrTextStrike::GrTextStrike(GrFontCache* cache, const GrFontDescKey* key) : fPool
(64) { | 232 GrTextStrike::GrTextStrike(GrFontCache* cache, const GrFontDescKey* key) : fPool
(64) { |
233 fFontScalerKey = key; | 233 fFontScalerKey = key; |
234 fFontScalerKey->ref(); | 234 fFontScalerKey->ref(); |
235 | 235 |
236 fFontCache = cache; // no need to ref, it won't go away before we do | 236 fFontCache = cache; // no need to ref, it won't go away before we do |
237 | 237 |
238 #ifdef SK_DEBUG | 238 #ifdef SK_DEBUG |
239 // GrPrintf(" GrTextStrike %p %d\n", this, gCounter); | 239 // SkDebugf(" GrTextStrike %p %d\n", this, gCounter); |
240 gCounter += 1; | 240 gCounter += 1; |
241 #endif | 241 #endif |
242 } | 242 } |
243 | 243 |
244 GrTextStrike::~GrTextStrike() { | 244 GrTextStrike::~GrTextStrike() { |
245 fFontScalerKey->unref(); | 245 fFontScalerKey->unref(); |
246 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); | 246 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); |
247 while (!iter.done()) { | 247 while (!iter.done()) { |
248 (*iter).free(); | 248 (*iter).free(); |
249 ++iter; | 249 ++iter; |
250 } | 250 } |
251 | 251 |
252 #ifdef SK_DEBUG | 252 #ifdef SK_DEBUG |
253 gCounter -= 1; | 253 gCounter -= 1; |
254 // GrPrintf("~GrTextStrike %p %d\n", this, gCounter); | 254 // SkDebugf("~GrTextStrike %p %d\n", this, gCounter); |
255 #endif | 255 #endif |
256 } | 256 } |
257 | 257 |
258 GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, | 258 GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, |
259 GrFontScaler* scaler) { | 259 GrFontScaler* scaler) { |
260 SkIRect bounds; | 260 SkIRect bounds; |
261 if (fUseDistanceField) { | 261 if (fUseDistanceField) { |
262 if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) { | 262 if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) { |
263 return NULL; | 263 return NULL; |
264 } | 264 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 glyph->width(), glyph->height(), | 338 glyph->width(), glyph->height(), |
339 storage.get(), &glyph->fAtlasLocation)
; | 339 storage.get(), &glyph->fAtlasLocation)
; |
340 | 340 |
341 if (NULL == plot) { | 341 if (NULL == plot) { |
342 return false; | 342 return false; |
343 } | 343 } |
344 | 344 |
345 glyph->fPlot = plot; | 345 glyph->fPlot = plot; |
346 return true; | 346 return true; |
347 } | 347 } |
OLD | NEW |