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 rules
16  * (e.g. winding, even-odd)
17  */
18 class SK_API GrDefaultPathRenderer : public GrPathRenderer {
19 public:
20     GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSupport);
21 
22     virtual bool canDrawPath(const GrDrawTarget*,
23                              const GrPipelineBuilder*,
24                              const SkMatrix& viewMatrix,
25                              const SkPath&,
26                              const GrStrokeInfo&,
27                              bool antiAlias) const override;
28 
29 private:
30 
31     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
32                                                const GrPipelineBuilder*,
33                                                const SkPath&,
34                                                const GrStrokeInfo&) const override;
35 
36     virtual bool onDrawPath(GrDrawTarget*,
37                             GrPipelineBuilder*,
38                             GrColor,
39                             const SkMatrix& viewMatrix,
40                             const SkPath&,
41                             const GrStrokeInfo&,
42                             bool antiAlias) override;
43 
44     virtual void onStencilPath(GrDrawTarget*,
45                                GrPipelineBuilder*,
46                                const SkMatrix& viewMatrix,
47                                const SkPath&,
48                                const GrStrokeInfo&) override;
49 
50     bool internalDrawPath(GrDrawTarget*,
51                           GrPipelineBuilder*,
52                           GrColor,
53                           const SkMatrix& viewMatrix,
54                           const SkPath&,
55                           const GrStrokeInfo&,
56                           bool stencilOnly);
57 
58     bool    fSeparateStencil;
59     bool    fStencilWrapOps;
60 
61     typedef GrPathRenderer INHERITED;
62 };
63 
64 #endif
65