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 | /** |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 15 | * Subclass that renders the path using the stencil buffer to resolve fill rules |
| 16 | * (e.g. winding, even-odd) |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 17 | */ |
commit-bot@chromium.org | d28063e | 2013-08-20 12:23:06 +0000 | [diff] [blame] | 18 | class SK_API GrDefaultPathRenderer : public GrPathRenderer { |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 19 | public: |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 20 | GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSupport); |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 21 | |
robertphillips@google.com | 3e0c64a | 2014-02-10 16:46:23 +0000 | [diff] [blame] | 22 | virtual bool canDrawPath(const SkStrokeRec&, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 23 | const GrDrawTarget*, |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 24 | bool antiAlias) const SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 25 | |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 26 | private: |
| 27 | |
robertphillips@google.com | 3e0c64a | 2014-02-10 16:46:23 +0000 | [diff] [blame] | 28 | virtual StencilSupport onGetStencilSupport(const SkStrokeRec&, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 29 | const GrDrawTarget*) const SK_OVERRIDE; |
| 30 | |
robertphillips@google.com | 3e0c64a | 2014-02-10 16:46:23 +0000 | [diff] [blame] | 31 | virtual bool onDrawPath(const SkStrokeRec&, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 32 | GrDrawTarget*, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 33 | bool antiAlias) SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 34 | |
robertphillips@google.com | 3e0c64a | 2014-02-10 16:46:23 +0000 | [diff] [blame] | 35 | virtual void onStencilPath(const SkStrokeRec&, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 36 | GrDrawTarget*) SK_OVERRIDE; |
| 37 | |
robertphillips@google.com | 3e0c64a | 2014-02-10 16:46:23 +0000 | [diff] [blame] | 38 | bool internalDrawPath(const SkStrokeRec&, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 39 | GrDrawTarget*, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 40 | bool stencilOnly); |
| 41 | |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 42 | bool createGeom(const SkPath&, |
sugoi@google.com | 5f74cf8 | 2012-12-17 21:16:45 +0000 | [diff] [blame] | 43 | const SkStrokeRec&, |
bsalomon@google.com | 8171288 | 2012-11-01 17:12:34 +0000 | [diff] [blame] | 44 | SkScalar srcSpaceTol, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 45 | GrDrawTarget*, |
| 46 | GrPrimitiveType*, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 47 | int* vertexCnt, |
bsalomon@google.com | b372942 | 2012-03-07 19:13:28 +0000 | [diff] [blame] | 48 | int* indexCnt, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 49 | GrDrawTarget::AutoReleaseGeometry*); |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 50 | |
| 51 | bool fSeparateStencil; |
| 52 | bool fStencilWrapOps; |
| 53 | |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 54 | typedef GrPathRenderer INHERITED; |
| 55 | }; |
| 56 | |
| 57 | #endif |