blob: 0f90daa27f9e5c42193dd941fdf59f212847df04 [file] [log] [blame]
bsalomon@google.com30085192011-08-19 15:42:31 +00001/*
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/**
bsalomon@google.com45a15f52012-12-10 19:10:17 +000015 * Subclass that renders the path using the stencil buffer to resolve fill rules
16 * (e.g. winding, even-odd)
bsalomon@google.com30085192011-08-19 15:42:31 +000017 */
commit-bot@chromium.orgd28063e2013-08-20 12:23:06 +000018class SK_API GrDefaultPathRenderer : public GrPathRenderer {
bsalomon@google.com30085192011-08-19 15:42:31 +000019public:
bsalomon@google.com45a15f52012-12-10 19:10:17 +000020 GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSupport);
bsalomon@google.com30085192011-08-19 15:42:31 +000021
joshualitt9853cce2014-11-17 14:22:48 -080022 virtual bool canDrawPath(const GrDrawTarget*,
23 const GrDrawState*,
24 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000025 const SkStrokeRec&,
sugoi@google.com12b4e272012-12-06 20:13:11 +000026 bool antiAlias) const SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000027
bsalomon@google.com30085192011-08-19 15:42:31 +000028private:
29
joshualitt9853cce2014-11-17 14:22:48 -080030 virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
31 const GrDrawState*,
32 const SkPath&,
33 const SkStrokeRec&) const SK_OVERRIDE;
bsalomon@google.com45a15f52012-12-10 19:10:17 +000034
joshualitt9853cce2014-11-17 14:22:48 -080035 virtual bool onDrawPath(GrDrawTarget*,
36 GrDrawState*,
37 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000038 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000039 bool antiAlias) SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000040
joshualitt9853cce2014-11-17 14:22:48 -080041 virtual void onStencilPath(GrDrawTarget*,
42 GrDrawState*,
43 const SkPath&,
44 const SkStrokeRec&) SK_OVERRIDE;
bsalomon@google.com45a15f52012-12-10 19:10:17 +000045
joshualitt9853cce2014-11-17 14:22:48 -080046 bool internalDrawPath(GrDrawTarget*,
47 GrDrawState*,
48 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000049 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000050 bool stencilOnly);
51
joshualitt9853cce2014-11-17 14:22:48 -080052 bool createGeom(GrDrawTarget*,
53 GrDrawState*,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000054 GrPrimitiveType*,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000055 int* vertexCnt,
bsalomon@google.comb3729422012-03-07 19:13:28 +000056 int* indexCnt,
joshualitt9853cce2014-11-17 14:22:48 -080057 GrDrawTarget::AutoReleaseGeometry*,
58 const SkPath&,
59 const SkStrokeRec&,
60 SkScalar srcSpaceTol);
bsalomon@google.com30085192011-08-19 15:42:31 +000061
62 bool fSeparateStencil;
63 bool fStencilWrapOps;
64
bsalomon@google.com30085192011-08-19 15:42:31 +000065 typedef GrPathRenderer INHERITED;
66};
67
68#endif