| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 #include "GrGpu.h" | 9 #include "GrGpu.h" |
| 10 | 10 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, | 183 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, |
| 184 GrWrapOwnership ownership) { | 184 GrWrapOwnership ownership) { |
| 185 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 185 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 186 return nullptr; | 186 return nullptr; |
| 187 } | 187 } |
| 188 this->handleDirtyContext(); | 188 this->handleDirtyContext(); |
| 189 return this->onWrapBackendRenderTarget(desc, ownership); | 189 return this->onWrapBackendRenderTarget(desc, ownership); |
| 190 } | 190 } |
| 191 | 191 |
| 192 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc, |
| 193 GrWrapOwnership ownershi
p) { |
| 194 this->handleDirtyContext(); |
| 195 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
| 196 return nullptr; |
| 197 } |
| 198 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 199 return nullptr; |
| 200 } |
| 201 return this->onWrapBackendTextureAsRenderTarget(desc, ownership); |
| 202 } |
| 203 |
| 192 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { | 204 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { |
| 193 this->handleDirtyContext(); | 205 this->handleDirtyContext(); |
| 194 GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic); | 206 GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic); |
| 195 if (!this->caps()->reuseScratchBuffers()) { | 207 if (!this->caps()->reuseScratchBuffers()) { |
| 196 vb->resourcePriv().removeScratchKey(); | 208 vb->resourcePriv().removeScratchKey(); |
| 197 } | 209 } |
| 198 return vb; | 210 return vb; |
| 199 } | 211 } |
| 200 | 212 |
| 201 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { | 213 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 } | 390 } |
| 379 | 391 |
| 380 GrVertices::Iterator iter; | 392 GrVertices::Iterator iter; |
| 381 const GrNonInstancedVertices* verts = iter.init(vertices); | 393 const GrNonInstancedVertices* verts = iter.init(vertices); |
| 382 do { | 394 do { |
| 383 this->onDraw(args, *verts); | 395 this->onDraw(args, *verts); |
| 384 fStats.incNumDraws(); | 396 fStats.incNumDraws(); |
| 385 } while ((verts = iter.next())); | 397 } while ((verts = iter.next())); |
| 386 } | 398 } |
| 387 | 399 |
| OLD | NEW |