blob: 9ebcec98582351ddfc8ed04201280ff6a86e3d6a [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
bsalomon@google.com45a15f52012-12-10 19:10:17 +000024 static GrPathRenderer* Create(GrContext*);
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000025
26 virtual ~GrStencilAndCoverPathRenderer();
27
bsalomon@google.com45a15f52012-12-10 19:10:17 +000028 virtual bool canDrawPath(const SkPath&,
sugoi@google.com5f74cf82012-12-17 21:16:45 +000029 const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000030 const GrDrawTarget*,
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000031 bool antiAlias) const SK_OVERRIDE;
32
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000033protected:
bsalomon@google.com45a15f52012-12-10 19:10:17 +000034 virtual StencilSupport onGetStencilSupport(const SkPath&,
sugoi@google.com5f74cf82012-12-17 21:16:45 +000035 const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000036 const GrDrawTarget*) const SK_OVERRIDE;
37
38 virtual bool onDrawPath(const SkPath&,
sugoi@google.com5f74cf82012-12-17 21:16:45 +000039 const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000040 GrDrawTarget*,
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000041 bool antiAlias) SK_OVERRIDE;
42
skia.committer@gmail.comc7b4be72012-12-11 02:01:20 +000043 virtual void onStencilPath(const SkPath&,
sugoi@google.com5f74cf82012-12-17 21:16:45 +000044 const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000045 GrDrawTarget*) SK_OVERRIDE;
46
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000047private:
bsalomon@google.com45a15f52012-12-10 19:10:17 +000048 GrStencilAndCoverPathRenderer(GrGpu*);
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000049
50 GrGpu* fGpu;
51
52 typedef GrPathRenderer INHERITED;
53};
54
55#endif