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 | 8 |
9 #ifndef GrAARectRenderer_DEFINED | 9 #ifndef GrAARectRenderer_DEFINED |
10 #define GrAARectRenderer_DEFINED | 10 #define GrAARectRenderer_DEFINED |
(...skipping 24 matching lines...) Expand all Loading... |
35 this->reset(); | 35 this->reset(); |
36 } | 36 } |
37 | 37 |
38 // TODO: potentialy fuse the fill & stroke methods and differentiate | 38 // TODO: potentialy fuse the fill & stroke methods and differentiate |
39 // between them by passing in strokeWidth (<0 means fill). | 39 // between them by passing in strokeWidth (<0 means fill). |
40 | 40 |
41 void fillAARect(GrGpu* gpu, | 41 void fillAARect(GrGpu* gpu, |
42 GrDrawTarget* target, | 42 GrDrawTarget* target, |
43 const GrRect& rect, | 43 const GrRect& rect, |
44 const SkMatrix& combinedMatrix, | 44 const SkMatrix& combinedMatrix, |
45 const GrRect& devRect, | |
46 bool useVertexCoverage) { | 45 bool useVertexCoverage) { |
47 #ifdef SHADER_AA_FILL_RECT | 46 #ifdef SHADER_AA_FILL_RECT |
48 if (combinedMatrix.rectStaysRect()) { | 47 if (combinedMatrix.rectStaysRect()) { |
49 this->shaderFillAlignedAARect(gpu, target, | 48 this->shaderFillAlignedAARect(gpu, target, |
50 combinedMatrix, devRect); | 49 combinedMatrix, devRect); |
51 } else { | 50 } else { |
52 this->shaderFillAARect(gpu, target, | 51 this->shaderFillAARect(gpu, target, |
53 rect, combinedMatrix, devRect); | 52 rect, combinedMatrix, devRect); |
54 } | 53 } |
55 #else | 54 #else |
56 this->geometryFillAARect(gpu, target, | 55 this->geometryFillAARect(gpu, target, |
57 rect, combinedMatrix, | 56 rect, combinedMatrix, |
58 devRect, useVertexCoverage); | 57 useVertexCoverage); |
59 #endif | 58 #endif |
60 } | 59 } |
61 | 60 |
62 void strokeAARect(GrGpu* gpu, | 61 void strokeAARect(GrGpu* gpu, |
63 GrDrawTarget* target, | 62 GrDrawTarget* target, |
64 const GrRect& devRect, | 63 const GrRect& rect, |
| 64 const SkMatrix& combinedMatrix, |
65 const GrVec& devStrokeSize, | 65 const GrVec& devStrokeSize, |
66 bool useVertexCoverage); | 66 bool useVertexCoverage); |
67 | 67 |
68 private: | 68 private: |
69 GrIndexBuffer* fAAFillRectIndexBuffer; | 69 GrIndexBuffer* fAAFillRectIndexBuffer; |
70 GrIndexBuffer* fAAStrokeRectIndexBuffer; | 70 GrIndexBuffer* fAAStrokeRectIndexBuffer; |
71 | 71 |
72 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); | 72 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); |
73 | 73 |
74 static int aaStrokeRectIndexCount(); | 74 static int aaStrokeRectIndexCount(); |
75 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); | 75 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); |
76 | 76 |
77 // TODO: Remove the useVertexCoverage boolean. Just use it all the time | 77 // TODO: Remove the useVertexCoverage boolean. Just use it all the time |
78 // since we now have a coverage vertex attribute | 78 // since we now have a coverage vertex attribute |
79 void geometryFillAARect(GrGpu* gpu, | 79 void geometryFillAARect(GrGpu* gpu, |
80 GrDrawTarget* target, | 80 GrDrawTarget* target, |
81 const GrRect& rect, | 81 const GrRect& rect, |
82 const SkMatrix& combinedMatrix, | 82 const SkMatrix& combinedMatrix, |
83 const GrRect& devRect, | |
84 bool useVertexCoverage); | 83 bool useVertexCoverage); |
85 | 84 |
86 void shaderFillAARect(GrGpu* gpu, | 85 void shaderFillAARect(GrGpu* gpu, |
87 GrDrawTarget* target, | 86 GrDrawTarget* target, |
88 const GrRect& rect, | 87 const GrRect& rect, |
89 const SkMatrix& combinedMatrix, | 88 const SkMatrix& combinedMatrix, |
90 const GrRect& devRect); | 89 const GrRect& devRect); |
91 | 90 |
92 void shaderFillAlignedAARect(GrGpu* gpu, | 91 void shaderFillAlignedAARect(GrGpu* gpu, |
93 GrDrawTarget* target, | 92 GrDrawTarget* target, |
94 const GrRect& rect, | 93 const GrRect& rect, |
95 const SkMatrix& combinedMatrix, | 94 const SkMatrix& combinedMatrix, |
96 const GrRect& devRect); | 95 const GrRect& devRect); |
97 | 96 |
98 typedef GrRefCnt INHERITED; | 97 typedef GrRefCnt INHERITED; |
99 }; | 98 }; |
100 | 99 |
101 #endif // GrAARectRenderer_DEFINED | 100 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |