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" | 11 #include "GrContext.h" |
12 #include "GrPaint.h" | 12 #include "GrPaint.h" |
13 | 13 |
14 class GrContext; | 14 class GrContext; |
15 class GrDrawTarget; | 15 class GrDrawTarget; |
16 class GrPaint; | 16 class GrPaint; |
17 struct SkRect; | 17 struct SkRect; |
18 class SkStrokeRec; | 18 class SkStrokeRec; |
19 | 19 |
20 /* | 20 /* |
21 * This class wraps helper functions that draw ovals and roundrects (filled & st
roked) | 21 * This class wraps helper functions that draw ovals and roundrects (filled & st
roked) |
22 */ | 22 */ |
23 class GrOvalRenderer : public SkRefCnt { | 23 class GrOvalRenderer : public SkRefCnt { |
24 public: | 24 public: |
25 SK_DECLARE_INST_COUNT(GrOvalRenderer) | 25 SK_DECLARE_INST_COUNT(GrOvalRenderer) |
26 | 26 |
27 GrOvalRenderer() : fRRectIndexBuffer(NULL), fStrokeRRectIndexBuffer(NULL) {} | 27 GrOvalRenderer(GrGpu* gpu) |
| 28 : fGpu(gpu) |
| 29 , fRRectIndexBuffer(NULL) |
| 30 , fStrokeRRectIndexBuffer(NULL) {} |
28 ~GrOvalRenderer() { | 31 ~GrOvalRenderer() { |
29 this->reset(); | 32 this->reset(); |
30 } | 33 } |
31 | 34 |
32 void reset(); | 35 void reset(); |
33 | 36 |
34 bool drawOval(GrDrawTarget*, | 37 bool drawOval(GrDrawTarget*, |
35 GrDrawState*, | 38 GrDrawState*, |
36 GrColor, | 39 GrColor, |
37 const GrContext*, | |
38 bool useAA, | 40 bool useAA, |
39 const SkRect& oval, | 41 const SkRect& oval, |
40 const SkStrokeRec& stroke); | 42 const SkStrokeRec& stroke); |
41 bool drawRRect(GrDrawTarget*, | 43 bool drawRRect(GrDrawTarget*, |
42 GrDrawState*, | 44 GrDrawState*, |
43 GrColor, | 45 GrColor, |
44 GrContext*, | |
45 bool useAA, | 46 bool useAA, |
46 const SkRRect& rrect, | 47 const SkRRect& rrect, |
47 const SkStrokeRec& stroke); | 48 const SkStrokeRec& stroke); |
48 bool drawDRRect(GrDrawTarget* target, | 49 bool drawDRRect(GrDrawTarget* target, |
49 GrDrawState*, | 50 GrDrawState*, |
50 GrColor, | 51 GrColor, |
51 GrContext* context, | |
52 bool useAA, | 52 bool useAA, |
53 const SkRRect& outer, | 53 const SkRRect& outer, |
54 const SkRRect& inner); | 54 const SkRRect& inner); |
55 | 55 |
56 private: | 56 private: |
57 bool drawEllipse(GrDrawTarget* target, | 57 bool drawEllipse(GrDrawTarget* target, |
58 GrDrawState*, | 58 GrDrawState*, |
59 GrColor, | 59 GrColor, |
60 const GrContext* context, | |
61 bool useCoverageAA, | 60 bool useCoverageAA, |
62 const SkRect& ellipse, | 61 const SkRect& ellipse, |
63 const SkStrokeRec& stroke); | 62 const SkStrokeRec& stroke); |
64 bool drawDIEllipse(GrDrawTarget* target, | 63 bool drawDIEllipse(GrDrawTarget* target, |
65 GrDrawState*, | 64 GrDrawState*, |
66 GrColor, | 65 GrColor, |
67 const GrContext* context, | |
68 bool useCoverageAA, | 66 bool useCoverageAA, |
69 const SkRect& ellipse, | 67 const SkRect& ellipse, |
70 const SkStrokeRec& stroke); | 68 const SkStrokeRec& stroke); |
71 void drawCircle(GrDrawTarget* target, | 69 void drawCircle(GrDrawTarget* target, |
72 GrDrawState*, | 70 GrDrawState*, |
73 GrColor, | 71 GrColor, |
74 const GrContext* context, | |
75 bool useCoverageAA, | 72 bool useCoverageAA, |
76 const SkRect& circle, | 73 const SkRect& circle, |
77 const SkStrokeRec& stroke); | 74 const SkStrokeRec& stroke); |
78 | 75 |
79 GrIndexBuffer* rRectIndexBuffer(bool isStrokeOnly, GrGpu* gpu); | 76 GrIndexBuffer* rRectIndexBuffer(bool isStrokeOnly); |
80 | 77 |
| 78 GrGpu* fGpu; |
81 GrIndexBuffer* fRRectIndexBuffer; | 79 GrIndexBuffer* fRRectIndexBuffer; |
82 GrIndexBuffer* fStrokeRRectIndexBuffer; | 80 GrIndexBuffer* fStrokeRRectIndexBuffer; |
83 | 81 |
84 typedef SkRefCnt INHERITED; | 82 typedef SkRefCnt INHERITED; |
85 }; | 83 }; |
86 | 84 |
87 #endif // GrOvalRenderer_DEFINED | 85 #endif // GrOvalRenderer_DEFINED |
OLD | NEW |