blob: e3fd71507aa5520de9e50a45197360996d539781 [file] [log] [blame]
bsalomon@google.comffca4002011-02-22 20:34:01 +00001/*
2 Copyright 2011 Google Inc.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17#ifndef GrPathRenderer_DEFINED
18#define GrPathRenderer_DEFINED
19
20#include "GrDrawTarget.h"
21
22class GrPathIter;
23struct GrPoint;
24
25/**
26 * A path renderer.
27 */
28class GrPathRenderer {
29public:
30 /**
31 * Draws a path into the draw target. The target will already have its draw
32 * state configured for the draw.
33 * @param target the target to draw into.
34 * @param stages indicates which stages the are already
35 * in use. All enabled stages expect positions
36 * as texture coordinates. The path renderer
37 * use the remaining stages for its path
38 * filling algorithm.
39 * @param path the path to draw.
40 * @param fill the fill rule to apply.
41 * @param translate optional additional translation to apply to
42 * the path NULL means (0,0).
43 */
44 virtual void drawPath(GrDrawTarget* target,
45 GrDrawTarget::StageBitfield stages,
46 GrPathIter* path,
47 GrPathFill fill,
48 const GrPoint* translate) = 0;
49};
50
51class GrDefaultPathRenderer : public GrPathRenderer {
52public:
53 GrDefaultPathRenderer(bool singlePassWindingStencil);
54
55 virtual void drawPath(GrDrawTarget* target,
56 GrDrawTarget::StageBitfield stages,
57 GrPathIter* path,
58 GrPathFill fill,
59 const GrPoint* translate);
60private:
61 bool fSinglePassWindingStencil;
62};
63
64#endif