| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 virtual uint16_t generateCharToGlyph(SkUnichar unichar) = 0; | 292 virtual uint16_t generateCharToGlyph(SkUnichar unichar) = 0; |
| 293 | 293 |
| 294 /** Returns the unichar for the given glyph id. | 294 /** Returns the unichar for the given glyph id. |
| 295 * If there is no 1:1 mapping from the glyph id to a unichar, returns 0. | 295 * If there is no 1:1 mapping from the glyph id to a unichar, returns 0. |
| 296 * The default implementation always returns 0, indicating failure. | 296 * The default implementation always returns 0, indicating failure. |
| 297 */ | 297 */ |
| 298 virtual SkUnichar generateGlyphToChar(uint16_t glyphId); | 298 virtual SkUnichar generateGlyphToChar(uint16_t glyphId); |
| 299 | 299 |
| 300 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } | 300 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } |
| 301 | 301 |
| 302 void forceOffGenerateImageFromPath() { fGenerateImageFromPath = false; } |
| 303 |
| 302 private: | 304 private: |
| 303 // never null | 305 // never null |
| 304 SkAutoTUnref<SkTypeface> fTypeface; | 306 SkAutoTUnref<SkTypeface> fTypeface; |
| 305 | 307 |
| 306 // optional object, which may be null | 308 // optional object, which may be null |
| 307 SkPathEffect* fPathEffect; | 309 SkPathEffect* fPathEffect; |
| 308 SkMaskFilter* fMaskFilter; | 310 SkMaskFilter* fMaskFilter; |
| 309 SkRasterizer* fRasterizer; | 311 SkRasterizer* fRasterizer; |
| 310 | 312 |
| 311 // if this is set, we draw the image from a path, rather than | 313 // if this is set, we draw the image from a path, rather than |
| 312 // calling generateImage. | 314 // calling generateImage. |
| 313 bool fGenerateImageFromPath; | 315 bool fGenerateImageFromPath; |
| 314 | 316 |
| 315 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, | 317 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, |
| 316 SkPath* devPath, SkMatrix* fillToDevMatrix); | 318 SkPath* devPath, SkMatrix* fillToDevMatrix); |
| 317 | 319 |
| 318 // returns the right context from our link-list for this char. If no match | 320 // returns the right context from our link-list for this char. If no match |
| 319 // is found it returns NULL. If a match is found then the glyphID param is | 321 // is found it returns NULL. If a match is found then the glyphID param is |
| 320 // set to the glyphID that maps to the provided char. | 322 // set to the glyphID that maps to the provided char. |
| 321 SkScalerContext* getContextFromChar(SkUnichar uni, uint16_t* glyphID); | 323 SkScalerContext* getContextFromChar(SkUnichar uni, uint16_t* glyphID); |
| 322 | 324 |
| 323 // SkMaskGamma::PreBlend converts linear masks to gamma correcting masks. | 325 // SkMaskGamma::PreBlend converts linear masks to gamma correcting masks. |
| 324 protected: | 326 protected: |
| 325 // Visible to subclasses so that generateImage can apply the pre-blend direc
tly. | 327 // Visible to subclasses so that generateImage can apply the pre-blend direc
tly. |
| 326 const SkMaskGamma::PreBlend fPreBlend; | 328 const SkMaskGamma::PreBlend fPreBlend; |
| 327 private: | 329 private: |
| 328 // When there is a filter, previous steps must create a linear mask | 330 // When there is a filter, previous steps must create a linear mask |
| 329 // and the pre-blend applied as a final step. | 331 // and the pre-blend applied as a final step. |
| 330 const SkMaskGamma::PreBlend fPreBlendForFilter; | 332 const SkMaskGamma::PreBlend fPreBlendForFilter; |
| 333 |
| 334 friend class SkRandomScalerContext; // For debugging |
| 331 }; | 335 }; |
| 332 | 336 |
| 333 #define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c') | 337 #define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c') |
| 334 #define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e') | 338 #define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e') |
| 335 #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') | 339 #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') |
| 336 #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') | 340 #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') |
| 337 | 341 |
| 338 /////////////////////////////////////////////////////////////////////////////// | 342 /////////////////////////////////////////////////////////////////////////////// |
| 339 | 343 |
| 340 enum SkAxisAlignment { | 344 enum SkAxisAlignment { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 359 return static_cast<SkPaint::Hinting>(hint); | 363 return static_cast<SkPaint::Hinting>(hint); |
| 360 } | 364 } |
| 361 | 365 |
| 362 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 366 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
| 363 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 367 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
| 364 (hinting << SkScalerContext::kHinting_Shift); | 368 (hinting << SkScalerContext::kHinting_Shift); |
| 365 } | 369 } |
| 366 | 370 |
| 367 | 371 |
| 368 #endif | 372 #endif |
| OLD | NEW |