bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrDefaultPathRenderer_DEFINED |
| 9 | #define GrDefaultPathRenderer_DEFINED |
| 10 | |
| 11 | #include "GrPathRenderer.h" |
| 12 | #include "SkTemplates.h" |
| 13 | |
| 14 | /** |
| 15 | * Subclass that renders the path using the stencil buffer to resolve fill |
| 16 | * rules (e.g. winding, even-odd) |
| 17 | */ |
| 18 | class GR_API GrDefaultPathRenderer : public GrPathRenderer { |
| 19 | public: |
| 20 | GrDefaultPathRenderer(bool separateStencilSupport, |
| 21 | bool stencilWrapOpsSupport); |
| 22 | |
bsalomon@google.com | aeb2160 | 2011-08-30 18:13:44 +0000 | [diff] [blame^] | 23 | virtual bool canDrawPath(const GrDrawTarget* target, |
| 24 | const SkPath& path, |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 25 | GrPathFill fill) const { return true; } |
| 26 | |
| 27 | virtual bool requiresStencilPass(const GrDrawTarget* target, |
| 28 | const SkPath& path, |
| 29 | GrPathFill fill) const; |
| 30 | |
| 31 | virtual void drawPath(GrDrawTarget::StageBitfield stages); |
| 32 | virtual void drawPathToStencil(); |
| 33 | |
| 34 | protected: |
| 35 | virtual void pathWillClear(); |
| 36 | |
| 37 | private: |
| 38 | |
| 39 | void onDrawPath(GrDrawTarget::StageBitfield stages, bool stencilOnly); |
| 40 | |
| 41 | bool createGeom(GrScalar srcSpaceTol, |
| 42 | GrDrawTarget::StageBitfield stages); |
| 43 | |
| 44 | bool fSeparateStencil; |
| 45 | bool fStencilWrapOps; |
| 46 | |
| 47 | int fSubpathCount; |
| 48 | SkAutoSTMalloc<8, uint16_t> fSubpathVertCount; |
| 49 | int fIndexCnt; |
| 50 | int fVertexCnt; |
| 51 | GrScalar fPreviousSrcTol; |
| 52 | GrDrawTarget::StageBitfield fPreviousStages; |
| 53 | GrPrimitiveType fPrimitiveType; |
| 54 | bool fUseIndexedDraw; |
| 55 | |
| 56 | typedef GrPathRenderer INHERITED; |
| 57 | }; |
| 58 | |
| 59 | #endif |