OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 SkScalarContext_win_dw_DEFINED | 8 #ifndef SkScalarContext_win_dw_DEFINED |
9 #define SkScalarContext_win_dw_DEFINED | 9 #define SkScalarContext_win_dw_DEFINED |
10 | 10 |
11 #include "SkScalar.h" | 11 #include "SkScalar.h" |
12 #include "SkScalerContext.h" | 12 #include "SkScalerContext.h" |
13 #include "SkTypeface_win_dw.h" | 13 #include "SkTypeface_win_dw.h" |
14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
15 | 15 |
16 #include <dwrite.h> | 16 #include <dwrite.h> |
| 17 #if SK_HAS_DWRITE_2_H |
| 18 #include <dwrite_2.h> |
| 19 #endif |
17 | 20 |
18 class SkGlyph; | 21 class SkGlyph; |
19 class SkDescriptor; | 22 class SkDescriptor; |
20 | 23 |
21 class SkScalerContext_DW : public SkScalerContext { | 24 class SkScalerContext_DW : public SkScalerContext { |
22 public: | 25 public: |
23 SkScalerContext_DW(DWriteFontTypeface*, const SkScalerContextEffects&, const
SkDescriptor*); | 26 SkScalerContext_DW(DWriteFontTypeface*, const SkScalerContextEffects&, const
SkDescriptor*); |
24 virtual ~SkScalerContext_DW(); | 27 virtual ~SkScalerContext_DW(); |
25 | 28 |
26 protected: | 29 protected: |
27 unsigned generateGlyphCount() override; | 30 unsigned generateGlyphCount() override; |
28 uint16_t generateCharToGlyph(SkUnichar uni) override; | 31 uint16_t generateCharToGlyph(SkUnichar uni) override; |
29 void generateAdvance(SkGlyph* glyph) override; | 32 void generateAdvance(SkGlyph* glyph) override; |
30 void generateMetrics(SkGlyph* glyph) override; | 33 void generateMetrics(SkGlyph* glyph) override; |
31 void generateImage(const SkGlyph& glyph) override; | 34 void generateImage(const SkGlyph& glyph) override; |
32 void generatePath(const SkGlyph& glyph, SkPath* path) override; | 35 void generatePath(const SkGlyph& glyph, SkPath* path) override; |
33 void generateFontMetrics(SkPaint::FontMetrics*) override; | 36 void generateFontMetrics(SkPaint::FontMetrics*) override; |
34 | 37 |
35 private: | 38 private: |
36 const void* drawDWMask(const SkGlyph& glyph, | 39 const void* drawDWMask(const SkGlyph& glyph, |
37 DWRITE_RENDERING_MODE renderingMode, | 40 DWRITE_RENDERING_MODE renderingMode, |
38 DWRITE_TEXTURE_TYPE textureType); | 41 DWRITE_TEXTURE_TYPE textureType); |
39 | 42 |
40 HRESULT getBoundingBox(SkGlyph* glyph, | 43 HRESULT getBoundingBox(SkGlyph* glyph, |
41 DWRITE_RENDERING_MODE renderingMode, | 44 DWRITE_RENDERING_MODE renderingMode, |
42 DWRITE_TEXTURE_TYPE textureType, | 45 DWRITE_TEXTURE_TYPE textureType, |
43 RECT* bbox); | 46 RECT* bbox); |
44 | 47 |
| 48 bool isColorGlyph(const SkGlyph& glyph); |
| 49 |
| 50 #if SK_HAS_DWRITE_2_H |
| 51 bool getColorGlyphRun(const SkGlyph& glyph, IDWriteColorGlyphRunEnumerator**
colorGlyph); |
| 52 |
| 53 void generateColorGlyphImage(const SkGlyph& glyph); |
| 54 #endif |
| 55 |
45 SkTDArray<uint8_t> fBits; | 56 SkTDArray<uint8_t> fBits; |
46 /** The total matrix without the text height scale. */ | 57 /** The total matrix without the text height scale. */ |
47 SkMatrix fSkXform; | 58 SkMatrix fSkXform; |
48 /** The total matrix without the text height scale. */ | 59 /** The total matrix without the text height scale. */ |
49 DWRITE_MATRIX fXform; | 60 DWRITE_MATRIX fXform; |
50 /** The non-rotational part of total matrix without the text height scale. | 61 /** The non-rotational part of total matrix without the text height scale. |
51 * This is used to find the magnitude of gdi compatible advances. | 62 * This is used to find the magnitude of gdi compatible advances. |
52 */ | 63 */ |
53 DWRITE_MATRIX fGsA; | 64 DWRITE_MATRIX fGsA; |
54 /** The inverse of the rotational part of the total matrix. | 65 /** The inverse of the rotational part of the total matrix. |
55 * This is used to find the direction of gdi compatible advances. | 66 * This is used to find the direction of gdi compatible advances. |
56 */ | 67 */ |
57 SkMatrix fG_inv; | 68 SkMatrix fG_inv; |
58 /** The text size to render with. */ | 69 /** The text size to render with. */ |
59 SkScalar fTextSizeRender; | 70 SkScalar fTextSizeRender; |
60 /** The text size to measure with. */ | 71 /** The text size to measure with. */ |
61 SkScalar fTextSizeMeasure; | 72 SkScalar fTextSizeMeasure; |
62 SkAutoTUnref<DWriteFontTypeface> fTypeface; | 73 SkAutoTUnref<DWriteFontTypeface> fTypeface; |
63 int fGlyphCount; | 74 int fGlyphCount; |
64 DWRITE_RENDERING_MODE fRenderingMode; | 75 DWRITE_RENDERING_MODE fRenderingMode; |
65 DWRITE_TEXTURE_TYPE fTextureType; | 76 DWRITE_TEXTURE_TYPE fTextureType; |
66 DWRITE_MEASURING_MODE fMeasuringMode; | 77 DWRITE_MEASURING_MODE fMeasuringMode; |
| 78 #if SK_HAS_DWRITE_2_H |
| 79 SkTScopedComPtr<IDWriteFactory2> fFactory2; |
| 80 bool fIsColorFont; |
| 81 #endif |
67 }; | 82 }; |
68 | 83 |
69 #endif | 84 #endif |
OLD | NEW |