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 |
47 this->geometryFillAARect(target, rect, combinedMatrix, devRect); | 56 this->geometryFillAARect(target, rect, combinedMatrix, devRect); |
| 57 #endif |
48 } | 58 } |
49 | 59 |
50 void strokeAARect(GrDrawTarget* target, | 60 void strokeAARect(GrDrawTarget* target, |
51 const SkRect& rect, | 61 const SkRect& rect, |
52 const SkMatrix& combinedMatrix, | 62 const SkMatrix& combinedMatrix, |
53 const SkRect& devRect, | 63 const SkRect& devRect, |
54 const SkStrokeRec& stroke); | 64 const SkStrokeRec& stroke); |
55 | 65 |
56 // First rect is outer; second rect is inner | 66 // First rect is outer; second rect is inner |
57 void fillAANestedRects(GrDrawTarget* target, | 67 void fillAANestedRects(GrDrawTarget* target, |
58 const SkRect rects[2], | 68 const SkRect rects[2], |
59 const SkMatrix& combinedMatrix); | 69 const SkMatrix& combinedMatrix); |
60 | 70 |
61 private: | 71 private: |
62 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); | 72 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); |
63 | 73 |
64 void geometryFillAARect(GrDrawTarget* target, | 74 void geometryFillAARect(GrDrawTarget* target, |
65 const SkRect& rect, | 75 const SkRect& rect, |
66 const SkMatrix& combinedMatrix, | 76 const SkMatrix& combinedMatrix, |
67 const SkRect& devRect); | 77 const SkRect& devRect); |
68 | 78 |
| 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 |
69 void geometryStrokeAARect(GrDrawTarget* target, | 87 void geometryStrokeAARect(GrDrawTarget* target, |
70 const SkRect& devOutside, | 88 const SkRect& devOutside, |
71 const SkRect& devOutsideAssist, | 89 const SkRect& devOutsideAssist, |
72 const SkRect& devInside, | 90 const SkRect& devInside, |
73 bool miterStroke); | 91 bool miterStroke); |
74 | 92 |
75 GrGpu* fGpu; | 93 GrGpu* fGpu; |
76 GrIndexBuffer* fAAFillRectIndexBuffer; | 94 GrIndexBuffer* fAAFillRectIndexBuffer; |
77 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; | 95 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; |
78 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; | 96 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; |
79 | 97 |
80 typedef SkRefCnt INHERITED; | 98 typedef SkRefCnt INHERITED; |
81 }; | 99 }; |
82 | 100 |
83 #endif // GrAARectRenderer_DEFINED | 101 #endif // GrAARectRenderer_DEFINED |
OLD | NEW |