OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrOvalRenderer_DEFINED | 8 #ifndef GrOvalRenderer_DEFINED |
9 #define GrOvalRenderer_DEFINED | 9 #define GrOvalRenderer_DEFINED |
10 | 10 |
11 #include "GrContext.h" | |
12 #include "GrPaint.h" | 11 #include "GrPaint.h" |
13 | 12 |
14 class GrContext; | |
15 class GrDrawTarget; | 13 class GrDrawTarget; |
16 class GrPaint; | 14 class GrPipelineBuilder; |
17 struct SkRect; | 15 struct SkRect; |
18 class SkStrokeRec; | 16 class SkStrokeRec; |
19 | 17 |
20 /* | 18 /* |
21 * This class wraps helper functions that draw ovals and roundrects (filled & st
roked) | 19 * This class wraps helper functions that draw ovals and roundrects (filled & st
roked) |
22 */ | 20 */ |
23 class GrOvalRenderer : public SkRefCnt { | 21 class GrOvalRenderer { |
24 public: | 22 public: |
25 SK_DECLARE_INST_COUNT(GrOvalRenderer) | 23 static bool DrawOval(GrDrawTarget*, |
26 | 24 GrPipelineBuilder*, |
27 bool drawOval(GrDrawTarget*, | 25 GrColor, |
28 GrPipelineBuilder*, | 26 const SkMatrix& viewMatrix, |
29 GrColor, | 27 bool useAA, |
30 const SkMatrix& viewMatrix, | 28 const SkRect& oval, |
31 bool useAA, | 29 const SkStrokeRec& stroke); |
32 const SkRect& oval, | 30 static bool DrawRRect(GrDrawTarget*, |
33 const SkStrokeRec& stroke); | 31 GrPipelineBuilder*, |
34 bool drawRRect(GrDrawTarget*, | 32 GrColor, |
35 GrPipelineBuilder*, | 33 const SkMatrix& viewMatrix, |
36 GrColor, | 34 bool useAA, |
37 const SkMatrix& viewMatrix, | 35 const SkRRect& rrect, |
38 bool useAA, | 36 const SkStrokeRec& stroke); |
39 const SkRRect& rrect, | 37 static bool DrawDRRect(GrDrawTarget* target, |
40 const SkStrokeRec& stroke); | 38 GrPipelineBuilder*, |
41 bool drawDRRect(GrDrawTarget* target, | 39 GrColor, |
42 GrPipelineBuilder*, | 40 const SkMatrix& viewMatrix, |
43 GrColor, | 41 bool useAA, |
44 const SkMatrix& viewMatrix, | 42 const SkRRect& outer, |
45 bool useAA, | 43 const SkRRect& inner); |
46 const SkRRect& outer, | |
47 const SkRRect& inner); | |
48 | 44 |
49 private: | 45 private: |
50 bool drawEllipse(GrDrawTarget* target, | 46 GrOvalRenderer(); |
51 GrPipelineBuilder*, | |
52 GrColor, | |
53 const SkMatrix& viewMatrix, | |
54 bool useCoverageAA, | |
55 const SkRect& ellipse, | |
56 const SkStrokeRec& stroke); | |
57 bool drawDIEllipse(GrDrawTarget* target, | |
58 GrPipelineBuilder*, | |
59 GrColor, | |
60 const SkMatrix& viewMatrix, | |
61 bool useCoverageAA, | |
62 const SkRect& ellipse, | |
63 const SkStrokeRec& stroke); | |
64 void drawCircle(GrDrawTarget* target, | |
65 GrPipelineBuilder*, | |
66 GrColor, | |
67 const SkMatrix& viewMatrix, | |
68 bool useCoverageAA, | |
69 const SkRect& circle, | |
70 const SkStrokeRec& stroke); | |
71 | 47 |
72 typedef SkRefCnt INHERITED; | 48 static bool DrawEllipse(GrDrawTarget* target, |
| 49 GrPipelineBuilder*, |
| 50 GrColor, |
| 51 const SkMatrix& viewMatrix, |
| 52 bool useCoverageAA, |
| 53 const SkRect& ellipse, |
| 54 const SkStrokeRec& stroke); |
| 55 static bool DrawDIEllipse(GrDrawTarget* target, |
| 56 GrPipelineBuilder*, |
| 57 GrColor, |
| 58 const SkMatrix& viewMatrix, |
| 59 bool useCoverageAA, |
| 60 const SkRect& ellipse, |
| 61 const SkStrokeRec& stroke); |
| 62 static void DrawCircle(GrDrawTarget* target, |
| 63 GrPipelineBuilder*, |
| 64 GrColor, |
| 65 const SkMatrix& viewMatrix, |
| 66 bool useCoverageAA, |
| 67 const SkRect& circle, |
| 68 const SkStrokeRec& stroke); |
73 }; | 69 }; |
74 | 70 |
75 #endif // GrOvalRenderer_DEFINED | 71 #endif // GrOvalRenderer_DEFINED |
OLD | NEW |