bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #ifndef GrBuiltInPathRenderer_DEFINED |
| 10 | #define GrBuiltInPathRenderer_DEFINED |
| 11 | |
| 12 | #include "GrPathRenderer.h" |
| 13 | |
| 14 | class GrContext; |
| 15 | class GrGpu; |
| 16 | |
| 17 | /** |
| 18 | * Uses GrGpu::stencilPath followed by a cover rectangle. This subclass doesn't apply AA; it relies |
| 19 | * on the target having MSAA if AA is desired. |
| 20 | */ |
| 21 | class GrStencilAndCoverPathRenderer : public GrPathRenderer { |
| 22 | public: |
| 23 | |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 24 | static GrPathRenderer* Create(GrContext*); |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 25 | |
| 26 | virtual ~GrStencilAndCoverPathRenderer(); |
| 27 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 28 | virtual bool canDrawPath(const GrDrawTarget*, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 29 | const GrPipelineBuilder*, |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 30 | const SkMatrix& viewMatrix, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 31 | const SkPath&, |
robertphillips@google.com | e79f320 | 2014-02-11 16:30:21 +0000 | [diff] [blame] | 32 | const SkStrokeRec&, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 33 | bool antiAlias) const override; |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 34 | |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 35 | protected: |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 36 | virtual StencilSupport onGetStencilSupport(const GrDrawTarget*, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 37 | const GrPipelineBuilder*, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 38 | const SkPath&, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 39 | const SkStrokeRec&) const override; |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 40 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 41 | virtual bool onDrawPath(GrDrawTarget*, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 42 | GrPipelineBuilder*, |
joshualitt | 2e3b3e3 | 2014-12-09 13:31:14 -0800 | [diff] [blame] | 43 | GrColor, |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 44 | const SkMatrix& viewMatrix, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 45 | const SkPath&, |
robertphillips@google.com | e79f320 | 2014-02-11 16:30:21 +0000 | [diff] [blame] | 46 | const SkStrokeRec&, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 47 | bool antiAlias) override; |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 48 | |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 49 | virtual void onStencilPath(GrDrawTarget*, |
egdaniel | 8dd688b | 2015-01-22 10:16:09 -0800 | [diff] [blame] | 50 | GrPipelineBuilder*, |
joshualitt | 8059eb9 | 2014-12-29 15:10:07 -0800 | [diff] [blame] | 51 | const SkMatrix& viewMatrix, |
joshualitt | 9853cce | 2014-11-17 14:22:48 -0800 | [diff] [blame] | 52 | const SkPath&, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 53 | const SkStrokeRec&) override; |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 54 | |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 55 | private: |
bsalomon@google.com | 45a15f5 | 2012-12-10 19:10:17 +0000 | [diff] [blame] | 56 | GrStencilAndCoverPathRenderer(GrGpu*); |
bsalomon@google.com | ded4f4b | 2012-06-28 18:48:06 +0000 | [diff] [blame] | 57 | |
| 58 | GrGpu* fGpu; |
| 59 | |
| 60 | typedef GrPathRenderer INHERITED; |
| 61 | }; |
| 62 | |
| 63 | #endif |