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