blob: 0204506e29dd5e0afdf2fe1f8bfaec61a7fb375f [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,
44 const GrVec* translate,
45 GrDrawTarget* target,
46 GrDrawState::StageMask stageMask,
47 bool antiAlias) SK_OVERRIDE;
48
49private:
50 GrStencilAndCoverPathRenderer(GrGpu* gpu);
51
52 GrGpu* fGpu;
53
54 typedef GrPathRenderer INHERITED;
55};
56
57#endif