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 | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 23 | |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 24 | virtual bool requiresStencilPass(const SkPath& path, |
| 25 | GrPathFill fill, |
| 26 | const GrDrawTarget* target) const SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 27 | |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 28 | virtual bool canDrawPath(const SkPath& path, |
| 29 | GrPathFill fill, |
| 30 | const GrDrawTarget* target, |
| 31 | bool antiAlias) const SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 32 | |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 33 | virtual void drawPathToStencil(const SkPath& path, |
| 34 | GrPathFill fill, |
| 35 | GrDrawTarget* target) SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 36 | |
| 37 | private: |
| 38 | |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 39 | virtual bool onDrawPath(const SkPath& path, |
| 40 | GrPathFill fill, |
| 41 | const GrVec* translate, |
| 42 | GrDrawTarget* target, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 43 | bool antiAlias) SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 44 | |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 45 | bool internalDrawPath(const SkPath& path, |
| 46 | GrPathFill fill, |
| 47 | const GrVec* translate, |
| 48 | GrDrawTarget* target, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 49 | bool stencilOnly); |
| 50 | |
| 51 | bool createGeom(const SkPath& path, |
| 52 | GrPathFill fill, |
| 53 | const GrVec* translate, |
| 54 | GrScalar srcSpaceTol, |
| 55 | GrDrawTarget* target, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 56 | GrPrimitiveType* primType, |
| 57 | int* vertexCnt, |
bsalomon@google.com | b372942 | 2012-03-07 19:13:28 +0000 | [diff] [blame] | 58 | int* indexCnt, |
| 59 | GrDrawTarget::AutoReleaseGeometry* arg); |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 60 | |
| 61 | bool fSeparateStencil; |
| 62 | bool fStencilWrapOps; |
| 63 | |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 64 | typedef GrPathRenderer INHERITED; |
| 65 | }; |
| 66 | |
| 67 | #endif |