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