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 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 22 | virtual bool canDrawPath(const GrDrawTarget*, |
| 23 | const GrDrawState*, |
| 24 | const SkPath&, |
robertphillips@google.com | e79f320 | 2014-02-11 16:30:21 +0000 | [diff] [blame] | 25 | const SkStrokeRec&, |
sugoi@google.com | 12b4e27 | 2012-12-06 20:13:11 +0000 | [diff] [blame] | 26 | bool antiAlias) const SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 27 | |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 28 | private: |
| 29 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 30 | virtual StencilSupport onGetStencilSupport(const GrDrawTarget*, |
| 31 | const GrDrawState*, |
| 32 | const SkPath&, |
| 33 | const SkStrokeRec&) const SK_OVERRIDE; |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 34 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 35 | virtual bool onDrawPath(GrDrawTarget*, |
| 36 | GrDrawState*, |
| 37 | const SkPath&, |
robertphillips@google.com | e79f320 | 2014-02-11 16:30:21 +0000 | [diff] [blame] | 38 | const SkStrokeRec&, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 39 | bool antiAlias) SK_OVERRIDE; |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 40 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 41 | virtual void onStencilPath(GrDrawTarget*, |
| 42 | GrDrawState*, |
| 43 | const SkPath&, |
| 44 | const SkStrokeRec&) SK_OVERRIDE; |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 45 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 46 | bool internalDrawPath(GrDrawTarget*, |
| 47 | GrDrawState*, |
| 48 | const SkPath&, |
robertphillips@google.com | e79f320 | 2014-02-11 16:30:21 +0000 | [diff] [blame] | 49 | const SkStrokeRec&, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 50 | bool stencilOnly); |
| 51 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 52 | bool createGeom(GrDrawTarget*, |
| 53 | GrDrawState*, |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 54 | GrPrimitiveType*, |
bsalomon@google.com | c2099d2 | 2012-03-02 21:26:50 +0000 | [diff] [blame] | 55 | int* vertexCnt, |
bsalomon@google.com | b372942 | 2012-03-07 19:13:28 +0000 | [diff] [blame] | 56 | int* indexCnt, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame^] | 57 | GrDrawTarget::AutoReleaseGeometry*, |
| 58 | const SkPath&, |
| 59 | const SkStrokeRec&, |
| 60 | SkScalar srcSpaceTol); |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 61 | |
| 62 | bool fSeparateStencil; |
| 63 | bool fStencilWrapOps; |
| 64 | |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame] | 65 | typedef GrPathRenderer INHERITED; |
| 66 | }; |
| 67 | |
| 68 | #endif |