blob: c516552a477732c62a4724fc3bb9d3f979e5263f [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/**
15 * Subclass that renders the path using the stencil buffer to resolve fill
16 * rules (e.g. winding, even-odd)
17 */
18class GR_API GrDefaultPathRenderer : public GrPathRenderer {
19public:
20 GrDefaultPathRenderer(bool separateStencilSupport,
21 bool stencilWrapOpsSupport);
22
bsalomon@google.com30085192011-08-19 15:42:31 +000023
bsalomon@google.comc2099d22012-03-02 21:26:50 +000024 virtual bool requiresStencilPass(const SkPath& path,
25 GrPathFill fill,
26 const GrDrawTarget* target) const SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000027
bsalomon@google.comc2099d22012-03-02 21:26:50 +000028 virtual bool canDrawPath(const SkPath& path,
29 GrPathFill fill,
30 const GrDrawTarget* target,
31 bool antiAlias) const SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000032
bsalomon@google.comc2099d22012-03-02 21:26:50 +000033 virtual void drawPathToStencil(const SkPath& path,
34 GrPathFill fill,
35 GrDrawTarget* target) SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000036
37private:
38
bsalomon@google.comc2099d22012-03-02 21:26:50 +000039 virtual bool onDrawPath(const SkPath& path,
40 GrPathFill fill,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000041 GrDrawTarget* target,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000042 bool antiAlias) SK_OVERRIDE;
bsalomon@google.com30085192011-08-19 15:42:31 +000043
bsalomon@google.comc2099d22012-03-02 21:26:50 +000044 bool internalDrawPath(const SkPath& path,
45 GrPathFill fill,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000046 GrDrawTarget* target,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000047 bool stencilOnly);
48
49 bool createGeom(const SkPath& path,
50 GrPathFill fill,
bsalomon@google.com81712882012-11-01 17:12:34 +000051 SkScalar srcSpaceTol,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000052 GrDrawTarget* target,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000053 GrPrimitiveType* primType,
54 int* vertexCnt,
bsalomon@google.comb3729422012-03-07 19:13:28 +000055 int* indexCnt,
56 GrDrawTarget::AutoReleaseGeometry* arg);
bsalomon@google.com30085192011-08-19 15:42:31 +000057
58 bool fSeparateStencil;
59 bool fStencilWrapOps;
60
bsalomon@google.com30085192011-08-19 15:42:31 +000061 typedef GrPathRenderer INHERITED;
62};
63
64#endif