blob: 56d43707187f0a377f626c215610f8b8e0a29625 [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
robertphillips@google.com3e0c64a2014-02-10 16:46:23 +000022 virtual bool canDrawPath(const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000023 const GrDrawTarget*,
sugoi@google.com12b4e272012-12-06 20:13:11 +000024 bool antiAlias) const SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000025
bsalomon@google.com30085192011-08-19 15:42:31 +000026private:
27
robertphillips@google.com3e0c64a2014-02-10 16:46:23 +000028 virtual StencilSupport onGetStencilSupport(const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000029 const GrDrawTarget*) const SK_OVERRIDE;
30
robertphillips@google.com3e0c64a2014-02-10 16:46:23 +000031 virtual bool onDrawPath(const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000032 GrDrawTarget*,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000033 bool antiAlias) SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000034
robertphillips@google.com3e0c64a2014-02-10 16:46:23 +000035 virtual void onStencilPath(const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000036 GrDrawTarget*) SK_OVERRIDE;
37
robertphillips@google.com3e0c64a2014-02-10 16:46:23 +000038 bool internalDrawPath(const SkStrokeRec&,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000039 GrDrawTarget*,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000040 bool stencilOnly);
41
bsalomon@google.com45a15f52012-12-10 19:10:17 +000042 bool createGeom(const SkPath&,
sugoi@google.com5f74cf82012-12-17 21:16:45 +000043 const SkStrokeRec&,
bsalomon@google.com81712882012-11-01 17:12:34 +000044 SkScalar srcSpaceTol,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000045 GrDrawTarget*,
46 GrPrimitiveType*,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000047 int* vertexCnt,
bsalomon@google.comb3729422012-03-07 19:13:28 +000048 int* indexCnt,
bsalomon@google.com45a15f52012-12-10 19:10:17 +000049 GrDrawTarget::AutoReleaseGeometry*);
bsalomon@google.com30085192011-08-19 15:42:31 +000050
51 bool fSeparateStencil;
52 bool fStencilWrapOps;
53
bsalomon@google.com30085192011-08-19 15:42:31 +000054 typedef GrPathRenderer INHERITED;
55};
56
57#endif