blob: 3b29919f9ef93d44a29b4f4932035954a3224298 [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;
bsalomon@google.com39ee0ff2011-12-06 15:32:52 +000024 virtual void drawPath(GrDrawState::StageMask 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
bsalomon@google.com39ee0ff2011-12-06 15:32:52 +000038 bool createGeom(GrDrawState::StageMask stages);
bsalomon@google.comaeb21602011-08-30 18:13:44 +000039
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 :(
bsalomon@google.com39ee0ff2011-12-06 15:32:52 +000044 GrDrawState::StageMask fPreviousStages;
bsalomon@google.comaeb21602011-08-30 18:13:44 +000045 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