cb4012f3d1e16692fb72f6dd8e5f3e9018b35837
[platform/upstream/libSkiaSharp.git] / src / gpu / GrStencilAndCoverPathRenderer.h
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
24     static GrPathRenderer* Create(GrContext*);
25
26     virtual ~GrStencilAndCoverPathRenderer();
27
28     virtual bool canDrawPath(const GrDrawTarget*,
29                              const GrPipelineBuilder*,
30                              const SkMatrix& viewMatrix,
31                              const SkPath&,
32                              const SkStrokeRec&,
33                              bool antiAlias) const SK_OVERRIDE;
34
35 protected:
36     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
37                                                const GrPipelineBuilder*,
38                                                const SkPath&,
39                                                const SkStrokeRec&) const SK_OVERRIDE;
40
41     virtual bool onDrawPath(GrDrawTarget*,
42                             GrPipelineBuilder*,
43                             GrColor,
44                             const SkMatrix& viewMatrix,
45                             const SkPath&,
46                             const SkStrokeRec&,
47                             bool antiAlias) SK_OVERRIDE;
48
49     virtual void onStencilPath(GrDrawTarget*,
50                                GrPipelineBuilder*,
51                                const SkMatrix& viewMatrix,
52                                const SkPath&,
53                                const SkStrokeRec&) SK_OVERRIDE;
54
55 private:
56     GrStencilAndCoverPathRenderer(GrGpu*);
57
58     GrGpu* fGpu;
59
60     typedef GrPathRenderer INHERITED;
61 };
62
63 #endif