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