| 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 |
| 11 #include "SkPath.h" | 11 #include "SkPath.h" |
| 12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 13 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
| 14 #include "GrPipeline.h" |
| 14 | 15 |
| 15 class SkDescriptor; | 16 class SkDescriptor; |
| 16 class SkTypeface; | 17 class SkTypeface; |
| 17 class GrPath; | 18 class GrPath; |
| 18 class GrStencilSettings; | 19 class GrStencilSettings; |
| 19 class GrStrokeInfo; | 20 class GrStrokeInfo; |
| 20 | 21 |
| 21 /** | 22 /** |
| 22 * Abstract class wrapping HW path rendering API. | 23 * Abstract class wrapping HW path rendering API. |
| 23 * | 24 * |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const GrStencilSettings* stencil) | 160 const GrStencilSettings* stencil) |
| 160 : DrawArgs(primProc, pipeline, desc, batchTracker) | 161 : DrawArgs(primProc, pipeline, desc, batchTracker) |
| 161 , fStencil(stencil) { | 162 , fStencil(stencil) { |
| 162 } | 163 } |
| 163 | 164 |
| 164 const GrStencilSettings* fStencil; | 165 const GrStencilSettings* fStencil; |
| 165 }; | 166 }; |
| 166 | 167 |
| 167 void drawPath(const DrawPathArgs& args, const GrPath* path) { | 168 void drawPath(const DrawPathArgs& args, const GrPath* path) { |
| 168 fGpu->handleDirtyContext(); | 169 fGpu->handleDirtyContext(); |
| 170 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*fGp
u->caps())) { |
| 171 fGpu->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
| 172 } |
| 169 this->onDrawPath(args, path); | 173 this->onDrawPath(args, path); |
| 170 } | 174 } |
| 171 | 175 |
| 172 void drawPaths(const DrawPathArgs& args, const GrPathRange* pathRange, const
void* indices, | 176 void drawPaths(const DrawPathArgs& args, const GrPathRange* pathRange, const
void* indices, |
| 173 PathIndexType indexType, const float transformValues[], | 177 PathIndexType indexType, const float transformValues[], |
| 174 PathTransformType transformType, int count) { | 178 PathTransformType transformType, int count) { |
| 175 fGpu->handleDirtyContext(); | 179 fGpu->handleDirtyContext(); |
| 180 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*fGp
u->caps())) { |
| 181 fGpu->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
| 182 } |
| 176 pathRange->willDrawPaths(indices, indexType, count); | 183 pathRange->willDrawPaths(indices, indexType, count); |
| 177 this->onDrawPaths(args, pathRange, indices, indexType, transformValues,
transformType, | 184 this->onDrawPaths(args, pathRange, indices, indexType, transformValues,
transformType, |
| 178 count); | 185 count); |
| 179 } | 186 } |
| 187 |
| 180 protected: | 188 protected: |
| 181 GrPathRendering(GrGpu* gpu) | 189 GrPathRendering(GrGpu* gpu) |
| 182 : fGpu(gpu) { | 190 : fGpu(gpu) { |
| 183 } | 191 } |
| 184 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; | 192 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; |
| 185 virtual void onDrawPath(const DrawPathArgs&, const GrPath*) = 0; | 193 virtual void onDrawPath(const DrawPathArgs&, const GrPath*) = 0; |
| 186 virtual void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void
*, PathIndexType, | 194 virtual void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void
*, PathIndexType, |
| 187 const float[], PathTransformType, int) = 0; | 195 const float[], PathTransformType, int) = 0; |
| 188 | 196 |
| 189 GrGpu* fGpu; | 197 GrGpu* fGpu; |
| 190 private: | 198 private: |
| 191 GrPathRendering& operator=(const GrPathRendering&); | 199 GrPathRendering& operator=(const GrPathRendering&); |
| 192 }; | 200 }; |
| 193 | 201 |
| 194 #endif | 202 #endif |
| OLD | NEW |