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