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