OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrPathRenderer_DEFINED | 10 #ifndef GrPathRenderer_DEFINED |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 * | 110 * |
111 * @param path the path to draw. | 111 * @param path the path to draw. |
112 * @param stroke the stroke information (width, join, cap) | 112 * @param stroke the stroke information (width, join, cap) |
113 * @param target target that the path will be rendered to | 113 * @param target target that the path will be rendered to |
114 * @param antiAlias true if anti-aliasing is required. | 114 * @param antiAlias true if anti-aliasing is required. |
115 */ | 115 */ |
116 bool drawPath(const SkPath& path, | 116 bool drawPath(const SkPath& path, |
117 const SkStrokeRec& stroke, | 117 const SkStrokeRec& stroke, |
118 GrDrawTarget* target, | 118 GrDrawTarget* target, |
119 bool antiAlias) { | 119 bool antiAlias) { |
| 120 GrAssert(!path.isEmpty()); |
120 GrAssert(this->canDrawPath(path, stroke, target, antiAlias)); | 121 GrAssert(this->canDrawPath(path, stroke, target, antiAlias)); |
121 GrAssert(target->drawState()->getStencil().isDisabled() || | 122 GrAssert(target->drawState()->getStencil().isDisabled() || |
122 kNoRestriction_StencilSupport == this->getStencilSupport(path,
stroke, target)); | 123 kNoRestriction_StencilSupport == this->getStencilSupport(path,
stroke, target)); |
123 return this->onDrawPath(path, stroke, target, antiAlias); | 124 return this->onDrawPath(path, stroke, target, antiAlias); |
124 } | 125 } |
125 | 126 |
126 /** | 127 /** |
127 * Draws the path to the stencil buffer. Assume the writable stencil bits ar
e already | 128 * Draws the path to the stencil buffer. Assume the writable stencil bits ar
e already |
128 * initialized to zero. The pixels inside the path will have non-zero stenci
l values afterwards. | 129 * initialized to zero. The pixels inside the path will have non-zero stenci
l values afterwards. |
129 * | 130 * |
130 * @param path the path to draw. | 131 * @param path the path to draw. |
131 * @param stroke the stroke information (width, join, cap) | 132 * @param stroke the stroke information (width, join, cap) |
132 * @param target target that the path will be rendered to | 133 * @param target target that the path will be rendered to |
133 */ | 134 */ |
134 void stencilPath(const SkPath& path, const SkStrokeRec& stroke, GrDrawTarget
* target) { | 135 void stencilPath(const SkPath& path, const SkStrokeRec& stroke, GrDrawTarget
* target) { |
| 136 GrAssert(!path.isEmpty()); |
135 GrAssert(kNoSupport_StencilSupport != this->getStencilSupport(path, stro
ke, target)); | 137 GrAssert(kNoSupport_StencilSupport != this->getStencilSupport(path, stro
ke, target)); |
136 this->onStencilPath(path, stroke, target); | 138 this->onStencilPath(path, stroke, target); |
137 } | 139 } |
138 | 140 |
139 protected: | 141 protected: |
140 /** | 142 /** |
141 * Subclass overrides if it has any limitations of stenciling support. | 143 * Subclass overrides if it has any limitations of stenciling support. |
142 */ | 144 */ |
143 virtual StencilSupport onGetStencilSupport(const SkPath&, | 145 virtual StencilSupport onGetStencilSupport(const SkPath&, |
144 const SkStrokeRec&, | 146 const SkStrokeRec&, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 SkRect* bounds) { | 190 SkRect* bounds) { |
189 GetPathDevBounds(path, device->width(), device->height(), matrix, bounds
); | 191 GetPathDevBounds(path, device->width(), device->height(), matrix, bounds
); |
190 } | 192 } |
191 | 193 |
192 private: | 194 private: |
193 | 195 |
194 typedef GrRefCnt INHERITED; | 196 typedef GrRefCnt INHERITED; |
195 }; | 197 }; |
196 | 198 |
197 #endif | 199 #endif |
OLD | NEW |