blob: c1d61dcaf723da2415296a7bc71cf36dc0ac7ca8 [file] [log] [blame]
bsalomon@google.comaeb21602011-08-30 18:13:44 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#ifndef GrAAHairLinePathRenderer_DEFINED
10#define GrAAHairLinePathRenderer_DEFINED
11
12#include "GrPathRenderer.h"
13
14class GrAAHairLinePathRenderer : public GrPathRenderer {
15public:
16 virtual ~GrAAHairLinePathRenderer();
17
18 static GrPathRenderer* Create(GrContext* context);
19 // GrPathRenderer overrides
20 virtual bool supportsAA(GrDrawTarget* target,
21 const SkPath& path,
22 GrPathFill fill);
23 virtual bool canDrawPath(const GrDrawTarget* target,
24 const SkPath& path,
25 GrPathFill fill) const;
26 virtual void drawPath(GrDrawTarget::StageBitfield stages);
27
28protected:
29
30 // GrPathRenderer overrides
31 virtual void pathWillClear();
32
33private:
34 void resetGeom();
35
36 static bool CanBeUsed(const GrContext* context);
37 GrAAHairLinePathRenderer(const GrContext* context,
38 const GrIndexBuffer* fLinesIndexBuffer,
39 const GrIndexBuffer* fQuadsIndexBuffer);
40
41 bool createGeom(GrDrawTarget::StageBitfield stages);
42
43 GrContext* fContext;
44 const GrIndexBuffer* fLinesIndexBuffer;
45 const GrIndexBuffer* fQuadsIndexBuffer;
46
47 // have to recreate geometry if stages in use changes :(
48 GrDrawTarget::StageBitfield fPreviousStages;
49 int fPreviousRTHeight;
bsalomon@google.comdbeeac32011-09-12 14:59:34 +000050 SkVector fPreviousTranslate;
bsalomon@google.comaeb21602011-08-30 18:13:44 +000051 GrIRect fClipRect;
52
53 // this path renderer draws everything in device coordinates
54 GrMatrix fPreviousViewMatrix;
55 int fLineSegmentCnt;
56 int fQuadCnt;
57
58 typedef GrPathRenderer INHERITED;
59};
60
61
62#endif
63