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 26 matching lines...) Expand all Loading... |
37 this->reset(); | 37 this->reset(); |
38 } | 38 } |
39 | 39 |
40 // TODO: potentialy fuse the fill & stroke methods and differentiate | 40 // TODO: potentialy fuse the fill & stroke methods and differentiate |
41 // between them by passing in stroke (==NULL means fill). | 41 // between them by passing in stroke (==NULL means fill). |
42 | 42 |
43 void fillAARect(GrDrawTarget* target, | 43 void fillAARect(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 #ifdef SHADER_AA_FILL_RECT | |
48 if (combinedMatrix.rectStaysRect()) { | |
49 this->shaderFillAlignedAARect(gpu, target, | |
50 rect, combinedMatrix); | |
51 } else { | |
52 this->shaderFillAARect(gpu, target, | |
53 rect, combinedMatrix); | |
54 } | |
55 #else | |
56 this->geometryFillAARect(target, rect, combinedMatrix, devRect); | 47 this->geometryFillAARect(target, rect, combinedMatrix, devRect); |
57 #endif | |
58 } | 48 } |
59 | 49 |
60 void strokeAARect(GrDrawTarget* target, | 50 void strokeAARect(GrDrawTarget* target, |
61 const SkRect& rect, | 51 const SkRect& rect, |
62 const SkMatrix& combinedMatrix, | 52 const SkMatrix& combinedMatrix, |
63 const SkRect& devRect, | 53 const SkRect& devRect, |
64 const SkStrokeRec& stroke); | 54 const SkStrokeRec& stroke); |
65 | 55 |
66 // First rect is outer; second rect is inner | 56 // First rect is outer; second rect is inner |
67 void fillAANestedRects(GrDrawTarget* target, | 57 void fillAANestedRects(GrDrawTarget* target, |
68 const SkRect rects[2], | 58 const SkRect rects[2], |
69 const SkMatrix& combinedMatrix); | 59 const SkMatrix& combinedMatrix); |
70 | 60 |
71 private: | 61 private: |
72 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); | 62 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); |
73 | 63 |
74 void geometryFillAARect(GrDrawTarget* target, | 64 void geometryFillAARect(GrDrawTarget* target, |
75 const SkRect& rect, | 65 const SkRect& rect, |
76 const SkMatrix& combinedMatrix, | 66 const SkMatrix& combinedMatrix, |
77 const SkRect& devRect); | 67 const SkRect& devRect); |
78 | 68 |
79 void shaderFillAARect(GrDrawTarget* target, | |
80 const SkRect& rect, | |
81 const SkMatrix& combinedMatrix); | |
82 | |
83 void shaderFillAlignedAARect(GrDrawTarget* target, | |
84 const SkRect& rect, | |
85 const SkMatrix& combinedMatrix); | |
86 | |
87 void geometryStrokeAARect(GrDrawTarget* target, | 69 void geometryStrokeAARect(GrDrawTarget* target, |
88 const SkRect& devOutside, | 70 const SkRect& devOutside, |
89 const SkRect& devOutsideAssist, | 71 const SkRect& devOutsideAssist, |
90 const SkRect& devInside, | 72 const SkRect& devInside, |
91 bool miterStroke); | 73 bool miterStroke); |
92 | 74 |
93 GrGpu* fGpu; | 75 GrGpu* fGpu; |
94 GrIndexBuffer* fAAFillRectIndexBuffer; | 76 GrIndexBuffer* fAAFillRectIndexBuffer; |
95 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; | 77 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; |
96 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; | 78 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; |
97 | 79 |
98 typedef SkRefCnt INHERITED; | 80 typedef SkRefCnt INHERITED; |
99 }; | 81 }; |
100 | 82 |
101 #endif // GrAARectRenderer_DEFINED | 83 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |