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() : fRRectIndexBuffer(NULL) {} |
28 ~GrOvalRenderer() { | 28 ~GrOvalRenderer() { |
29 this->reset(); | 29 this->reset(); |
30 } | 30 } |
31 | 31 |
32 void reset(); | 32 void reset(); |
33 | 33 |
34 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA, | 34 bool drawOval(GrDrawTarget* target, const GrContext* context, bool useAA, |
35 const SkRect& oval, const SkStrokeRec& stroke); | 35 const SkRect& oval, const SkStrokeRec& stroke); |
36 bool drawRRect(GrDrawTarget* target, GrContext* context, bool useAA, | 36 bool drawRRect(GrDrawTarget* target, GrContext* context, bool useAA, |
37 const SkRRect& rrect, const SkStrokeRec& stroke); | 37 const SkRRect& rrect, const SkStrokeRec& stroke); |
38 bool drawDRRect(GrDrawTarget* target, GrContext* context, bool useAA, | 38 bool drawDRRect(GrDrawTarget* target, GrContext* context, bool useAA, |
39 const SkRRect& outer, const SkRRect& inner); | 39 const SkRRect& outer, const SkRRect& inner); |
40 | 40 |
41 private: | 41 private: |
42 bool drawEllipse(GrDrawTarget* target, const GrContext* context, bool useCov
erageAA, | 42 bool drawEllipse(GrDrawTarget* target, bool useCoverageAA, |
43 const SkRect& ellipse, | 43 const SkRect& ellipse, |
44 const SkStrokeRec& stroke); | 44 const SkStrokeRec& stroke); |
45 bool drawDIEllipse(GrDrawTarget* target, const GrContext* context, bool useC
overageAA, | 45 bool drawDIEllipse(GrDrawTarget* target, bool useCoverageAA, |
46 const SkRect& ellipse, | 46 const SkRect& ellipse, |
47 const SkStrokeRec& stroke); | 47 const SkStrokeRec& stroke); |
48 void drawCircle(GrDrawTarget* target, const GrContext* context, bool useCove
rageAA, | 48 void drawCircle(GrDrawTarget* target, bool useCoverageAA, |
49 const SkRect& circle, | 49 const SkRect& circle, |
50 const SkStrokeRec& stroke); | 50 const SkStrokeRec& stroke); |
51 | 51 |
52 GrIndexBuffer* rRectIndexBuffer(bool isStrokeOnly, GrGpu* gpu); | 52 GrIndexBuffer* rRectIndexBuffer(GrGpu* gpu); |
53 | 53 |
54 GrIndexBuffer* fRRectIndexBuffer; | 54 GrIndexBuffer* fRRectIndexBuffer; |
55 GrIndexBuffer* fStrokeRRectIndexBuffer; | |
56 | 55 |
57 typedef SkRefCnt INHERITED; | 56 typedef SkRefCnt INHERITED; |
58 }; | 57 }; |
59 | 58 |
60 #endif // GrOvalRenderer_DEFINED | 59 #endif // GrOvalRenderer_DEFINED |
OLD | NEW |