blob: e44ddb26a7025cb1b87c88bdbdce506ecddb4bb2 [file] [log] [blame]
bsalomon@google.comded4f4b2012-06-28 18:48:06 +00001
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
14class GrContext;
15class 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 */
21class GrStencilAndCoverPathRenderer : public GrPathRenderer {
22public:
23
24 static GrPathRenderer* Create(GrContext* context);
25
26 virtual ~GrStencilAndCoverPathRenderer();
27
28 virtual bool canDrawPath(const SkPath& path,
29 GrPathFill fill,
30 const GrDrawTarget* target,
31 bool antiAlias) const SK_OVERRIDE;
32
33 virtual bool requiresStencilPass(const SkPath& path,
34 GrPathFill fill,
35 const GrDrawTarget* target) const SK_OVERRIDE;
36
37 virtual void drawPathToStencil(const SkPath& path,
38 GrPathFill fill,
39 GrDrawTarget* target) SK_OVERRIDE;
40
41protected:
42 virtual bool onDrawPath(const SkPath& path,
43 GrPathFill fill,
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000044 GrDrawTarget* target,
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000045 bool antiAlias) SK_OVERRIDE;
46
47private:
48 GrStencilAndCoverPathRenderer(GrGpu* gpu);
49
50 GrGpu* fGpu;
51
52 typedef GrPathRenderer INHERITED;
53};
54
55#endif