OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrInOrderDrawBuffer_DEFINED | 8 #ifndef GrInOrderDrawBuffer_DEFINED |
9 #define GrInOrderDrawBuffer_DEFINED | 9 #define GrInOrderDrawBuffer_DEFINED |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 kClear_Cmd = 5, | 95 kClear_Cmd = 5, |
96 kCopySurface_Cmd = 6, | 96 kCopySurface_Cmd = 6, |
97 kDrawPath_Cmd = 7, | 97 kDrawPath_Cmd = 7, |
98 kDrawPaths_Cmd = 8, | 98 kDrawPaths_Cmd = 8, |
99 }; | 99 }; |
100 | 100 |
101 class Draw : public DrawInfo { | 101 class Draw : public DrawInfo { |
102 public: | 102 public: |
103 Draw(const DrawInfo& info, const GrVertexBuffer* vb, const GrIndexBuffer
* ib) | 103 Draw(const DrawInfo& info, const GrVertexBuffer* vb, const GrIndexBuffer
* ib) |
104 : DrawInfo(info) | 104 : DrawInfo(info) |
105 , fVertexBuffer(vb, GrGpuResourceRef::kRead_IOType) | 105 , fVertexBuffer(vb) |
106 , fIndexBuffer(ib, GrGpuResourceRef::kRead_IOType) {} | 106 , fIndexBuffer(ib) {} |
107 | 107 |
108 const GrVertexBuffer* vertexBuffer() const { return fVertexBuffer.get();
} | 108 const GrVertexBuffer* vertexBuffer() const { return fVertexBuffer.get();
} |
109 const GrIndexBuffer* indexBuffer() const { return fIndexBuffer.get(); } | 109 const GrIndexBuffer* indexBuffer() const { return fIndexBuffer.get(); } |
110 | 110 |
111 private: | 111 private: |
112 GrPendingIOResource<const GrVertexBuffer> fVertexBuffer; | 112 GrPendingIOResource<const GrVertexBuffer, GrIORef::kRead_IOType> fVer
texBuffer; |
113 GrPendingIOResource<const GrIndexBuffer> fIndexBuffer; | 113 GrPendingIOResource<const GrIndexBuffer, GrIORef::kRead_IOType> fInd
exBuffer; |
114 }; | 114 }; |
115 | 115 |
116 struct StencilPath : public ::SkNoncopyable { | 116 struct StencilPath : public ::SkNoncopyable { |
117 StencilPath(const GrPath* path) : fPath(path, GrGpuResourceRef::kRead_IO
Type) {} | 117 StencilPath(const GrPath* path) : fPath(path) {} |
118 | 118 |
119 const GrPath* path() const { return fPath.get(); } | 119 const GrPath* path() const { return fPath.get(); } |
120 | 120 |
121 SkPath::FillType fFill; | 121 SkPath::FillType fFill; |
122 | 122 |
123 private: | 123 private: |
124 GrPendingIOResource<const GrPath> fPath; | 124 GrPendingIOResource<const GrPath, GrIORef::kRead_IOType> fPath; |
125 }; | 125 }; |
126 | 126 |
127 struct DrawPath : public ::SkNoncopyable { | 127 struct DrawPath : public ::SkNoncopyable { |
128 DrawPath(const GrPath* path) : fPath(path, GrGpuResourceRef::kRead_IOTyp
e) {} | 128 DrawPath(const GrPath* path) : fPath(path) {} |
129 | 129 |
130 const GrPath* path() const { return fPath.get(); } | 130 const GrPath* path() const { return fPath.get(); } |
131 | 131 |
132 SkPath::FillType fFill; | 132 SkPath::FillType fFill; |
133 GrDeviceCoordTexture fDstCopy; | 133 GrDeviceCoordTexture fDstCopy; |
134 | 134 |
135 private: | 135 private: |
136 GrPendingIOResource<const GrPath> fPath; | 136 GrPendingIOResource<const GrPath, GrIORef::kRead_IOType> fPath; |
137 }; | 137 }; |
138 | 138 |
139 struct DrawPaths : public ::SkNoncopyable { | 139 struct DrawPaths : public ::SkNoncopyable { |
140 DrawPaths(const GrPathRange* pathRange) | 140 DrawPaths(const GrPathRange* pathRange) |
141 : fPathRange(pathRange, GrGpuResourceRef::kRead_IOType) {} | 141 : fPathRange(pathRange) {} |
142 | 142 |
143 ~DrawPaths() { | 143 ~DrawPaths() { |
144 if (fTransforms) { | 144 if (fTransforms) { |
145 SkDELETE_ARRAY(fTransforms); | 145 SkDELETE_ARRAY(fTransforms); |
146 } | 146 } |
147 if (fIndices) { | 147 if (fIndices) { |
148 SkDELETE_ARRAY(fIndices); | 148 SkDELETE_ARRAY(fIndices); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 const GrPathRange* pathRange() const { return fPathRange.get(); } | 152 const GrPathRange* pathRange() const { return fPathRange.get(); } |
153 | 153 |
154 uint32_t* fIndices; | 154 uint32_t* fIndices; |
155 size_t fCount; | 155 size_t fCount; |
156 float* fTransforms; | 156 float* fTransforms; |
157 PathTransformType fTransformsType; | 157 PathTransformType fTransformsType; |
158 SkPath::FillType fFill; | 158 SkPath::FillType fFill; |
159 GrDeviceCoordTexture fDstCopy; | 159 GrDeviceCoordTexture fDstCopy; |
160 | 160 |
161 private: | 161 private: |
162 GrPendingIOResource<const GrPathRange> fPathRange; | 162 GrPendingIOResource<const GrPathRange, GrIORef::kRead_IOType> fPathRange
; |
163 }; | 163 }; |
164 | 164 |
165 // This is also used to record a discard by setting the color to GrColor_ILL
EGAL | 165 // This is also used to record a discard by setting the color to GrColor_ILL
EGAL |
166 struct Clear : public ::SkNoncopyable { | 166 struct Clear : public ::SkNoncopyable { |
167 Clear(GrRenderTarget* rt) : fRenderTarget(rt, GrGpuResourceRef::kWrite_I
OType) {} | 167 Clear(GrRenderTarget* rt) : fRenderTarget(rt) {} |
168 ~Clear() { } | 168 ~Clear() { } |
169 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } | 169 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
170 | 170 |
171 SkIRect fRect; | 171 SkIRect fRect; |
172 GrColor fColor; | 172 GrColor fColor; |
173 bool fCanIgnoreRect; | 173 bool fCanIgnoreRect; |
174 | 174 |
175 private: | 175 private: |
176 GrPendingIOResource<GrRenderTarget> fRenderTarget; | 176 GrPendingIOResource<GrRenderTarget, GrIORef::kWrite_IOType> fRenderTarge
t; |
177 }; | 177 }; |
178 | 178 |
179 struct CopySurface : public ::SkNoncopyable { | 179 struct CopySurface : public ::SkNoncopyable { |
180 CopySurface(GrSurface* dst, GrSurface* src) | 180 CopySurface(GrSurface* dst, GrSurface* src) : fDst(dst), fSrc(src) {} |
181 : fDst(dst, GrGpuResourceRef::kWrite_IOType) | |
182 , fSrc(src, GrGpuResourceRef::kRead_IOType) {} | |
183 | 181 |
184 GrSurface* dst() const { return fDst.get(); } | 182 GrSurface* dst() const { return fDst.get(); } |
185 GrSurface* src() const { return fSrc.get(); } | 183 GrSurface* src() const { return fSrc.get(); } |
186 | 184 |
187 SkIPoint fDstPoint; | 185 SkIPoint fDstPoint; |
188 SkIRect fSrcRect; | 186 SkIRect fSrcRect; |
189 | 187 |
190 private: | 188 private: |
191 GrPendingIOResource<GrSurface> fDst; | 189 GrPendingIOResource<GrSurface, GrIORef::kWrite_IOType> fDst; |
192 GrPendingIOResource<GrSurface> fSrc; | 190 GrPendingIOResource<GrSurface, GrIORef::kRead_IOType> fSrc; |
193 }; | 191 }; |
194 | 192 |
195 struct Clip : public ::SkNoncopyable { | 193 struct Clip : public ::SkNoncopyable { |
196 SkClipStack fStack; | 194 SkClipStack fStack; |
197 SkIPoint fOrigin; | 195 SkIPoint fOrigin; |
198 }; | 196 }; |
199 | 197 |
200 // overrides from GrDrawTarget | 198 // overrides from GrDrawTarget |
201 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 199 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
202 virtual void onDrawRect(const SkRect& rect, | 200 virtual void onDrawRect(const SkRect& rect, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; | 325 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS
tack; |
328 | 326 |
329 GeoPoolStateStack fGeoPoolStateStack; | 327 GeoPoolStateStack fGeoPoolStateStack; |
330 bool fFlushing; | 328 bool fFlushing; |
331 uint32_t fDrawID; | 329 uint32_t fDrawID; |
332 | 330 |
333 typedef GrDrawTarget INHERITED; | 331 typedef GrDrawTarget INHERITED; |
334 }; | 332 }; |
335 | 333 |
336 #endif | 334 #endif |
OLD | NEW |