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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 fPrev = fNext = nullptr; | 46 fPrev = fNext = nullptr; |
47 | 47 |
48 fScalerContext->getFontMetrics(&fFontMetrics); | 48 fScalerContext->getFontMetrics(&fFontMetrics); |
49 | 49 |
50 fMemoryUsed = sizeof(*this); | 50 fMemoryUsed = sizeof(*this); |
51 | 51 |
52 fAuxProcList = nullptr; | 52 fAuxProcList = nullptr; |
53 } | 53 } |
54 | 54 |
55 SkGlyphCache::~SkGlyphCache() { | 55 SkGlyphCache::~SkGlyphCache() { |
56 fGlyphMap.foreach ([](SkGlyph* g) { | 56 fGlyphMap.foreach ([](SkGlyph* g) { |
57 if (g->fPathData) { | 57 if (g->fPathData) { |
58 delete g->fPathData->fPath; | 58 delete g->fPathData->fPath; |
59 } } ); | 59 } } ); |
60 SkDescriptor::Free(fDesc); | 60 SkDescriptor::Free(fDesc); |
61 delete fScalerContext; | 61 delete fScalerContext; |
62 this->invokeAndRemoveAuxProcs(); | 62 this->invokeAndRemoveAuxProcs(); |
63 } | 63 } |
64 | 64 |
65 SkGlyphCache::CharGlyphRec* SkGlyphCache::getCharGlyphRec(PackedUnicharID packed
UnicharID) { | 65 SkGlyphCache::CharGlyphRec* SkGlyphCache::getCharGlyphRec(PackedUnicharID packed
UnicharID) { |
66 if (nullptr == fPackedUnicharIDToPackedGlyphID.get()) { | 66 if (nullptr == fPackedUnicharIDToPackedGlyphID.get()) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 } | 261 } |
262 *count += 2; | 262 *count += 2; |
263 } | 263 } |
264 | 264 |
265 void SkGlyphCache::AddInterval(SkScalar val, SkGlyph::Intercept* intercept) { | 265 void SkGlyphCache::AddInterval(SkScalar val, SkGlyph::Intercept* intercept) { |
266 intercept->fInterval[0] = SkTMin(intercept->fInterval[0], val); | 266 intercept->fInterval[0] = SkTMin(intercept->fInterval[0], val); |
267 intercept->fInterval[1] = SkTMax(intercept->fInterval[1], val); | 267 intercept->fInterval[1] = SkTMax(intercept->fInterval[1], val); |
268 } | 268 } |
269 | 269 |
270 void SkGlyphCache::AddPoints(const SkPoint* pts, int ptCount, const SkScalar bou
nds[2], | 270 void SkGlyphCache::AddPoints(const SkPoint* pts, int ptCount, const SkScalar bou
nds[2], |
271 bool yAxis, SkGlyph::Intercept* intercept) { | 271 bool yAxis, SkGlyph::Intercept* intercept) { |
272 for (int i = 0; i < ptCount; ++i) { | 272 for (int i = 0; i < ptCount; ++i) { |
273 SkScalar val = *(&pts[i].fY - yAxis); | 273 SkScalar val = *(&pts[i].fY - yAxis); |
274 if (bounds[0] < val && val < bounds[1]) { | 274 if (bounds[0] < val && val < bounds[1]) { |
275 AddInterval(*(&pts[i].fX + yAxis), intercept); | 275 AddInterval(*(&pts[i].fX + yAxis), intercept); |
276 } | 276 } |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 void SkGlyphCache::AddLine(const SkPoint pts[2], SkScalar axis, bool yAxis, | 280 void SkGlyphCache::AddLine(const SkPoint pts[2], SkScalar axis, bool yAxis, |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 } | 813 } |
814 | 814 |
815 void SkGraphics::PurgeFontCache() { | 815 void SkGraphics::PurgeFontCache() { |
816 get_globals().purgeAll(); | 816 get_globals().purgeAll(); |
817 SkTypefaceCache::PurgeAll(); | 817 SkTypefaceCache::PurgeAll(); |
818 } | 818 } |
819 | 819 |
820 // TODO(herb): clean up TLS apis. | 820 // TODO(herb): clean up TLS apis. |
821 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } | 821 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } |
822 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } | 822 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } |
OLD | NEW |