blob: 5b7b785bc70d5cacf2100794955e728fae1ad51f [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);
bsalomon@google.comaeb21602011-08-30 18:13:44 +000019
joshualitt9853cce2014-11-17 14:22:48 -080020 virtual bool canDrawPath(const GrDrawTarget*,
21 const GrDrawState*,
22 const SkPath&,
23 const SkStrokeRec&,
sugoi@google.com12b4e272012-12-06 20:13:11 +000024 bool antiAlias) const SK_OVERRIDE;
skia.committer@gmail.com74758112013-08-17 07:01:54 +000025
jvanverth@google.com681ccf02013-08-16 14:51:51 +000026 typedef SkTArray<SkPoint, true> PtArray;
27 typedef SkTArray<int, true> IntArray;
28 typedef SkTArray<float, true> FloatArray;
skia.committer@gmail.com74758112013-08-17 07:01:54 +000029
bsalomon@google.comaeb21602011-08-30 18:13:44 +000030protected:
joshualitt9853cce2014-11-17 14:22:48 -080031 virtual bool onDrawPath(GrDrawTarget*,
32 GrDrawState*,
joshualitt2e3b3e32014-12-09 13:31:14 -080033 GrColor,
joshualitt9853cce2014-11-17 14:22:48 -080034 const SkPath&,
35 const SkStrokeRec&,
bsalomon@google.comc2099d22012-03-02 21:26:50 +000036 bool antiAlias) SK_OVERRIDE;
rmistry@google.comd6176b02012-08-23 18:14:13 +000037
bsalomon@google.comaeb21602011-08-30 18:13:44 +000038private:
bsalomon@google.comaeb21602011-08-30 18:13:44 +000039 GrAAHairLinePathRenderer(const GrContext* context,
40 const GrIndexBuffer* fLinesIndexBuffer,
41 const GrIndexBuffer* fQuadsIndexBuffer);
42
joshualitt9853cce2014-11-17 14:22:48 -080043 bool createLineGeom(GrDrawTarget* target,
44 GrDrawState*,
joshualitt2e3b3e32014-12-09 13:31:14 -080045 uint8_t coverage,
joshualitt56995b52014-12-11 15:44:02 -080046 size_t vertexStride,
jvanverth@google.com681ccf02013-08-16 14:51:51 +000047 GrDrawTarget::AutoReleaseGeometry* arg,
joshualitt9853cce2014-11-17 14:22:48 -080048 SkRect* devBounds,
49 const SkPath& path,
50 const PtArray& lines,
51 int lineCnt);
skia.committer@gmail.com74758112013-08-17 07:01:54 +000052
joshualitt9853cce2014-11-17 14:22:48 -080053 bool createBezierGeom(GrDrawTarget* target,
54 GrDrawState*,
55 GrDrawTarget::AutoReleaseGeometry* arg,
56 SkRect* devBounds,
57 const SkPath& path,
jvanverth@google.com681ccf02013-08-16 14:51:51 +000058 const PtArray& quads,
59 int quadCnt,
60 const PtArray& conics,
61 int conicCnt,
62 const IntArray& qSubdivs,
joshualitt2dd1ae02014-12-03 06:24:10 -080063 const FloatArray& cWeights,
64 size_t vertexStride);
bsalomon@google.comaeb21602011-08-30 18:13:44 +000065
bsalomon@google.comaeb21602011-08-30 18:13:44 +000066 const GrIndexBuffer* fLinesIndexBuffer;
67 const GrIndexBuffer* fQuadsIndexBuffer;
68
bsalomon@google.comaeb21602011-08-30 18:13:44 +000069 typedef GrPathRenderer INHERITED;
70};
71
72
73#endif