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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 unsigned getGlyphCount() const; | 70 unsigned getGlyphCount() const; |
71 | 71 |
72 /** Return the number of glyphs currently cached. */ | 72 /** Return the number of glyphs currently cached. */ |
73 int countCachedGlyphs() const; | 73 int countCachedGlyphs() const; |
74 | 74 |
75 /** Return the image associated with the glyph. If it has not been generated
this will | 75 /** Return the image associated with the glyph. If it has not been generated
this will |
76 trigger that. | 76 trigger that. |
77 */ | 77 */ |
78 const void* findImage(const SkGlyph&); | 78 const void* findImage(const SkGlyph&); |
79 | 79 |
| 80 /** If the advance axis intersects the glyph's path, append the positions sc
aled and offset |
| 81 to the array (if non-null), and set the count to the updated array lengt
h. |
| 82 */ |
| 83 void findIntercepts(const SkScalar bounds[2], SkScalar scale, SkScalar xPos, |
| 84 bool yAxis, SkGlyph* , SkScalar* array, int* count); |
| 85 |
80 /** Return the Path associated with the glyph. If it has not been generated
this will trigger | 86 /** Return the Path associated with the glyph. If it has not been generated
this will trigger |
81 that. | 87 that. |
82 */ | 88 */ |
83 const SkPath* findPath(const SkGlyph&); | 89 const SkPath* findPath(const SkGlyph&); |
84 | 90 |
85 /** Return the vertical metrics for this strike. | 91 /** Return the vertical metrics for this strike. |
86 */ | 92 */ |
87 const SkPaint::FontMetrics& getFontMetrics() const { | 93 const SkPaint::FontMetrics& getFontMetrics() const { |
88 return fFontMetrics; | 94 return fFontMetrics; |
89 } | 95 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 231 |
226 static bool DetachProc(const SkGlyphCache*, void*) { return true; } | 232 static bool DetachProc(const SkGlyphCache*, void*) { return true; } |
227 | 233 |
228 // The id arg is a combined id generated by MakeID. | 234 // The id arg is a combined id generated by MakeID. |
229 CharGlyphRec* getCharGlyphRec(PackedUnicharID id); | 235 CharGlyphRec* getCharGlyphRec(PackedUnicharID id); |
230 | 236 |
231 void invokeAndRemoveAuxProcs(); | 237 void invokeAndRemoveAuxProcs(); |
232 | 238 |
233 inline static SkGlyphCache* FindTail(SkGlyphCache* head); | 239 inline static SkGlyphCache* FindTail(SkGlyphCache* head); |
234 | 240 |
| 241 static void OffsetResults(const SkGlyph::Intercept* intercept, SkScalar scal
e, |
| 242 SkScalar xPos, SkScalar* array, int* count); |
| 243 static void AddInterval(SkScalar val, SkGlyph::Intercept* intercept); |
| 244 static void AddPoints(const SkPoint* pts, int ptCount, const SkScalar bounds
[2], |
| 245 bool yAxis, SkGlyph::Intercept* intercept); |
| 246 static void AddLine(const SkPoint pts[2], SkScalar axis, bool yAxis, |
| 247 SkGlyph::Intercept* intercept); |
| 248 static void AddQuad(const SkPoint pts[2], SkScalar axis, bool yAxis, |
| 249 SkGlyph::Intercept* intercept); |
| 250 static void AddCubic(const SkPoint pts[3], SkScalar axis, bool yAxis, |
| 251 SkGlyph::Intercept* intercept); |
| 252 static const SkGlyph::Intercept* MatchBounds(const SkGlyph* glyph, |
| 253 const SkScalar bounds[2]); |
| 254 |
235 SkGlyphCache* fNext; | 255 SkGlyphCache* fNext; |
236 SkGlyphCache* fPrev; | 256 SkGlyphCache* fPrev; |
237 SkDescriptor* const fDesc; | 257 SkDescriptor* const fDesc; |
238 SkScalerContext* const fScalerContext; | 258 SkScalerContext* const fScalerContext; |
239 SkPaint::FontMetrics fFontMetrics; | 259 SkPaint::FontMetrics fFontMetrics; |
240 | 260 |
241 // Map from a combined GlyphID and sub-pixel position to a SkGlyph. | 261 // Map from a combined GlyphID and sub-pixel position to a SkGlyph. |
242 SkTHashTable<SkGlyph, PackedGlyphID, SkGlyph::HashTraits> fGlyphMap; | 262 SkTHashTable<SkGlyph, PackedGlyphID, SkGlyph::HashTraits> fGlyphMap; |
243 | 263 |
244 SkChunkAlloc fGlyphAlloc; | 264 SkChunkAlloc fGlyphAlloc; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 const SkMatrix* matrix) { | 335 const SkMatrix* matrix) { |
316 fCache = paint.detachCache(surfaceProps, matrix, true); | 336 fCache = paint.detachCache(surfaceProps, matrix, true); |
317 } | 337 } |
318 | 338 |
319 private: | 339 private: |
320 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} | 340 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} |
321 }; | 341 }; |
322 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) | 342 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) |
323 | 343 |
324 #endif | 344 #endif |
OLD | NEW |