| 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 found
in the LICENSE file. | 4 * Use of this source code is governed by a BSD-style license that can be found
in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #ifndef SkGlyphCache_DEFINED | 7 #ifndef SkGlyphCache_DEFINED |
| 8 #define SkGlyphCache_DEFINED | 8 #define SkGlyphCache_DEFINED |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 existing cache entry. If not, ask the scalercontext to compute it for us
. | 59 existing cache entry. If not, ask the scalercontext to compute it for us
. |
| 60 */ | 60 */ |
| 61 uint16_t unicharToGlyph(SkUnichar); | 61 uint16_t unicharToGlyph(SkUnichar); |
| 62 | 62 |
| 63 /** Map the glyph to its Unicode equivalent. Unmappable glyphs map to a char
acter code of zero. | 63 /** Map the glyph to its Unicode equivalent. Unmappable glyphs map to a char
acter code of zero. |
| 64 */ | 64 */ |
| 65 SkUnichar glyphToUnichar(uint16_t); | 65 SkUnichar glyphToUnichar(uint16_t); |
| 66 | 66 |
| 67 /** Returns the number of glyphs for this strike. | 67 /** Returns the number of glyphs for this strike. |
| 68 */ | 68 */ |
| 69 unsigned getGlyphCount(); | 69 unsigned getGlyphCount() const; |
| 70 |
| 71 /** Return the number of glyphs currently cached. */ |
| 72 int countCachedGlyphs() const; |
| 70 | 73 |
| 71 /** Return the image associated with the glyph. If it has not been generated
this will | 74 /** Return the image associated with the glyph. If it has not been generated
this will |
| 72 trigger that. | 75 trigger that. |
| 73 */ | 76 */ |
| 74 const void* findImage(const SkGlyph&); | 77 const void* findImage(const SkGlyph&); |
| 75 | 78 |
| 76 /** Return the Path associated with the glyph. If it has not been generated
this will trigger | 79 /** Return the Path associated with the glyph. If it has not been generated
this will trigger |
| 77 that. | 80 that. |
| 78 */ | 81 */ |
| 79 const SkPath* findPath(const SkGlyph&); | 82 const SkPath* findPath(const SkGlyph&); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 descriptor, a different strike will be generated. This is fine. It does
mean we can have | 134 descriptor, a different strike will be generated. This is fine. It does
mean we can have |
| 132 more than 1 strike for the same descriptor, but that will eventually get
purged, and the | 135 more than 1 strike for the same descriptor, but that will eventually get
purged, and the |
| 133 win is that different thread will never block each other while a strike
is being used. | 136 win is that different thread will never block each other while a strike
is being used. |
| 134 */ | 137 */ |
| 135 static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkDescriptor* d
esc) { | 138 static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkDescriptor* d
esc) { |
| 136 return VisitCache(typeface, desc, DetachProc, NULL); | 139 return VisitCache(typeface, desc, DetachProc, NULL); |
| 137 } | 140 } |
| 138 | 141 |
| 139 static void Dump(); | 142 static void Dump(); |
| 140 | 143 |
| 144 typedef void (*Visitor)(const SkGlyphCache&, void* context); |
| 145 static void VisitAll(Visitor, void* context); |
| 146 |
| 141 #ifdef SK_DEBUG | 147 #ifdef SK_DEBUG |
| 142 void validate() const; | 148 void validate() const; |
| 143 #else | 149 #else |
| 144 void validate() const {} | 150 void validate() const {} |
| 145 #endif | 151 #endif |
| 146 | 152 |
| 147 class AutoValidate : SkNoncopyable { | 153 class AutoValidate : SkNoncopyable { |
| 148 public: | 154 public: |
| 149 AutoValidate(const SkGlyphCache* cache) : fCache(cache) { | 155 AutoValidate(const SkGlyphCache* cache) : fCache(cache) { |
| 150 if (fCache) { | 156 if (fCache) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 const SkMatrix* matrix) { | 306 const SkMatrix* matrix) { |
| 301 fCache = paint.detachCache(surfaceProps, matrix, true); | 307 fCache = paint.detachCache(surfaceProps, matrix, true); |
| 302 } | 308 } |
| 303 | 309 |
| 304 private: | 310 private: |
| 305 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} | 311 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} |
| 306 }; | 312 }; |
| 307 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) | 313 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) |
| 308 | 314 |
| 309 #endif | 315 #endif |
| OLD | NEW |