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 | 13 |
13 class SkStrokeRec; | 14 class SkStrokeRec; |
| 15 class SkDescriptor; |
| 16 class SkTypeface; |
14 class GrPath; | 17 class GrPath; |
15 class GrPathRange; | |
16 class GrGpu; | 18 class GrGpu; |
17 | 19 |
18 /** | 20 /** |
19 * Abstract class wrapping HW path rendering API. | 21 * Abstract class wrapping HW path rendering API. |
20 * | 22 * |
21 * The subclasses of this class use the possible HW API to render paths (as oppo
sed to path | 23 * The subclasses of this class use the possible HW API to render paths (as oppo
sed to path |
22 * rendering implemented in Skia on top of a "3d" HW API). | 24 * rendering implemented in Skia on top of a "3d" HW API). |
23 * The subclasses hold the global state needed to render paths, including shadow
of the global HW | 25 * The subclasses hold the global state needed to render paths, including shadow
of the global HW |
24 * API state. Similar to GrGpu. | 26 * API state. Similar to GrGpu. |
25 * | 27 * |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 virtual GrPath* createPath(const SkPath&, const SkStrokeRec&) = 0; | 72 virtual GrPath* createPath(const SkPath&, const SkStrokeRec&) = 0; |
71 | 73 |
72 /** | 74 /** |
73 * Creates a range of gpu paths with a common stroke. The caller owns a ref
on the | 75 * Creates a range of gpu paths with a common stroke. The caller owns a ref
on the |
74 * returned path range which must be balanced by a call to unref. | 76 * returned path range which must be balanced by a call to unref. |
75 * | 77 * |
76 * @param PathGenerator class that generates SkPath objects for each path in
the range. | 78 * @param PathGenerator class that generates SkPath objects for each path in
the range. |
77 * @param SkStrokeRec the common stroke applied to each path in the range. | 79 * @param SkStrokeRec the common stroke applied to each path in the range. |
78 * @return a new path range. | 80 * @return a new path range. |
79 */ | 81 */ |
80 virtual GrPathRange* createPathRange(size_t size, const SkStrokeRec&) = 0; | 82 virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const SkSt
rokeRec&) = 0; |
| 83 |
| 84 /** |
| 85 * Creates a range of glyph paths, indexed by glyph id. The glyphs will have
an |
| 86 * inverted y-direction in order to match the raw font path data. The caller
owns |
| 87 * a ref on the returned path range which must be balanced by a call to unre
f. |
| 88 * |
| 89 * @param SkTypeface Typeface that defines the glyphs. |
| 90 * If null, the default typeface will be used. |
| 91 * |
| 92 * @param SkDescriptor Additional font configuration that specifies the font
's size, |
| 93 * stroke, and other flags. This will generally come fro
m an |
| 94 * SkGlyphCache. |
| 95 * |
| 96 * It is recommended to leave this value null when possi
ble, in |
| 97 * which case the glyphs will be loaded directly from th
e font's |
| 98 * raw path data and sized at SkPaint::kCanonicalTextSiz
eForPaths. |
| 99 * This will result in less memory usage and more effici
ent paths. |
| 100 * |
| 101 * If non-null, the glyph paths will match the font desc
riptor, |
| 102 * including with the stroke information baked directly
into |
| 103 * the outlines. |
| 104 * |
| 105 * @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 |
| 107 * descriptor, the GPU stroke will be applied on top of
those |
| 108 * outlines. |
| 109 * |
| 110 * @return a new path range populated with glyphs. |
| 111 */ |
| 112 virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, co
nst SkStrokeRec&) = 0; |
81 | 113 |
82 virtual void stencilPath(const GrPath*, SkPath::FillType) = 0; | 114 virtual void stencilPath(const GrPath*, SkPath::FillType) = 0; |
83 virtual void drawPath(const GrPath*, SkPath::FillType) = 0; | 115 virtual void drawPath(const GrPath*, SkPath::FillType) = 0; |
84 virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int cou
nt, | 116 virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int cou
nt, |
85 const float transforms[], PathTransformType, SkPath::
FillType) = 0; | 117 const float transforms[], PathTransformType, SkPath::
FillType) = 0; |
86 protected: | 118 protected: |
87 GrPathRendering() { } | 119 GrPathRendering() { } |
88 | 120 |
89 private: | 121 private: |
90 GrPathRendering& operator=(const GrPathRendering&); | 122 GrPathRendering& operator=(const GrPathRendering&); |
91 }; | 123 }; |
92 | 124 |
93 #endif | 125 #endif |
OLD | NEW |