| 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 | |
| 21 struct SkGlyph; | 17 struct SkGlyph; |
| 22 class SkDescriptor; | 18 class SkDescriptor; |
| 23 class SkMaskFilter; | 19 class SkMaskFilter; |
| 24 class SkPathEffect; | 20 class SkPathEffect; |
| 25 class SkRasterizer; | 21 class SkRasterizer; |
| 26 | 22 |
| 27 /* | 23 /* |
| 28 * To allow this to be forward-declared, it must be its own typename, rather | 24 * To allow this to be forward-declared, it must be its own typename, rather |
| 29 * than a nested struct inside SkScalerContext (where it started). | 25 * than a nested struct inside SkScalerContext (where it started). |
| 30 */ | 26 */ |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 * The default implementation always returns 0, indicating failure. | 251 * The default implementation always returns 0, indicating failure. |
| 256 */ | 252 */ |
| 257 virtual SkUnichar generateGlyphToChar(uint16_t glyphId); | 253 virtual SkUnichar generateGlyphToChar(uint16_t glyphId); |
| 258 | 254 |
| 259 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } | 255 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } |
| 260 | 256 |
| 261 private: | 257 private: |
| 262 // never null | 258 // never null |
| 263 SkAutoTUnref<SkTypeface> fTypeface; | 259 SkAutoTUnref<SkTypeface> fTypeface; |
| 264 | 260 |
| 265 #ifdef SK_BUILD_FOR_ANDROID | |
| 266 SkPaintOptionsAndroid fPaintOptionsAndroid; | |
| 267 #endif | |
| 268 | |
| 269 // optional object, which may be null | 261 // optional object, which may be null |
| 270 SkPathEffect* fPathEffect; | 262 SkPathEffect* fPathEffect; |
| 271 SkMaskFilter* fMaskFilter; | 263 SkMaskFilter* fMaskFilter; |
| 272 SkRasterizer* fRasterizer; | 264 SkRasterizer* fRasterizer; |
| 273 | 265 |
| 274 // if this is set, we draw the image from a path, rather than | 266 // if this is set, we draw the image from a path, rather than |
| 275 // calling generateImage. | 267 // calling generateImage. |
| 276 bool fGenerateImageFromPath; | 268 bool fGenerateImageFromPath; |
| 277 | 269 |
| 278 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, | 270 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 290 private: | 282 private: |
| 291 // When there is a filter, previous steps must create a linear mask | 283 // When there is a filter, previous steps must create a linear mask |
| 292 // and the pre-blend applied as a final step. | 284 // and the pre-blend applied as a final step. |
| 293 const SkMaskGamma::PreBlend fPreBlendForFilter; | 285 const SkMaskGamma::PreBlend fPreBlendForFilter; |
| 294 }; | 286 }; |
| 295 | 287 |
| 296 #define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c') | 288 #define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c') |
| 297 #define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e') | 289 #define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e') |
| 298 #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') | 290 #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') |
| 299 #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') | 291 #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') |
| 300 #ifdef SK_BUILD_FOR_ANDROID | |
| 301 #define kAndroidOpts_SkDescriptorTag SkSetFourByteTag('a', 'n', 'd', 'r') | |
| 302 #endif | |
| 303 | 292 |
| 304 /////////////////////////////////////////////////////////////////////////////// | 293 /////////////////////////////////////////////////////////////////////////////// |
| 305 | 294 |
| 306 enum SkAxisAlignment { | 295 enum SkAxisAlignment { |
| 307 kNone_SkAxisAlignment, | 296 kNone_SkAxisAlignment, |
| 308 kX_SkAxisAlignment, | 297 kX_SkAxisAlignment, |
| 309 kY_SkAxisAlignment | 298 kY_SkAxisAlignment |
| 310 }; | 299 }; |
| 311 | 300 |
| 312 /** | 301 /** |
| (...skipping 12 matching lines...) Expand all Loading... |
| 325 return static_cast<SkPaint::Hinting>(hint); | 314 return static_cast<SkPaint::Hinting>(hint); |
| 326 } | 315 } |
| 327 | 316 |
| 328 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 317 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
| 329 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 318 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
| 330 (hinting << SkScalerContext::kHinting_Shift); | 319 (hinting << SkScalerContext::kHinting_Shift); |
| 331 } | 320 } |
| 332 | 321 |
| 333 | 322 |
| 334 #endif | 323 #endif |
| OLD | NEW |