| 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 #ifndef GrPathRenderer_DEFINED | 9 #ifndef GrPathRenderer_DEFINED |
| 10 #define GrPathRenderer_DEFINED | 10 #define GrPathRenderer_DEFINED |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 SkASSERT(fPath.isEmpty()); | 93 SkASSERT(fPath.isEmpty()); |
| 94 fPath = path; | 94 fPath = path; |
| 95 fPath.setFillType(fillType); | 95 fPath.setFillType(fillType); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void resetPath() { | 98 void resetPath() { |
| 99 fPath.reset(); | 99 fPath.reset(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * Returns true if this path renderer is able to render the current path. Re
turning false | 103 * Returns true if this path renderer is able to render the current path. Re
turning false |
| 104 * allows the caller to fallback to another path renderer This function is c
alled when | 104 * allows the caller to fallback to another path renderer This function is c
alled when |
| 105 * searching for a path renderer capable of rendering a path. | 105 * searching for a path renderer capable of rendering a path. |
| 106 * | 106 * |
| 107 * @param stroke The stroke information (width, join, cap) | 107 * @param stroke The stroke information (width, join, cap) |
| 108 * @param target The target that the path will be rendered to | 108 * @param target The target that the path will be rendered to |
| 109 * @param antiAlias True if anti-aliasing is required. | 109 * @param antiAlias True if anti-aliasing is required. |
| 110 * | 110 * |
| 111 * @return true if the path can be drawn by this object, false otherwise. | 111 * @return true if the path can be drawn by this object, false otherwise. |
| 112 */ | 112 */ |
| 113 virtual bool canDrawPath(const SkStrokeRec& stroke, | 113 virtual bool canDrawPath(const SkStrokeRec& stroke, |
| 114 const GrDrawTarget* target, | 114 const GrDrawTarget* target, |
| 115 bool antiAlias) const = 0; | 115 bool antiAlias) const = 0; |
| 116 /** | 116 /** |
| 117 * Draws the current path into the draw target. If getStencilSupport() would
return | 117 * Draws the current path into the draw target. If getStencilSupport() would
return |
| 118 * kNoRestriction then the subclass must respect the stencil settings of the | 118 * kNoRestriction then the subclass must respect the stencil settings of the
|
| 119 * target's draw state. | 119 * target's draw state. |
| 120 * | 120 * |
| 121 * @param stroke the stroke information (width, join, cap) | 121 * @param stroke the stroke information (width, join, cap) |
| 122 * @param target target that the path will be rendered to | 122 * @param target target that the path will be rendered to |
| 123 * @param antiAlias true if anti-aliasing is required. | 123 * @param antiAlias true if anti-aliasing is required. |
| 124 */ | 124 */ |
| 125 bool drawPath(const SkStrokeRec& stroke, | 125 bool drawPath(const SkStrokeRec& stroke, |
| 126 GrDrawTarget* target, | 126 GrDrawTarget* target, |
| 127 bool antiAlias) { | 127 bool antiAlias) { |
| 128 SkASSERT(!fPath.isEmpty()); | 128 SkASSERT(!fPath.isEmpty()); |
| 129 SkASSERT(this->canDrawPath(stroke, target, antiAlias)); | 129 SkASSERT(this->canDrawPath(stroke, target, antiAlias)); |
| 130 SkASSERT(target->drawState()->getStencil().isDisabled() || | 130 SkASSERT(target->drawState()->getStencil().isDisabled() || |
| 131 kNoRestriction_StencilSupport == this->getStencilSupport(stroke
, target)); | 131 kNoRestriction_StencilSupport == this->getStencilSupport(stroke
, target)); |
| 132 return this->onDrawPath(stroke, target, antiAlias); | 132 return this->onDrawPath(stroke, target, antiAlias); |
| 133 } | 133 } |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * Draws the current path to the stencil buffer. Assume the writable stencil
bits are already | 136 * Draws the current path to the stencil buffer. Assume the writable stencil
bits are already |
| 137 * initialized to zero. The pixels inside the path will have non-zero stenci
l values | 137 * initialized to zero. The pixels inside the path will have non-zero stenci
l values |
| 138 * afterwards. | 138 * afterwards. |
| 139 * | 139 * |
| 140 * @param stroke the stroke information (width, join, cap) | 140 * @param stroke the stroke information (width, join, cap) |
| 141 * @param target target that the path will be rendered to | 141 * @param target target that the path will be rendered to |
| 142 */ | 142 */ |
| 143 void stencilPath(const SkStrokeRec& stroke, GrDrawTarget* target) { | 143 void stencilPath(const SkStrokeRec& stroke, GrDrawTarget* target) { |
| 144 SkASSERT(!fPath.isEmpty()); | 144 SkASSERT(!fPath.isEmpty()); |
| 145 SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(stroke, ta
rget)); | 145 SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(stroke, ta
rget)); |
| 146 this->onStencilPath(stroke, target); | 146 this->onStencilPath(stroke, target); |
| 147 } | 147 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 GetPathDevBounds(path, device->width(), device->height(), matrix, bounds
); | 245 GetPathDevBounds(path, device->width(), device->height(), matrix, bounds
); |
| 246 } | 246 } |
| 247 | 247 |
| 248 private: | 248 private: |
| 249 SkPath fPath; | 249 SkPath fPath; |
| 250 | 250 |
| 251 typedef SkRefCnt INHERITED; | 251 typedef SkRefCnt INHERITED; |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 #endif | 254 #endif |
| OLD | NEW |