blob: 008eac2e834eab89d1cd701240c605b11e683e00 [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&,
kkinnunen18996512015-04-26 23:18:49 -070026 const GrStrokeInfo&,
mtklein36352bf2015-03-25 18:17:31 -070027 bool antiAlias) const 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&,
kkinnunen18996512015-04-26 23:18:49 -070034 const GrStrokeInfo&) const 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&,
kkinnunen18996512015-04-26 23:18:49 -070041 const GrStrokeInfo&,
mtklein36352bf2015-03-25 18:17:31 -070042 bool antiAlias) 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&,
kkinnunen18996512015-04-26 23:18:49 -070048 const GrStrokeInfo&) 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&,
kkinnunen18996512015-04-26 23:18:49 -070055 const GrStrokeInfo&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000056 bool stencilOnly);
57
bsalomon@google.com30085192011-08-19 15:42:31 +000058 bool fSeparateStencil;
59 bool fStencilWrapOps;
60
bsalomon@google.com30085192011-08-19 15:42:31 +000061 typedef GrPathRenderer INHERITED;
62};
63
64#endif