OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
11 | 11 |
12 #include "GrBufferAllocPool.h" | 12 #include "GrBufferAllocPool.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrDrawTargetCaps.h" | 14 #include "GrDrawTargetCaps.h" |
15 #include "GrGpuResourcePriv.h" | 15 #include "GrGpuResourcePriv.h" |
16 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
17 #include "GrResourceCache.h" | 17 #include "GrResourceCache.h" |
18 #include "GrRenderTargetPriv.h" | 18 #include "GrRenderTargetPriv.h" |
19 #include "GrStencilAttachment.h" | 19 #include "GrStencilAttachment.h" |
20 #include "GrVertexBuffer.h" | 20 #include "GrVertexBuffer.h" |
| 21 #include "GrVertices.h" |
| 22 |
| 23 GrVertices& GrVertices::operator =(const GrVertices& di) { |
| 24 fPrimitiveType = di.fPrimitiveType; |
| 25 fStartVertex = di.fStartVertex; |
| 26 fStartIndex = di.fStartIndex; |
| 27 fVertexCount = di.fVertexCount; |
| 28 fIndexCount = di.fIndexCount; |
| 29 |
| 30 fInstanceCount = di.fInstanceCount; |
| 31 fVerticesPerInstance = di.fVerticesPerInstance; |
| 32 fIndicesPerInstance = di.fIndicesPerInstance; |
| 33 |
| 34 fVertexBuffer.reset(di.vertexBuffer()); |
| 35 fIndexBuffer.reset(di.indexBuffer()); |
| 36 |
| 37 return *this; |
| 38 } |
21 | 39 |
22 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
23 | 41 |
24 GrGpu::GrGpu(GrContext* context) | 42 GrGpu::GrGpu(GrContext* context) |
25 : fResetTimestamp(kExpiredTimestamp+1) | 43 : fResetTimestamp(kExpiredTimestamp+1) |
26 , fResetBits(kAll_GrBackendState) | 44 , fResetBits(kAll_GrBackendState) |
27 , fGpuTraceMarkerCount(0) | 45 , fGpuTraceMarkerCount(0) |
28 , fContext(context) { | 46 , fContext(context) { |
29 } | 47 } |
30 | 48 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (this->caps()->gpuTracingSupport()) { | 280 if (this->caps()->gpuTracingSupport()) { |
263 SkASSERT(fGpuTraceMarkerCount >= 1); | 281 SkASSERT(fGpuTraceMarkerCount >= 1); |
264 this->fActiveTraceMarkers.remove(*marker); | 282 this->fActiveTraceMarkers.remove(*marker); |
265 this->didRemoveGpuTraceMarker(); | 283 this->didRemoveGpuTraceMarker(); |
266 --fGpuTraceMarkerCount; | 284 --fGpuTraceMarkerCount; |
267 } | 285 } |
268 } | 286 } |
269 | 287 |
270 //////////////////////////////////////////////////////////////////////////////// | 288 //////////////////////////////////////////////////////////////////////////////// |
271 | 289 |
272 void GrGpu::draw(const DrawArgs& args, const GrDrawTarget::DrawInfo& info) { | 290 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { |
273 this->handleDirtyContext(); | 291 this->handleDirtyContext(); |
274 this->onDraw(args, info); | 292 this->onDraw(args, vertices); |
275 } | 293 } |
276 | 294 |
277 void GrGpu::stencilPath(const GrPath* path, const StencilPathState& state) { | 295 void GrGpu::stencilPath(const GrPath* path, const StencilPathState& state) { |
278 this->handleDirtyContext(); | 296 this->handleDirtyContext(); |
279 this->onStencilPath(path, state); | 297 this->onStencilPath(path, state); |
280 } | 298 } |
281 | 299 |
282 void GrGpu::drawPath(const DrawArgs& args, | 300 void GrGpu::drawPath(const DrawArgs& args, |
283 const GrPath* path, | 301 const GrPath* path, |
284 const GrStencilSettings& stencilSettings) { | 302 const GrStencilSettings& stencilSettings) { |
285 this->handleDirtyContext(); | 303 this->handleDirtyContext(); |
286 this->onDrawPath(args, path, stencilSettings); | 304 this->onDrawPath(args, path, stencilSettings); |
287 } | 305 } |
288 | 306 |
289 void GrGpu::drawPaths(const DrawArgs& args, | 307 void GrGpu::drawPaths(const DrawArgs& args, |
290 const GrPathRange* pathRange, | 308 const GrPathRange* pathRange, |
291 const void* indices, | 309 const void* indices, |
292 GrDrawTarget::PathIndexType indexType, | 310 GrDrawTarget::PathIndexType indexType, |
293 const float transformValues[], | 311 const float transformValues[], |
294 GrDrawTarget::PathTransformType transformType, | 312 GrDrawTarget::PathTransformType transformType, |
295 int count, | 313 int count, |
296 const GrStencilSettings& stencilSettings) { | 314 const GrStencilSettings& stencilSettings) { |
297 this->handleDirtyContext(); | 315 this->handleDirtyContext(); |
298 pathRange->willDrawPaths(indices, indexType, count); | 316 pathRange->willDrawPaths(indices, indexType, count); |
299 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, | 317 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, |
300 transformType, count, stencilSettings); | 318 transformType, count, stencilSettings); |
301 } | 319 } |
OLD | NEW |