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 |
11 | 11 |
12 #include "GrRect.h" | 12 #include "GrRect.h" |
13 #include "GrRefCnt.h" | 13 #include "GrRefCnt.h" |
| 14 #include "SkMatrix.h" |
14 | 15 |
15 class GrGpu; | 16 class GrGpu; |
16 class GrDrawTarget; | 17 class GrDrawTarget; |
17 class GrIndexBuffer; | 18 class GrIndexBuffer; |
18 class SkMatrix; | |
19 | 19 |
20 /* | 20 /* |
21 * This class wraps helper functions that draw AA rects (filled & stroked) | 21 * This class wraps helper functions that draw AA rects (filled & stroked) |
22 */ | 22 */ |
23 class GrAARectRenderer : public GrRefCnt { | 23 class GrAARectRenderer : public GrRefCnt { |
24 public: | 24 public: |
25 SK_DECLARE_INST_COUNT(GrAARectRenderer) | 25 SK_DECLARE_INST_COUNT(GrAARectRenderer) |
26 | 26 |
27 GrAARectRenderer() | 27 GrAARectRenderer() |
28 : fAAFillRectIndexBuffer(NULL) | 28 : fAAFillRectIndexBuffer(NULL) |
(...skipping 10 matching lines...) Expand all Loading... |
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 bool useVertexCoverage) { | 45 bool useVertexCoverage) { |
46 #ifdef SHADER_AA_FILL_RECT | 46 #ifdef SHADER_AA_FILL_RECT |
47 if (combinedMatrix.rectStaysRect()) { | 47 if (combinedMatrix.rectStaysRect()) { |
48 this->shaderFillAlignedAARect(gpu, target, | 48 this->shaderFillAlignedAARect(gpu, target, |
49 combinedMatrix, devRect); | 49 rect, combinedMatrix); |
50 } else { | 50 } else { |
51 this->shaderFillAARect(gpu, target, | 51 this->shaderFillAARect(gpu, target, |
52 rect, combinedMatrix, devRect); | 52 rect, combinedMatrix); |
53 } | 53 } |
54 #else | 54 #else |
55 this->geometryFillAARect(gpu, target, | 55 this->geometryFillAARect(gpu, target, |
56 rect, combinedMatrix, | 56 rect, combinedMatrix, |
57 useVertexCoverage); | 57 useVertexCoverage); |
58 #endif | 58 #endif |
59 } | 59 } |
60 | 60 |
61 void strokeAARect(GrGpu* gpu, | 61 void strokeAARect(GrGpu* gpu, |
62 GrDrawTarget* target, | 62 GrDrawTarget* target, |
(...skipping 15 matching lines...) Expand all Loading... |
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 bool useVertexCoverage); | 83 bool useVertexCoverage); |
84 | 84 |
85 void shaderFillAARect(GrGpu* gpu, | 85 void shaderFillAARect(GrGpu* gpu, |
86 GrDrawTarget* target, | 86 GrDrawTarget* target, |
87 const GrRect& rect, | 87 const GrRect& rect, |
88 const SkMatrix& combinedMatrix, | 88 const SkMatrix& combinedMatrix); |
89 const GrRect& devRect); | |
90 | 89 |
91 void shaderFillAlignedAARect(GrGpu* gpu, | 90 void shaderFillAlignedAARect(GrGpu* gpu, |
92 GrDrawTarget* target, | 91 GrDrawTarget* target, |
93 const GrRect& rect, | 92 const GrRect& rect, |
94 const SkMatrix& combinedMatrix, | 93 const SkMatrix& combinedMatrix); |
95 const GrRect& devRect); | |
96 | 94 |
97 typedef GrRefCnt INHERITED; | 95 typedef GrRefCnt INHERITED; |
98 }; | 96 }; |
99 | 97 |
100 #endif // GrAARectRenderer_DEFINED | 98 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |