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