blob: 1d561fa4c2b57bad83a7e242d4200f4e5de524fa [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
bsalomon@google.com289533a2011-10-27 12:34:25 +000020 virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
bsalomon@google.comaeb21602011-08-30 18:13:44 +000021 const SkPath& path,
bsalomon@google.com289533a2011-10-27 12:34:25 +000022 GrPathFill fill,
23 bool antiAlias) const SK_OVERRIDE;
24 virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
bsalomon@google.comaeb21602011-08-30 18:13:44 +000025
26protected:
27
28 // GrPathRenderer overrides
bsalomon@google.com289533a2011-10-27 12:34:25 +000029 virtual void pathWillClear() SK_OVERRIDE;
bsalomon@google.comaeb21602011-08-30 18:13:44 +000030
31private:
32 void resetGeom();
33
bsalomon@google.comaeb21602011-08-30 18:13:44 +000034 GrAAHairLinePathRenderer(const GrContext* context,
35 const GrIndexBuffer* fLinesIndexBuffer,
36 const GrIndexBuffer* fQuadsIndexBuffer);
37
38 bool createGeom(GrDrawTarget::StageBitfield stages);
39
bsalomon@google.comaeb21602011-08-30 18:13:44 +000040 const GrIndexBuffer* fLinesIndexBuffer;
41 const GrIndexBuffer* fQuadsIndexBuffer;
42
43 // have to recreate geometry if stages in use changes :(
44 GrDrawTarget::StageBitfield fPreviousStages;
45 int fPreviousRTHeight;
bsalomon@google.comdbeeac32011-09-12 14:59:34 +000046 SkVector fPreviousTranslate;
bsalomon@google.comaeb21602011-08-30 18:13:44 +000047 GrIRect fClipRect;
48
49 // this path renderer draws everything in device coordinates
50 GrMatrix fPreviousViewMatrix;
51 int fLineSegmentCnt;
52 int fQuadCnt;
53
54 typedef GrPathRenderer INHERITED;
55};
56
57
58#endif
59