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 |
11 #include "SkPath.h" | 11 #include "SkPath.h" |
12 #include "GrPathRange.h" | 12 #include "GrPathRange.h" |
13 | 13 |
14 class SkStrokeRec; | 14 class SkStrokeRec; |
15 class SkDescriptor; | 15 class SkDescriptor; |
16 class SkTypeface; | 16 class SkTypeface; |
17 class GrPath; | 17 class GrPath; |
18 class GrGpu; | 18 class GrGpu; |
| 19 class GrStencilSettings; |
19 | 20 |
20 /** | 21 /** |
21 * Abstract class wrapping HW path rendering API. | 22 * Abstract class wrapping HW path rendering API. |
22 * | 23 * |
23 * The subclasses of this class use the possible HW API to render paths (as oppo
sed to path | 24 * The subclasses of this class use the possible HW API to render paths (as oppo
sed to path |
24 * rendering implemented in Skia on top of a "3d" HW API). | 25 * rendering implemented in Skia on top of a "3d" HW API). |
25 * The subclasses hold the global state needed to render paths, including shadow
of the global HW | 26 * The subclasses hold the global state needed to render paths, including shadow
of the global HW |
26 * API state. Similar to GrGpu. | 27 * API state. Similar to GrGpu. |
27 * | 28 * |
28 * 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 |
29 * 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 |
30 * during construction. | 31 * during construction. |
31 */ | 32 */ |
32 class GrPathRendering { | 33 class GrPathRendering { |
33 public: | 34 public: |
34 virtual ~GrPathRendering() { } | 35 virtual ~GrPathRendering() { } |
35 | 36 |
| 37 // No native support for inverse at this time |
| 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 |
36 enum PathTransformType { | 49 enum PathTransformType { |
37 kNone_PathTransformType, //!< [] | 50 kNone_PathTransformType, //!< [] |
38 kTranslateX_PathTransformType, //!< [kMTransX] | 51 kTranslateX_PathTransformType, //!< [kMTransX] |
39 kTranslateY_PathTransformType, //!< [kMTransY] | 52 kTranslateY_PathTransformType, //!< [kMTransY] |
40 kTranslate_PathTransformType, //!< [kMTransX, kMTransY] | 53 kTranslate_PathTransformType, //!< [kMTransX, kMTransY] |
41 kAffine_PathTransformType, //!< [kMScaleX, kMSkewX, kMTransX, kMSke
wY, kMScaleY, kMTransY] | 54 kAffine_PathTransformType, //!< [kMScaleX, kMSkewX, kMTransX, kMSke
wY, kMScaleY, kMTransY] |
42 | 55 |
43 kLast_PathTransformType = kAffine_PathTransformType | 56 kLast_PathTransformType = kAffine_PathTransformType |
44 }; | 57 }; |
45 | 58 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 * | 117 * |
105 * @param SkStrokeRec Common stroke that the GPU will apply to every path.
Note that | 118 * @param SkStrokeRec Common stroke that the GPU will apply to every path.
Note that |
106 * if the glyph outlines contain baked-in strokes from t
he font | 119 * if the glyph outlines contain baked-in strokes from t
he font |
107 * descriptor, the GPU stroke will be applied on top of
those | 120 * descriptor, the GPU stroke will be applied on top of
those |
108 * outlines. | 121 * outlines. |
109 * | 122 * |
110 * @return a new path range populated with glyphs. | 123 * @return a new path range populated with glyphs. |
111 */ | 124 */ |
112 virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, co
nst SkStrokeRec&) = 0; | 125 virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, co
nst SkStrokeRec&) = 0; |
113 | 126 |
114 virtual void stencilPath(const GrPath*, SkPath::FillType) = 0; | 127 virtual void stencilPath(const GrPath*, const GrStencilSettings&) = 0; |
115 virtual void drawPath(const GrPath*, SkPath::FillType) = 0; | 128 virtual void drawPath(const GrPath*, const GrStencilSettings&) = 0; |
116 virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int cou
nt, | 129 virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int cou
nt, |
117 const float transforms[], PathTransformType, SkPath::
FillType) = 0; | 130 const float transforms[], PathTransformType, |
| 131 const GrStencilSettings&) = 0; |
118 protected: | 132 protected: |
119 GrPathRendering() { } | 133 GrPathRendering() { } |
120 | 134 |
121 private: | 135 private: |
122 GrPathRendering& operator=(const GrPathRendering&); | 136 GrPathRendering& operator=(const GrPathRendering&); |
123 }; | 137 }; |
124 | 138 |
125 #endif | 139 #endif |
OLD | NEW |