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