blob: 5a805e5f7bc10d6cc14bba88c5ba5f660e0dce5d [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*,
egdaniel8dd688b2015-01-22 10:16:09 -080023 const GrPipelineBuilder*,
joshualitt8059eb92014-12-29 15:10:07 -080024 const SkMatrix& viewMatrix,
joshualitt9853cce2014-11-17 14:22:48 -080025 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000026 const SkStrokeRec&,
sugoi@google.com12b4e272012-12-06 20:13:11 +000027 bool antiAlias) const SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000028
bsalomon@google.com30085192011-08-19 15:42:31 +000029private:
30
joshualitt9853cce2014-11-17 14:22:48 -080031 virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
egdaniel8dd688b2015-01-22 10:16:09 -080032 const GrPipelineBuilder*,
joshualitt9853cce2014-11-17 14:22:48 -080033 const SkPath&,
34 const SkStrokeRec&) const SK_OVERRIDE;
bsalomon@google.com45a15f52012-12-10 19:10:17 +000035
joshualitt9853cce2014-11-17 14:22:48 -080036 virtual bool onDrawPath(GrDrawTarget*,
egdaniel8dd688b2015-01-22 10:16:09 -080037 GrPipelineBuilder*,
joshualitt2e3b3e32014-12-09 13:31:14 -080038 GrColor,
joshualitt8059eb92014-12-29 15:10:07 -080039 const SkMatrix& viewMatrix,
joshualitt9853cce2014-11-17 14:22:48 -080040 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000041 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000042 bool antiAlias) SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000043
joshualitt9853cce2014-11-17 14:22:48 -080044 virtual void onStencilPath(GrDrawTarget*,
egdaniel8dd688b2015-01-22 10:16:09 -080045 GrPipelineBuilder*,
joshualitt8059eb92014-12-29 15:10:07 -080046 const SkMatrix& viewMatrix,
joshualitt9853cce2014-11-17 14:22:48 -080047 const SkPath&,
48 const SkStrokeRec&) SK_OVERRIDE;
bsalomon@google.com45a15f52012-12-10 19:10:17 +000049
joshualitt9853cce2014-11-17 14:22:48 -080050 bool internalDrawPath(GrDrawTarget*,
egdaniel8dd688b2015-01-22 10:16:09 -080051 GrPipelineBuilder*,
joshualitt2e3b3e32014-12-09 13:31:14 -080052 GrColor,
joshualitt8059eb92014-12-29 15:10:07 -080053 const SkMatrix& viewMatrix,
joshualitt9853cce2014-11-17 14:22:48 -080054 const SkPath&,
robertphillips@google.come79f3202014-02-11 16:30:21 +000055 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000056 bool stencilOnly);
57
joshualitt9853cce2014-11-17 14:22:48 -080058 bool createGeom(GrDrawTarget*,
egdaniel8dd688b2015-01-22 10:16:09 -080059 GrPipelineBuilder*,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000060 GrPrimitiveType*,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000061 int* vertexCnt,
bsalomon@google.comb3729422012-03-07 19:13:28 +000062 int* indexCnt,
joshualitt9853cce2014-11-17 14:22:48 -080063 GrDrawTarget::AutoReleaseGeometry*,
64 const SkPath&,
65 const SkStrokeRec&,
66 SkScalar srcSpaceTol);
bsalomon@google.com30085192011-08-19 15:42:31 +000067
68 bool fSeparateStencil;
69 bool fStencilWrapOps;
70
bsalomon@google.com30085192011-08-19 15:42:31 +000071 typedef GrPathRenderer INHERITED;
72};
73
74#endif