blob: aa481e5c9cb37e2b3a7be3d2ac357485f71033b3 [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*,
joshualitt2e3b3e32014-12-09 13:31:14 -080037 GrColor,
joshualitt9853cce2014-11-17 14:22:48 -080038 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000039 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000040 bool antiAlias) SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000041
joshualitt9853cce2014-11-17 14:22:48 -080042 virtual void onStencilPath(GrDrawTarget*,
43 GrDrawState*,
44 const SkPath&,
45 const SkStrokeRec&) SK_OVERRIDE;
bsalomon@google.com45a15f52012-12-10 19:10:17 +000046
joshualitt9853cce2014-11-17 14:22:48 -080047 bool internalDrawPath(GrDrawTarget*,
48 GrDrawState*,
joshualitt2e3b3e32014-12-09 13:31:14 -080049 GrColor,
joshualitt9853cce2014-11-17 14:22:48 -080050 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000051 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000052 bool stencilOnly);
53
joshualitt9853cce2014-11-17 14:22:48 -080054 bool createGeom(GrDrawTarget*,
55 GrDrawState*,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000056 GrPrimitiveType*,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000057 int* vertexCnt,
bsalomon@google.comb3729422012-03-07 19:13:28 +000058 int* indexCnt,
joshualitt9853cce2014-11-17 14:22:48 -080059 GrDrawTarget::AutoReleaseGeometry*,
60 const SkPath&,
61 const SkStrokeRec&,
62 SkScalar srcSpaceTol);
bsalomon@google.com30085192011-08-19 15:42:31 +000063
64 bool fSeparateStencil;
65 bool fStencilWrapOps;
66
bsalomon@google.com30085192011-08-19 15:42:31 +000067 typedef GrPathRenderer INHERITED;
68};
69
70#endif