OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkGlyphCache.h" | 8 #include "SkGlyphCache.h" |
9 #include "SkGlyphCache_Globals.h" | 9 #include "SkGlyphCache_Globals.h" |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (glyph->fID < id) { | 307 if (glyph->fID < id) { |
308 hi += 1; | 308 hi += 1; |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 // not found, but hi tells us where to inser the new glyph | 312 // not found, but hi tells us where to inser the new glyph |
313 fMemoryUsed += sizeof(SkGlyph); | 313 fMemoryUsed += sizeof(SkGlyph); |
314 | 314 |
315 glyph = (SkGlyph*)fGlyphAlloc.alloc(sizeof(SkGlyph), | 315 glyph = (SkGlyph*)fGlyphAlloc.alloc(sizeof(SkGlyph), |
316 SkChunkAlloc::kThrow_AllocFailType); | 316 SkChunkAlloc::kThrow_AllocFailType); |
317 glyph->init(id); | 317 glyph->initCommon(id); |
318 *fGlyphArray.insert(hi) = glyph; | 318 *fGlyphArray.insert(hi) = glyph; |
319 | 319 |
320 if (kJustAdvance_MetricsType == mtype) { | 320 if (kJustAdvance_MetricsType == mtype) { |
321 fScalerContext->getAdvance(glyph); | 321 fScalerContext->getAdvance(glyph); |
322 } else { | 322 } else { |
323 SkASSERT(kFull_MetricsType == mtype); | 323 SkASSERT(kFull_MetricsType == mtype); |
324 fScalerContext->getMetrics(glyph); | 324 fScalerContext->getMetrics(glyph); |
325 } | 325 } |
326 | 326 |
327 return glyph; | 327 return glyph; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 return tls ? tls->getCacheSizeLimit() : 0; | 746 return tls ? tls->getCacheSizeLimit() : 0; |
747 } | 747 } |
748 | 748 |
749 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { | 749 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { |
750 if (0 == bytes) { | 750 if (0 == bytes) { |
751 SkGlyphCache_Globals::DeleteTLS(); | 751 SkGlyphCache_Globals::DeleteTLS(); |
752 } else { | 752 } else { |
753 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); | 753 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); |
754 } | 754 } |
755 } | 755 } |
OLD | NEW |