| 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 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const SkMatrix* fViewMatrix; | 146 const SkMatrix* fViewMatrix; |
| 147 const GrScissorState* fScissor; | 147 const GrScissorState* fScissor; |
| 148 const GrStencilSettings* fStencil; | 148 const GrStencilSettings* fStencil; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 void stencilPath(const StencilPathArgs& args, const GrPath* path) { | 151 void stencilPath(const StencilPathArgs& args, const GrPath* path) { |
| 152 fGpu->handleDirtyContext(); | 152 fGpu->handleDirtyContext(); |
| 153 this->onStencilPath(args, path); | 153 this->onStencilPath(args, path); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void drawPath(const GrPipeline& pipeline, | |
| 157 const GrPrimitiveProcessor& primProc, | |
| 158 const GrStencilSettings& stencil, | |
| 159 const GrPath* path) { | |
| 160 fGpu->handleDirtyContext(); | |
| 161 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { | |
| 162 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); | |
| 163 } | |
| 164 this->onDrawPath(pipeline, primProc, stencil, path); | |
| 165 } | |
| 166 | |
| 167 void drawPaths(const GrPipeline& pipeline, | 156 void drawPaths(const GrPipeline& pipeline, |
| 168 const GrPrimitiveProcessor& primProc, | 157 const GrPrimitiveProcessor& primProc, |
| 169 const GrStencilSettings& stencil, | 158 const GrStencilSettings& stencil, |
| 170 const GrPathRange* pathRange, | 159 const GrPathRange* pathRange, |
| 171 const void* indices, | 160 const void* indices, |
| 172 PathIndexType indexType, | 161 PathIndexType indexType, |
| 173 const float transformValues[], | 162 const float transformValues[], |
| 174 PathTransformType transformType, | 163 PathTransformType transformType, |
| 175 int count) { | 164 int count) { |
| 176 fGpu->handleDirtyContext(); | 165 fGpu->handleDirtyContext(); |
| 177 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { | 166 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { |
| 178 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); | 167 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); |
| 179 } | 168 } |
| 180 #ifdef SK_DEBUG | 169 #ifdef SK_DEBUG |
| 181 pathRange->assertPathsLoaded(indices, indexType, count); | 170 pathRange->assertPathsLoaded(indices, indexType, count); |
| 182 #endif | 171 #endif |
| 183 this->onDrawPaths(pipeline, primProc, stencil, pathRange, indices, index
Type, | 172 this->onDrawPaths(pipeline, primProc, stencil, pathRange, indices, index
Type, |
| 184 transformValues, transformType, count); | 173 transformValues, transformType, count); |
| 185 } | 174 } |
| 186 | 175 |
| 176 void drawPaths(const GrPipeline& pipeline, |
| 177 const GrPrimitiveProcessor& primProc, |
| 178 const GrStencilSettings& stencil, |
| 179 const GrPath* const* paths, |
| 180 int count) { |
| 181 fGpu->handleDirtyContext(); |
| 182 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { |
| 183 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); |
| 184 } |
| 185 this->onDrawPaths(pipeline, primProc, stencil, paths, count); |
| 186 } |
| 187 |
| 187 protected: | 188 protected: |
| 188 GrPathRendering(GrGpu* gpu) | 189 GrPathRendering(GrGpu* gpu) |
| 189 : fGpu(gpu) { | 190 : fGpu(gpu) { |
| 190 } | 191 } |
| 191 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; | 192 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; |
| 192 virtual void onDrawPath(const GrPipeline&, | |
| 193 const GrPrimitiveProcessor&, | |
| 194 const GrStencilSettings&, | |
| 195 const GrPath*) = 0; | |
| 196 virtual void onDrawPaths(const GrPipeline&, | 193 virtual void onDrawPaths(const GrPipeline&, |
| 197 const GrPrimitiveProcessor&, | 194 const GrPrimitiveProcessor&, |
| 198 const GrStencilSettings&, | 195 const GrStencilSettings&, |
| 199 const GrPathRange*, | 196 const GrPathRange*, |
| 200 const void* indices, | 197 const void* indices, |
| 201 PathIndexType, | 198 PathIndexType, |
| 202 const float transformValues[], | 199 const float transformValues[], |
| 203 PathTransformType, | 200 PathTransformType, |
| 204 int count) = 0; | 201 int count) = 0; |
| 202 virtual void onDrawPaths(const GrPipeline&, |
| 203 const GrPrimitiveProcessor&, |
| 204 const GrStencilSettings&, |
| 205 const GrPath* const*, |
| 206 int count) = 0; |
| 205 | 207 |
| 206 GrGpu* fGpu; | 208 GrGpu* fGpu; |
| 207 private: | 209 private: |
| 208 GrPathRendering& operator=(const GrPathRendering&); | 210 GrPathRendering& operator=(const GrPathRendering&); |
| 209 }; | 211 }; |
| 210 | 212 |
| 211 #endif | 213 #endif |
| OLD | NEW |