| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 * This function is to get the stencil support for a particular path. The pa
th's fill must | 77 * This function is to get the stencil support for a particular path. The pa
th's fill must |
| 78 * not be an inverse type. | 78 * not be an inverse type. |
| 79 * | 79 * |
| 80 * @param target target that the path will be rendered to | 80 * @param target target that the path will be rendered to |
| 81 * @param path the path that will be drawn | 81 * @param path the path that will be drawn |
| 82 * @param stroke the stroke information (width, join, cap). | 82 * @param stroke the stroke information (width, join, cap). |
| 83 */ | 83 */ |
| 84 StencilSupport getStencilSupport(const SkPath& path, | 84 StencilSupport getStencilSupport(const SkPath& path, |
| 85 const SkStrokeRec& stroke, | 85 const SkStrokeRec& stroke, |
| 86 const GrDrawTarget* target) const { | 86 const GrDrawTarget* target) const { |
| 87 GrAssert(!path.isInverseFillType()); | 87 SkASSERT(!path.isInverseFillType()); |
| 88 return this->onGetStencilSupport(path, stroke, target); | 88 return this->onGetStencilSupport(path, stroke, target); |
| 89 } | 89 } |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * Returns true if this path renderer is able to render the path. Returning
false allows the | 92 * Returns true if this path renderer is able to render the path. Returning
false allows the |
| 93 * caller to fallback to another path renderer This function is called when
searching for a path | 93 * caller to fallback to another path renderer This function is called when
searching for a path |
| 94 * renderer capable of rendering a path. | 94 * renderer capable of rendering a path. |
| 95 * | 95 * |
| 96 * @param path The path to draw | 96 * @param path The path to draw |
| 97 * @param stroke The stroke information (width, join, cap) | 97 * @param stroke The stroke information (width, join, cap) |
| (...skipping 12 matching lines...) Expand all 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 SkASSERT(!path.isEmpty()); |
| 121 GrAssert(this->canDrawPath(path, stroke, target, antiAlias)); | 121 SkASSERT(this->canDrawPath(path, stroke, target, antiAlias)); |
| 122 GrAssert(target->drawState()->getStencil().isDisabled() || | 122 SkASSERT(target->drawState()->getStencil().isDisabled() || |
| 123 kNoRestriction_StencilSupport == this->getStencilSupport(path,
stroke, target)); | 123 kNoRestriction_StencilSupport == this->getStencilSupport(path,
stroke, target)); |
| 124 return this->onDrawPath(path, stroke, target, antiAlias); | 124 return this->onDrawPath(path, stroke, target, antiAlias); |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * 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 |
| 129 * 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. |
| 130 * | 130 * |
| 131 * @param path the path to draw. | 131 * @param path the path to draw. |
| 132 * @param stroke the stroke information (width, join, cap) | 132 * @param stroke the stroke information (width, join, cap) |
| 133 * @param target target that the path will be rendered to | 133 * @param target target that the path will be rendered to |
| 134 */ | 134 */ |
| 135 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()); | 136 SkASSERT(!path.isEmpty()); |
| 137 GrAssert(kNoSupport_StencilSupport != this->getStencilSupport(path, stro
ke, target)); | 137 SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(path, stro
ke, target)); |
| 138 this->onStencilPath(path, stroke, target); | 138 this->onStencilPath(path, stroke, target); |
| 139 } | 139 } |
| 140 | 140 |
| 141 protected: | 141 protected: |
| 142 /** | 142 /** |
| 143 * Subclass overrides if it has any limitations of stenciling support. | 143 * Subclass overrides if it has any limitations of stenciling support. |
| 144 */ | 144 */ |
| 145 virtual StencilSupport onGetStencilSupport(const SkPath&, | 145 virtual StencilSupport onGetStencilSupport(const SkPath&, |
| 146 const SkStrokeRec&, | 146 const SkStrokeRec&, |
| 147 const GrDrawTarget*) const { | 147 const GrDrawTarget*) const { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 SkRect* bounds) { | 190 SkRect* bounds) { |
| 191 GetPathDevBounds(path, device->width(), device->height(), matrix, bounds
); | 191 GetPathDevBounds(path, device->width(), device->height(), matrix, bounds
); |
| 192 } | 192 } |
| 193 | 193 |
| 194 private: | 194 private: |
| 195 | 195 |
| 196 typedef GrRefCnt INHERITED; | 196 typedef GrRefCnt INHERITED; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 #endif | 199 #endif |
| OLD | NEW |