OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrAARectRenderer_DEFINED | 8 #ifndef GrAARectRenderer_DEFINED |
9 #define GrAARectRenderer_DEFINED | 9 #define GrAARectRenderer_DEFINED |
10 | 10 |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
13 #include "SkRect.h" | 13 #include "SkRect.h" |
14 #include "SkRefCnt.h" | 14 #include "SkRefCnt.h" |
15 #include "SkStrokeRec.h" | 15 #include "SkStrokeRec.h" |
16 | 16 |
17 class GrClip; | 17 class GrClip; |
18 class GrDrawTarget; | 18 class GrDrawTarget; |
| 19 class GrGpu; |
19 class GrIndexBuffer; | 20 class GrIndexBuffer; |
20 class GrPipelineBuilder; | 21 class GrPipelineBuilder; |
21 | 22 |
22 /* | 23 /* |
23 * This class wraps helper functions that draw AA rects (filled & stroked) | 24 * This class wraps helper functions that draw AA rects (filled & stroked) |
24 */ | 25 */ |
25 class GrAARectRenderer : public SkRefCnt { | 26 class GrAARectRenderer : public SkRefCnt { |
26 public: | 27 public: |
27 SK_DECLARE_INST_COUNT(GrAARectRenderer) | 28 SK_DECLARE_INST_COUNT(GrAARectRenderer) |
28 | 29 |
| 30 GrAARectRenderer(GrGpu* gpu) |
| 31 : fGpu(gpu) |
| 32 , fAAFillRectIndexBuffer(NULL) |
| 33 , fAAMiterStrokeRectIndexBuffer(NULL) |
| 34 , fAABevelStrokeRectIndexBuffer(NULL) { |
| 35 } |
| 36 |
| 37 void reset(); |
| 38 |
| 39 ~GrAARectRenderer() { |
| 40 this->reset(); |
| 41 } |
| 42 |
29 // TODO: potentialy fuse the fill & stroke methods and differentiate | 43 // TODO: potentialy fuse the fill & stroke methods and differentiate |
30 // between them by passing in stroke (==NULL means fill). | 44 // between them by passing in stroke (==NULL means fill). |
31 | 45 |
32 void fillAARect(GrDrawTarget* target, | 46 void fillAARect(GrDrawTarget* target, |
33 GrPipelineBuilder* pipelineBuilder, | 47 GrPipelineBuilder* pipelineBuilder, |
34 GrColor color, | 48 GrColor color, |
35 const SkMatrix& viewMatrix, | 49 const SkMatrix& viewMatrix, |
36 const SkRect& rect, | 50 const SkRect& rect, |
37 const SkRect& devRect) { | 51 const SkRect& devRect) { |
38 this->geometryFillAARect(target, pipelineBuilder, color, viewMatrix, rec
t, devRect); | 52 this->geometryFillAARect(target, pipelineBuilder, color, viewMatrix, rec
t, devRect); |
(...skipping 24 matching lines...) Expand all Loading... |
63 | 77 |
64 void geometryStrokeAARect(GrDrawTarget*, | 78 void geometryStrokeAARect(GrDrawTarget*, |
65 GrPipelineBuilder*, | 79 GrPipelineBuilder*, |
66 GrColor, | 80 GrColor, |
67 const SkMatrix& viewMatrix, | 81 const SkMatrix& viewMatrix, |
68 const SkRect& devOutside, | 82 const SkRect& devOutside, |
69 const SkRect& devOutsideAssist, | 83 const SkRect& devOutsideAssist, |
70 const SkRect& devInside, | 84 const SkRect& devInside, |
71 bool miterStroke); | 85 bool miterStroke); |
72 | 86 |
| 87 GrGpu* fGpu; |
| 88 GrIndexBuffer* fAAFillRectIndexBuffer; |
| 89 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; |
| 90 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; |
| 91 |
73 typedef SkRefCnt INHERITED; | 92 typedef SkRefCnt INHERITED; |
74 }; | 93 }; |
75 | 94 |
76 #endif // GrAARectRenderer_DEFINED | 95 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |