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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 GrGpu::GrGpu(GrContext* context) | 24 GrGpu::GrGpu(GrContext* context) |
25 : fResetTimestamp(kExpiredTimestamp+1) | 25 : fResetTimestamp(kExpiredTimestamp+1) |
26 , fResetBits(kAll_GrBackendState) | 26 , fResetBits(kAll_GrBackendState) |
27 , fQuadIndexBuffer(NULL) | 27 , fQuadIndexBuffer(NULL) |
28 , fContext(context) { | 28 , fContext(context) { |
29 } | 29 } |
30 | 30 |
31 GrGpu::~GrGpu() { | 31 GrGpu::~GrGpu() { |
32 SkSafeSetNull(fQuadIndexBuffer); | 32 SkSafeSetNull(fQuadIndexBuffer); |
33 SkSafeUnref(fGeoSrcState.fVertexBuffer); | |
34 SkSafeUnref(fGeoSrcState.fIndexBuffer); | |
35 } | 33 } |
36 | 34 |
37 void GrGpu::contextAbandoned() {} | 35 void GrGpu::contextAbandoned() {} |
38 | 36 |
39 //////////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////////// |
40 | 38 |
41 GrTexture* GrGpu::createTexture(const GrSurfaceDesc& desc, | 39 GrTexture* GrGpu::createTexture(const GrSurfaceDesc& desc, |
42 const void* srcData, size_t rowBytes) { | 40 const void* srcData, size_t rowBytes) { |
43 if (!this->caps()->isConfigTexturable(desc.fConfig)) { | 41 if (!this->caps()->isConfigTexturable(desc.fConfig)) { |
44 return NULL; | 42 return NULL; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 251 |
254 void GrGpu::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 252 void GrGpu::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
255 if (this->caps()->gpuTracingSupport()) { | 253 if (this->caps()->gpuTracingSupport()) { |
256 SkASSERT(fGpuTraceMarkerCount >= 1); | 254 SkASSERT(fGpuTraceMarkerCount >= 1); |
257 this->fActiveTraceMarkers.remove(*marker); | 255 this->fActiveTraceMarkers.remove(*marker); |
258 this->didRemoveGpuTraceMarker(); | 256 this->didRemoveGpuTraceMarker(); |
259 --fGpuTraceMarkerCount; | 257 --fGpuTraceMarkerCount; |
260 } | 258 } |
261 } | 259 } |
262 | 260 |
263 void GrGpu::setVertexSourceToBuffer(const GrVertexBuffer* buffer, size_t vertexS
tride) { | |
264 SkSafeUnref(fGeoSrcState.fVertexBuffer); | |
265 fGeoSrcState.fVertexBuffer = buffer; | |
266 buffer->ref(); | |
267 fGeoSrcState.fVertexSize = vertexStride; | |
268 } | |
269 | |
270 void GrGpu::setIndexSourceToBuffer(const GrIndexBuffer* buffer) { | |
271 SkSafeUnref(fGeoSrcState.fIndexBuffer); | |
272 fGeoSrcState.fIndexBuffer = buffer; | |
273 buffer->ref(); | |
274 } | |
275 | |
276 //////////////////////////////////////////////////////////////////////////////// | 261 //////////////////////////////////////////////////////////////////////////////// |
277 | 262 |
278 static const int MAX_QUADS = 1 << 12; // max possible: (1 << 14) - 1; | 263 static const int MAX_QUADS = 1 << 12; // max possible: (1 << 14) - 1; |
279 | 264 |
280 GR_STATIC_ASSERT(4 * MAX_QUADS <= 65535); | 265 GR_STATIC_ASSERT(4 * MAX_QUADS <= 65535); |
281 | 266 |
282 static const uint16_t gQuadIndexPattern[] = { | 267 static const uint16_t gQuadIndexPattern[] = { |
283 0, 1, 2, 0, 2, 3 | 268 0, 1, 2, 0, 2, 3 |
284 }; | 269 }; |
285 | 270 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 this->handleDirtyContext(); | 336 this->handleDirtyContext(); |
352 | 337 |
353 if (!this->flushGraphicsState(ds, kDrawPaths_DrawType, scissorState, dstCopy
)) { | 338 if (!this->flushGraphicsState(ds, kDrawPaths_DrawType, scissorState, dstCopy
)) { |
354 return; | 339 return; |
355 } | 340 } |
356 | 341 |
357 pathRange->willDrawPaths(indices, count); | 342 pathRange->willDrawPaths(indices, count); |
358 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran
sformsType, | 343 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran
sformsType, |
359 stencilSettings); | 344 stencilSettings); |
360 } | 345 } |
OLD | NEW |