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 |
(...skipping 25 matching lines...) Expand all Loading... |
36 this->reset(); | 36 this->reset(); |
37 } | 37 } |
38 | 38 |
39 // TODO: potentialy fuse the fill & stroke methods and differentiate | 39 // TODO: potentialy fuse the fill & stroke methods and differentiate |
40 // between them by passing in stroke (==NULL means fill). | 40 // between them by passing in stroke (==NULL means fill). |
41 | 41 |
42 void fillAARect(GrGpu* gpu, | 42 void fillAARect(GrGpu* gpu, |
43 GrDrawTarget* target, | 43 GrDrawTarget* target, |
44 const SkRect& rect, | 44 const SkRect& rect, |
45 const SkMatrix& combinedMatrix, | 45 const SkMatrix& combinedMatrix, |
46 const SkRect& devRect, | 46 const SkRect& devRect) { |
47 bool useVertexCoverage) { | |
48 #ifdef SHADER_AA_FILL_RECT | 47 #ifdef SHADER_AA_FILL_RECT |
49 if (combinedMatrix.rectStaysRect()) { | 48 if (combinedMatrix.rectStaysRect()) { |
50 this->shaderFillAlignedAARect(gpu, target, | 49 this->shaderFillAlignedAARect(gpu, target, |
51 rect, combinedMatrix); | 50 rect, combinedMatrix); |
52 } else { | 51 } else { |
53 this->shaderFillAARect(gpu, target, | 52 this->shaderFillAARect(gpu, target, |
54 rect, combinedMatrix); | 53 rect, combinedMatrix); |
55 } | 54 } |
56 #else | 55 #else |
57 this->geometryFillAARect(gpu, target, | 56 this->geometryFillAARect(gpu, target, rect, combinedMatrix, devRect); |
58 rect, combinedMatrix, | |
59 devRect, useVertexCoverage); | |
60 #endif | 57 #endif |
61 } | 58 } |
62 | 59 |
63 void strokeAARect(GrGpu* gpu, | 60 void strokeAARect(GrGpu* gpu, |
64 GrDrawTarget* target, | 61 GrDrawTarget* target, |
65 const SkRect& rect, | 62 const SkRect& rect, |
66 const SkMatrix& combinedMatrix, | 63 const SkMatrix& combinedMatrix, |
67 const SkRect& devRect, | 64 const SkRect& devRect, |
68 const SkStrokeRec& stroke, | 65 const SkStrokeRec& stroke); |
69 bool useVertexCoverage); | |
70 | 66 |
71 // First rect is outer; second rect is inner | 67 // First rect is outer; second rect is inner |
72 void fillAANestedRects(GrGpu* gpu, | 68 void fillAANestedRects(GrGpu* gpu, |
73 GrDrawTarget* target, | 69 GrDrawTarget* target, |
74 const SkRect rects[2], | 70 const SkRect rects[2], |
75 const SkMatrix& combinedMatrix, | 71 const SkMatrix& combinedMatrix); |
76 bool useVertexCoverage); | |
77 | 72 |
78 private: | 73 private: |
79 GrIndexBuffer* fAAFillRectIndexBuffer; | 74 GrIndexBuffer* fAAFillRectIndexBuffer; |
80 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; | 75 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; |
81 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; | 76 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; |
82 | 77 |
83 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); | 78 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); |
84 | 79 |
85 static int aaStrokeRectIndexCount(bool miterStroke); | 80 static int aaStrokeRectIndexCount(bool miterStroke); |
86 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu, bool miterStroke); | 81 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu, bool miterStroke); |
87 | 82 |
88 // TODO: Remove the useVertexCoverage boolean. Just use it all the time | |
89 // since we now have a coverage vertex attribute | |
90 void geometryFillAARect(GrGpu* gpu, | 83 void geometryFillAARect(GrGpu* gpu, |
91 GrDrawTarget* target, | 84 GrDrawTarget* target, |
92 const SkRect& rect, | 85 const SkRect& rect, |
93 const SkMatrix& combinedMatrix, | 86 const SkMatrix& combinedMatrix, |
94 const SkRect& devRect, | 87 const SkRect& devRect); |
95 bool useVertexCoverage); | |
96 | 88 |
97 void shaderFillAARect(GrGpu* gpu, | 89 void shaderFillAARect(GrGpu* gpu, |
98 GrDrawTarget* target, | 90 GrDrawTarget* target, |
99 const SkRect& rect, | 91 const SkRect& rect, |
100 const SkMatrix& combinedMatrix); | 92 const SkMatrix& combinedMatrix); |
101 | 93 |
102 void shaderFillAlignedAARect(GrGpu* gpu, | 94 void shaderFillAlignedAARect(GrGpu* gpu, |
103 GrDrawTarget* target, | 95 GrDrawTarget* target, |
104 const SkRect& rect, | 96 const SkRect& rect, |
105 const SkMatrix& combinedMatrix); | 97 const SkMatrix& combinedMatrix); |
106 | 98 |
107 void geometryStrokeAARect(GrGpu* gpu, | 99 void geometryStrokeAARect(GrGpu* gpu, |
108 GrDrawTarget* target, | 100 GrDrawTarget* target, |
109 const SkRect& devOutside, | 101 const SkRect& devOutside, |
110 const SkRect& devOutsideAssist, | 102 const SkRect& devOutsideAssist, |
111 const SkRect& devInside, | 103 const SkRect& devInside, |
112 bool useVertexCoverage, | |
113 bool miterStroke); | 104 bool miterStroke); |
114 | 105 |
115 typedef SkRefCnt INHERITED; | 106 typedef SkRefCnt INHERITED; |
116 }; | 107 }; |
117 | 108 |
118 #endif // GrAARectRenderer_DEFINED | 109 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |