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 |
11 #include "SkMask.h" | 11 #include "SkMask.h" |
12 #include "SkMaskGamma.h" | 12 #include "SkMaskGamma.h" |
13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkTypeface.h" | 15 #include "SkTypeface.h" |
16 | 16 |
| 17 #ifdef SK_BUILD_FOR_ANDROID |
| 18 #include "SkPaintOptionsAndroid.h" |
| 19 #endif |
| 20 |
17 struct SkGlyph; | 21 struct SkGlyph; |
18 class SkDescriptor; | 22 class SkDescriptor; |
19 class SkMaskFilter; | 23 class SkMaskFilter; |
20 class SkPathEffect; | 24 class SkPathEffect; |
21 class SkRasterizer; | 25 class SkRasterizer; |
22 | 26 |
23 /* | 27 /* |
24 * To allow this to be forward-declared, it must be its own typename, rather | 28 * To allow this to be forward-declared, it must be its own typename, rather |
25 * than a nested struct inside SkScalerContext (where it started). | 29 * than a nested struct inside SkScalerContext (where it started). |
26 */ | 30 */ |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 SkPaint::FontMetrics* mY) = 0; | 215 SkPaint::FontMetrics* mY) = 0; |
212 // default impl returns 0, indicating failure. | 216 // default impl returns 0, indicating failure. |
213 virtual SkUnichar generateGlyphToChar(uint16_t); | 217 virtual SkUnichar generateGlyphToChar(uint16_t); |
214 | 218 |
215 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } | 219 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } |
216 | 220 |
217 private: | 221 private: |
218 // never null | 222 // never null |
219 SkAutoTUnref<SkTypeface> fTypeface; | 223 SkAutoTUnref<SkTypeface> fTypeface; |
220 | 224 |
| 225 #ifdef SK_BUILD_FOR_ANDROID |
| 226 SkPaintOptionsAndroid fPaintOptionsAndroid; |
| 227 #endif |
| 228 |
221 // optional object, which may be null | 229 // optional object, which may be null |
222 SkPathEffect* fPathEffect; | 230 SkPathEffect* fPathEffect; |
223 SkMaskFilter* fMaskFilter; | 231 SkMaskFilter* fMaskFilter; |
224 SkRasterizer* fRasterizer; | 232 SkRasterizer* fRasterizer; |
225 | 233 |
226 // if this is set, we draw the image from a path, rather than | 234 // if this is set, we draw the image from a path, rather than |
227 // calling generateImage. | 235 // calling generateImage. |
228 bool fGenerateImageFromPath; | 236 bool fGenerateImageFromPath; |
229 | 237 |
230 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, | 238 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, |
(...skipping 25 matching lines...) Expand all Loading... |
256 private: | 264 private: |
257 // When there is a filter, previous steps must create a linear mask | 265 // When there is a filter, previous steps must create a linear mask |
258 // and the pre-blend applied as a final step. | 266 // and the pre-blend applied as a final step. |
259 const SkMaskGamma::PreBlend fPreBlendForFilter; | 267 const SkMaskGamma::PreBlend fPreBlendForFilter; |
260 }; | 268 }; |
261 | 269 |
262 #define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c') | 270 #define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c') |
263 #define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e') | 271 #define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e') |
264 #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') | 272 #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') |
265 #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') | 273 #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') |
| 274 #ifdef SK_BUILD_FOR_ANDROID |
| 275 #define kAndroidOpts_SkDescriptorTag SkSetFourByteTag('a', 'n', 'd', 'r') |
| 276 #endif |
266 | 277 |
267 /////////////////////////////////////////////////////////////////////////////// | 278 /////////////////////////////////////////////////////////////////////////////// |
268 | 279 |
269 enum SkAxisAlignment { | 280 enum SkAxisAlignment { |
270 kNone_SkAxisAlignment, | 281 kNone_SkAxisAlignment, |
271 kX_SkAxisAlignment, | 282 kX_SkAxisAlignment, |
272 kY_SkAxisAlignment | 283 kY_SkAxisAlignment |
273 }; | 284 }; |
274 | 285 |
275 /** | 286 /** |
(...skipping 12 matching lines...) Expand all Loading... |
288 return static_cast<SkPaint::Hinting>(hint); | 299 return static_cast<SkPaint::Hinting>(hint); |
289 } | 300 } |
290 | 301 |
291 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 302 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
292 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 303 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
293 (hinting << SkScalerContext::kHinting_Shift); | 304 (hinting << SkScalerContext::kHinting_Shift); |
294 } | 305 } |
295 | 306 |
296 | 307 |
297 #endif | 308 #endif |
OLD | NEW |