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 GrPathRendering_DEFINED | 8 #ifndef GrPathRendering_DEFINED |
9 #define GrPathRendering_DEFINED | 9 #define GrPathRendering_DEFINED |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 * API state. Similar to GrGpu. | 27 * API state. Similar to GrGpu. |
28 * | 28 * |
29 * It is expected that the lifetimes of GrGpuXX and GrXXPathRendering are the sa
me. The call context | 29 * It is expected that the lifetimes of GrGpuXX and GrXXPathRendering are the sa
me. The call context |
30 * interface (eg. * the concrete instance of GrGpu subclass) should be provided
to the instance | 30 * interface (eg. * the concrete instance of GrGpu subclass) should be provided
to the instance |
31 * during construction. | 31 * during construction. |
32 */ | 32 */ |
33 class GrPathRendering { | 33 class GrPathRendering { |
34 public: | 34 public: |
35 virtual ~GrPathRendering() { } | 35 virtual ~GrPathRendering() { } |
36 | 36 |
37 // No native support for inverse at this time | 37 typedef GrPathRange::PathIndexType PathIndexType; |
38 enum FillType { | |
39 /** Specifies that "inside" is computed by a non-zero sum of signed | |
40 edge crossings | |
41 */ | |
42 kWinding_FillType, | |
43 /** Specifies that "inside" is computed by an odd number of edge | |
44 crossings | |
45 */ | |
46 kEvenOdd_FillType, | |
47 }; | |
48 | 38 |
49 enum PathTransformType { | 39 enum PathTransformType { |
50 kNone_PathTransformType, //!< [] | 40 kNone_PathTransformType, //!< [] |
51 kTranslateX_PathTransformType, //!< [kMTransX] | 41 kTranslateX_PathTransformType, //!< [kMTransX] |
52 kTranslateY_PathTransformType, //!< [kMTransY] | 42 kTranslateY_PathTransformType, //!< [kMTransY] |
53 kTranslate_PathTransformType, //!< [kMTransX, kMTransY] | 43 kTranslate_PathTransformType, //!< [kMTransX, kMTransY] |
54 kAffine_PathTransformType, //!< [kMScaleX, kMSkewX, kMTransX, kMSke
wY, kMScaleY, kMTransY] | 44 kAffine_PathTransformType, //!< [kMScaleX, kMSkewX, kMTransX, kMSke
wY, kMScaleY, kMTransY] |
55 | 45 |
56 kLast_PathTransformType = kAffine_PathTransformType | 46 kLast_PathTransformType = kAffine_PathTransformType |
57 }; | 47 }; |
58 | 48 |
59 static inline int PathTransformSize(PathTransformType type) { | 49 static inline int PathTransformSize(PathTransformType type) { |
60 switch (type) { | 50 switch (type) { |
61 case kNone_PathTransformType: | 51 case kNone_PathTransformType: |
62 return 0; | 52 return 0; |
63 case kTranslateX_PathTransformType: | 53 case kTranslateX_PathTransformType: |
64 case kTranslateY_PathTransformType: | 54 case kTranslateY_PathTransformType: |
65 return 1; | 55 return 1; |
66 case kTranslate_PathTransformType: | 56 case kTranslate_PathTransformType: |
67 return 2; | 57 return 2; |
68 case kAffine_PathTransformType: | 58 case kAffine_PathTransformType: |
69 return 6; | 59 return 6; |
70 | 60 |
71 default: | 61 default: |
72 SkFAIL("Unknown path transform type"); | 62 SkFAIL("Unknown path transform type"); |
73 return 0; | 63 return 0; |
74 } | 64 } |
75 } | 65 } |
76 | 66 |
| 67 // No native support for inverse at this time |
| 68 enum FillType { |
| 69 /** Specifies that "inside" is computed by a non-zero sum of signed |
| 70 edge crossings |
| 71 */ |
| 72 kWinding_FillType, |
| 73 /** Specifies that "inside" is computed by an odd number of edge |
| 74 crossings |
| 75 */ |
| 76 kEvenOdd_FillType, |
| 77 }; |
| 78 |
77 /** | 79 /** |
78 * Creates a new gpu path, based on the specified path and stroke and return
s it. | 80 * Creates a new gpu path, based on the specified path and stroke and return
s it. |
79 * The caller owns a ref on the returned path which must be balanced by a ca
ll to unref. | 81 * The caller owns a ref on the returned path which must be balanced by a ca
ll to unref. |
80 * | 82 * |
81 * @param skPath the path geometry. | 83 * @param skPath the path geometry. |
82 * @param stroke the path stroke. | 84 * @param stroke the path stroke. |
83 * @return a new path. | 85 * @return a new path. |
84 */ | 86 */ |
85 virtual GrPath* createPath(const SkPath&, const SkStrokeRec&) = 0; | 87 virtual GrPath* createPath(const SkPath&, const SkStrokeRec&) = 0; |
86 | 88 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * if the glyph outlines contain baked-in strokes from t
he font | 121 * if the glyph outlines contain baked-in strokes from t
he font |
120 * descriptor, the GPU stroke will be applied on top of
those | 122 * descriptor, the GPU stroke will be applied on top of
those |
121 * outlines. | 123 * outlines. |
122 * | 124 * |
123 * @return a new path range populated with glyphs. | 125 * @return a new path range populated with glyphs. |
124 */ | 126 */ |
125 virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, co
nst SkStrokeRec&) = 0; | 127 virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, co
nst SkStrokeRec&) = 0; |
126 | 128 |
127 virtual void stencilPath(const GrPath*, const GrStencilSettings&) = 0; | 129 virtual void stencilPath(const GrPath*, const GrStencilSettings&) = 0; |
128 virtual void drawPath(const GrPath*, const GrStencilSettings&) = 0; | 130 virtual void drawPath(const GrPath*, const GrStencilSettings&) = 0; |
129 virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int cou
nt, | 131 virtual void drawPaths(const GrPathRange*, const void* indices, PathIndexTyp
e, |
130 const float transforms[], PathTransformType, | 132 const float transformValues[], PathTransformType, int
count, |
131 const GrStencilSettings&) = 0; | 133 const GrStencilSettings&) = 0; |
132 protected: | 134 protected: |
133 GrPathRendering() { } | 135 GrPathRendering() { } |
134 | 136 |
135 private: | 137 private: |
136 GrPathRendering& operator=(const GrPathRendering&); | 138 GrPathRendering& operator=(const GrPathRendering&); |
137 }; | 139 }; |
138 | 140 |
139 #endif | 141 #endif |
OLD | NEW |