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 | |
9 #ifndef GrOvalRenderer_DEFINED | 8 #ifndef GrOvalRenderer_DEFINED |
10 #define GrOvalRenderer_DEFINED | 9 #define GrOvalRenderer_DEFINED |
11 | 10 |
12 #include "GrContext.h" | 11 #include "GrContext.h" |
13 #include "GrPaint.h" | 12 #include "GrPaint.h" |
14 #include "GrRefCnt.h" | 13 #include "GrRefCnt.h" |
15 #include "GrRect.h" | |
16 | 14 |
17 class GrContext; | 15 class GrContext; |
18 class GrDrawTarget; | 16 class GrDrawTarget; |
19 class GrPaint; | 17 class GrPaint; |
| 18 struct SkRect; |
20 class SkStrokeRec; | 19 class SkStrokeRec; |
21 | 20 |
22 /* | 21 /* |
23 * This class wraps helper functions that draw ovals and roundrects (filled & st
roked) | 22 * This class wraps helper functions that draw ovals and roundrects (filled & st
roked) |
24 */ | 23 */ |
25 class GrOvalRenderer : public GrRefCnt { | 24 class GrOvalRenderer : public GrRefCnt { |
26 public: | 25 public: |
27 SK_DECLARE_INST_COUNT(GrOvalRenderer) | 26 SK_DECLARE_INST_COUNT(GrOvalRenderer) |
28 | 27 |
29 GrOvalRenderer() : fRRectIndexBuffer(NULL) {} | 28 GrOvalRenderer() : fRRectIndexBuffer(NULL) {} |
30 ~GrOvalRenderer() { | 29 ~GrOvalRenderer() { |
31 this->reset(); | 30 this->reset(); |
32 } | 31 } |
33 | 32 |
34 void reset(); | 33 void reset(); |
35 | 34 |
36 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA, | 35 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA, |
37 const GrRect& oval, const SkStrokeRec& stroke); | 36 const SkRect& oval, const SkStrokeRec& stroke); |
38 bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA, | 37 bool drawSimpleRRect(GrDrawTarget* target, GrContext* context, bool useAA, |
39 const SkRRect& rrect, const SkStrokeRec& stroke); | 38 const SkRRect& rrect, const SkStrokeRec& stroke); |
40 | 39 |
41 private: | 40 private: |
42 bool drawEllipse(GrDrawTarget* target, bool useAA, | 41 bool drawEllipse(GrDrawTarget* target, bool useAA, |
43 const GrRect& ellipse, | 42 const SkRect& ellipse, |
44 const SkStrokeRec& stroke); | 43 const SkStrokeRec& stroke); |
45 void drawCircle(GrDrawTarget* target, bool useAA, | 44 void drawCircle(GrDrawTarget* target, bool useAA, |
46 const GrRect& circle, | 45 const SkRect& circle, |
47 const SkStrokeRec& stroke); | 46 const SkStrokeRec& stroke); |
48 | 47 |
49 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu); | 48 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu); |
50 | 49 |
51 GrIndexBuffer* fRRectIndexBuffer; | 50 GrIndexBuffer* fRRectIndexBuffer; |
52 | 51 |
53 typedef GrRefCnt INHERITED; | 52 typedef GrRefCnt INHERITED; |
54 }; | 53 }; |
55 | 54 |
56 #endif // GrOvalRenderer_DEFINED | 55 #endif // GrOvalRenderer_DEFINED |
OLD | NEW |