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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 void reset(); | 32 void reset(); |
33 | 33 |
34 ~GrAARectRenderer() { | 34 ~GrAARectRenderer() { |
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 // TODO: Remove the useVertexCoverage boolean. Just use it all the time | |
42 // since we now have a coverage vertex attribute | |
43 void fillAARect(GrGpu* gpu, | 41 void fillAARect(GrGpu* gpu, |
44 GrDrawTarget* target, | 42 GrDrawTarget* target, |
| 43 const GrRect& rect, |
| 44 const SkMatrix& combinedMatrix, |
45 const GrRect& devRect, | 45 const GrRect& devRect, |
46 bool useVertexCoverage); | 46 bool useVertexCoverage) { |
47 | 47 #ifdef SHADER_AA_FILL_RECT |
48 void shaderFillAARect(GrGpu* gpu, | 48 if (combinedMatrix.rectStaysRect()) { |
49 GrDrawTarget* target, | 49 this->shaderFillAlignedAARect(gpu, target, |
50 const GrRect& rect, | 50 combinedMatrix, devRect); |
51 const SkMatrix& combinedMatrix, | 51 } else { |
52 const GrRect& devRect, | 52 this->shaderFillAARect(gpu, target, |
53 bool useVertexCoverage); | 53 rect, combinedMatrix, devRect); |
| 54 } |
| 55 #else |
| 56 this->geometryFillAARect(gpu, target, |
| 57 devRect, useVertexCoverage); |
| 58 #endif |
| 59 } |
54 | 60 |
55 void strokeAARect(GrGpu* gpu, | 61 void strokeAARect(GrGpu* gpu, |
56 GrDrawTarget* target, | 62 GrDrawTarget* target, |
57 const GrRect& devRect, | 63 const GrRect& devRect, |
58 const GrVec& devStrokeSize, | 64 const GrVec& devStrokeSize, |
59 bool useVertexCoverage); | 65 bool useVertexCoverage); |
60 | 66 |
61 private: | 67 private: |
62 GrIndexBuffer* fAAFillRectIndexBuffer; | 68 GrIndexBuffer* fAAFillRectIndexBuffer; |
63 GrIndexBuffer* fAAStrokeRectIndexBuffer; | 69 GrIndexBuffer* fAAStrokeRectIndexBuffer; |
64 | 70 |
65 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); | 71 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); |
66 | 72 |
67 static int aaStrokeRectIndexCount(); | 73 static int aaStrokeRectIndexCount(); |
68 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); | 74 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); |
69 | 75 |
| 76 // TODO: Remove the useVertexCoverage boolean. Just use it all the time |
| 77 // since we now have a coverage vertex attribute |
| 78 void geometryFillAARect(GrGpu* gpu, |
| 79 GrDrawTarget* target, |
| 80 const GrRect& devRect, |
| 81 bool useVertexCoverage); |
| 82 |
| 83 void shaderFillAARect(GrGpu* gpu, |
| 84 GrDrawTarget* target, |
| 85 const GrRect& rect, |
| 86 const SkMatrix& combinedMatrix, |
| 87 const GrRect& devRect); |
| 88 |
| 89 void shaderFillAlignedAARect(GrGpu* gpu, |
| 90 GrDrawTarget* target, |
| 91 const GrRect& rect, |
| 92 const SkMatrix& combinedMatrix, |
| 93 const GrRect& devRect); |
| 94 |
70 typedef GrRefCnt INHERITED; | 95 typedef GrRefCnt INHERITED; |
71 }; | 96 }; |
72 | 97 |
73 #endif // GrAARectRenderer_DEFINED | 98 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |