Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: include/gpu/GrAARectRenderer.h

Issue 19449002: Replace all instances of GrRect with SkRect. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/texdata.cpp ('k') | include/gpu/GrClipData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
13 #include "GrRefCnt.h" 12 #include "GrRefCnt.h"
14 #include "SkMatrix.h" 13 #include "SkMatrix.h"
14 #include "SkRect.h"
15 15
16 class GrGpu; 16 class GrGpu;
17 class GrDrawTarget; 17 class GrDrawTarget;
18 class GrIndexBuffer; 18 class GrIndexBuffer;
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)
29 , fAAStrokeRectIndexBuffer(NULL) { 29 , fAAStrokeRectIndexBuffer(NULL) {
30 } 30 }
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 void fillAARect(GrGpu* gpu, 41 void fillAARect(GrGpu* gpu,
42 GrDrawTarget* target, 42 GrDrawTarget* target,
43 const GrRect& rect, 43 const SkRect& rect,
44 const SkMatrix& combinedMatrix, 44 const SkMatrix& combinedMatrix,
45 const GrRect& devRect, 45 const SkRect& devRect,
46 bool useVertexCoverage) { 46 bool useVertexCoverage) {
47 #ifdef SHADER_AA_FILL_RECT 47 #ifdef SHADER_AA_FILL_RECT
48 if (combinedMatrix.rectStaysRect()) { 48 if (combinedMatrix.rectStaysRect()) {
49 this->shaderFillAlignedAARect(gpu, target, 49 this->shaderFillAlignedAARect(gpu, target,
50 rect, combinedMatrix); 50 rect, combinedMatrix);
51 } else { 51 } else {
52 this->shaderFillAARect(gpu, target, 52 this->shaderFillAARect(gpu, target,
53 rect, combinedMatrix); 53 rect, combinedMatrix);
54 } 54 }
55 #else 55 #else
56 this->geometryFillAARect(gpu, target, 56 this->geometryFillAARect(gpu, target,
57 rect, combinedMatrix, 57 rect, combinedMatrix,
58 devRect, useVertexCoverage); 58 devRect, useVertexCoverage);
59 #endif 59 #endif
60 } 60 }
61 61
62 void strokeAARect(GrGpu* gpu, 62 void strokeAARect(GrGpu* gpu,
63 GrDrawTarget* target, 63 GrDrawTarget* target,
64 const GrRect& rect, 64 const SkRect& rect,
65 const SkMatrix& combinedMatrix, 65 const SkMatrix& combinedMatrix,
66 const GrRect& devRect, 66 const SkRect& devRect,
67 SkScalar width, 67 SkScalar width,
68 bool useVertexCoverage); 68 bool useVertexCoverage);
69 69
70 // First rect is outer; second rect is inner 70 // First rect is outer; second rect is inner
71 void fillAANestedRects(GrGpu* gpu, 71 void fillAANestedRects(GrGpu* gpu,
72 GrDrawTarget* target, 72 GrDrawTarget* target,
73 const SkRect rects[2], 73 const SkRect rects[2],
74 const SkMatrix& combinedMatrix, 74 const SkMatrix& combinedMatrix,
75 bool useVertexCoverage); 75 bool useVertexCoverage);
76 76
77 private: 77 private:
78 GrIndexBuffer* fAAFillRectIndexBuffer; 78 GrIndexBuffer* fAAFillRectIndexBuffer;
79 GrIndexBuffer* fAAStrokeRectIndexBuffer; 79 GrIndexBuffer* fAAStrokeRectIndexBuffer;
80 80
81 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); 81 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu);
82 82
83 static int aaStrokeRectIndexCount(); 83 static int aaStrokeRectIndexCount();
84 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); 84 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu);
85 85
86 // TODO: Remove the useVertexCoverage boolean. Just use it all the time 86 // TODO: Remove the useVertexCoverage boolean. Just use it all the time
87 // since we now have a coverage vertex attribute 87 // since we now have a coverage vertex attribute
88 void geometryFillAARect(GrGpu* gpu, 88 void geometryFillAARect(GrGpu* gpu,
89 GrDrawTarget* target, 89 GrDrawTarget* target,
90 const GrRect& rect, 90 const SkRect& rect,
91 const SkMatrix& combinedMatrix, 91 const SkMatrix& combinedMatrix,
92 const GrRect& devRect, 92 const SkRect& devRect,
93 bool useVertexCoverage); 93 bool useVertexCoverage);
94 94
95 void shaderFillAARect(GrGpu* gpu, 95 void shaderFillAARect(GrGpu* gpu,
96 GrDrawTarget* target, 96 GrDrawTarget* target,
97 const GrRect& rect, 97 const SkRect& rect,
98 const SkMatrix& combinedMatrix); 98 const SkMatrix& combinedMatrix);
99 99
100 void shaderFillAlignedAARect(GrGpu* gpu, 100 void shaderFillAlignedAARect(GrGpu* gpu,
101 GrDrawTarget* target, 101 GrDrawTarget* target,
102 const GrRect& rect, 102 const SkRect& rect,
103 const SkMatrix& combinedMatrix); 103 const SkMatrix& combinedMatrix);
104 104
105 void geometryStrokeAARect(GrGpu* gpu, 105 void geometryStrokeAARect(GrGpu* gpu,
106 GrDrawTarget* target, 106 GrDrawTarget* target,
107 const SkRect& devOutside, 107 const SkRect& devOutside,
108 const SkRect& devInside, 108 const SkRect& devInside,
109 bool useVertexCoverage); 109 bool useVertexCoverage);
110 110
111 typedef GrRefCnt INHERITED; 111 typedef GrRefCnt INHERITED;
112 }; 112 };
113 113
114 #endif // GrAARectRenderer_DEFINED 114 #endif // GrAARectRenderer_DEFINED
OLDNEW
« no previous file with comments | « gm/texdata.cpp ('k') | include/gpu/GrClipData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698