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 #ifndef SkScalerContext_DEFINED | 8 #ifndef SkScalerContext_DEFINED |
9 #define SkScalerContext_DEFINED | 9 #define SkScalerContext_DEFINED |
10 | 10 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void getImage(const SkGlyph&); | 183 void getImage(const SkGlyph&); |
184 void getPath(const SkGlyph&, SkPath*); | 184 void getPath(const SkGlyph&, SkPath*); |
185 void getFontMetrics(SkPaint::FontMetrics* mX, | 185 void getFontMetrics(SkPaint::FontMetrics* mX, |
186 SkPaint::FontMetrics* mY); | 186 SkPaint::FontMetrics* mY); |
187 | 187 |
188 #ifdef SK_BUILD_FOR_ANDROID | 188 #ifdef SK_BUILD_FOR_ANDROID |
189 unsigned getBaseGlyphCount(SkUnichar charCode); | 189 unsigned getBaseGlyphCount(SkUnichar charCode); |
190 | 190 |
191 // This function must be public for SkTypeface_android.h, but should not be | 191 // This function must be public for SkTypeface_android.h, but should not be |
192 // called by other callers | 192 // called by other callers |
193 SkFontID findTypefaceIdForChar(SkUnichar uni) { | 193 SkFontID findTypefaceIdForChar(SkUnichar uni); |
194 SkScalerContext* ctx = this; | |
195 while (NULL != ctx) { | |
196 if (ctx->generateCharToGlyph(uni)) { | |
197 return ctx->fRec.fFontID; | |
198 } | |
199 ctx = ctx->getNextContext(); | |
200 } | |
201 return 0; | |
202 } | |
203 #endif | 194 #endif |
204 | 195 |
205 static inline void MakeRec(const SkPaint&, const SkDeviceProperties* deviceP
roperties, | 196 static inline void MakeRec(const SkPaint&, const SkDeviceProperties* deviceP
roperties, |
206 const SkMatrix*, Rec* rec); | 197 const SkMatrix*, Rec* rec); |
207 static inline void PostMakeRec(const SkPaint&, Rec*); | 198 static inline void PostMakeRec(const SkPaint&, Rec*); |
208 | 199 |
209 static SkScalerContext* Create(const SkDescriptor*); | 200 static SkScalerContext* Create(const SkDescriptor*); |
210 static SkMaskGamma::PreBlend GetMaskPreBlend(const Rec& rec); | 201 static SkMaskGamma::PreBlend GetMaskPreBlend(const Rec& rec); |
211 | 202 |
212 protected: | 203 protected: |
(...skipping 25 matching lines...) Expand all Loading... |
238 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, | 229 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, |
239 SkPath* devPath, SkMatrix* fillToDevMatrix); | 230 SkPath* devPath, SkMatrix* fillToDevMatrix); |
240 | 231 |
241 // return the next context, treating fNextContext as a cache of the answer | 232 // return the next context, treating fNextContext as a cache of the answer |
242 SkScalerContext* getNextContext(); | 233 SkScalerContext* getNextContext(); |
243 | 234 |
244 // returns the right context from our link-list for this glyph. If no match | 235 // returns the right context from our link-list for this glyph. If no match |
245 // is found, just returns the original context (this) | 236 // is found, just returns the original context (this) |
246 SkScalerContext* getGlyphContext(const SkGlyph& glyph); | 237 SkScalerContext* getGlyphContext(const SkGlyph& glyph); |
247 | 238 |
| 239 // returns the right context from our link-list for this char. If no match |
| 240 // is found it returns NULL. If a match is found then the glyphID param is |
| 241 // set to the glyphID that maps to the provided char. |
| 242 SkScalerContext* getContextFromChar(SkUnichar uni, uint16_t* glyphID); |
| 243 |
248 // link-list of context, to handle missing chars. null-terminated. | 244 // link-list of context, to handle missing chars. null-terminated. |
249 SkScalerContext* fNextContext; | 245 SkScalerContext* fNextContext; |
250 | 246 |
251 // SkMaskGamma::PreBlend converts linear masks to gamma correcting masks. | 247 // SkMaskGamma::PreBlend converts linear masks to gamma correcting masks. |
252 protected: | 248 protected: |
253 // Visible to subclasses so that generateImage can apply the pre-blend direc
tly. | 249 // Visible to subclasses so that generateImage can apply the pre-blend direc
tly. |
254 const SkMaskGamma::PreBlend fPreBlend; | 250 const SkMaskGamma::PreBlend fPreBlend; |
255 private: | 251 private: |
256 // When there is a filter, previous steps must create a linear mask | 252 // When there is a filter, previous steps must create a linear mask |
257 // and the pre-blend applied as a final step. | 253 // and the pre-blend applied as a final step. |
(...skipping 29 matching lines...) Expand all Loading... |
287 return static_cast<SkPaint::Hinting>(hint); | 283 return static_cast<SkPaint::Hinting>(hint); |
288 } | 284 } |
289 | 285 |
290 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 286 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
291 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 287 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
292 (hinting << SkScalerContext::kHinting_Shift); | 288 (hinting << SkScalerContext::kHinting_Shift); |
293 } | 289 } |
294 | 290 |
295 | 291 |
296 #endif | 292 #endif |
OLD | NEW |