aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOvalRenderer.h
blob: d591ffeed38d80db1217f1d4603371f2e84c5cb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrOvalRenderer_DEFINED
#define GrOvalRenderer_DEFINED

#include "GrPaint.h"

class GrDrawTarget;
class GrPipelineBuilder;
struct SkRect;
class SkStrokeRec;

/*
 * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
 */
class GrOvalRenderer {
public:
    static bool DrawOval(GrDrawTarget*,
                         const GrPipelineBuilder&,
                         GrColor,
                         const SkMatrix& viewMatrix,
                         bool useAA,
                         const SkRect& oval,
                         const SkStrokeRec& stroke);
    static bool DrawRRect(GrDrawTarget*,
                          const GrPipelineBuilder&,
                          GrColor,
                          const SkMatrix& viewMatrix,
                          bool useAA,
                          const SkRRect& rrect,
                          const SkStrokeRec& stroke);
    static bool DrawDRRect(GrDrawTarget* target,
                           const GrPipelineBuilder&,
                           GrColor,
                           const SkMatrix& viewMatrix,
                           bool useAA,
                           const SkRRect& outer,
                           const SkRRect& inner);

private:
    GrOvalRenderer();

    static bool DrawEllipse(GrDrawTarget* target,
                            const GrPipelineBuilder&,
                            GrColor,
                            const SkMatrix& viewMatrix,
                            bool useCoverageAA,
                            const SkRect& ellipse,
                            const SkStrokeRec& stroke);
    static bool DrawDIEllipse(GrDrawTarget* target,
                              const GrPipelineBuilder&,
                              GrColor,
                              const SkMatrix& viewMatrix,
                              bool useCoverageAA,
                              const SkRect& ellipse,
                              const SkStrokeRec& stroke);
    static void DrawCircle(GrDrawTarget* target,
                           const GrPipelineBuilder&,
                           GrColor,
                           const SkMatrix& viewMatrix,
                           bool useCoverageAA,
                           const SkRect& circle,
                           const SkStrokeRec& stroke);
};

#endif // GrOvalRenderer_DEFINED