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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return this->onReadPixels(surface, | 327 return this->onReadPixels(surface, |
328 left, top, width, height, | 328 left, top, width, height, |
329 config, buffer, | 329 config, buffer, |
330 rowBytes); | 330 rowBytes); |
331 } | 331 } |
332 | 332 |
333 bool GrGpu::writePixels(GrSurface* surface, | 333 bool GrGpu::writePixels(GrSurface* surface, |
334 int left, int top, int width, int height, | 334 int left, int top, int width, int height, |
335 GrPixelConfig config, const void* buffer, | 335 GrPixelConfig config, const void* buffer, |
336 size_t rowBytes) { | 336 size_t rowBytes) { |
337 if (!buffer) { | 337 if (!buffer || !surface) { |
338 return false; | 338 return false; |
339 } | 339 } |
340 | 340 |
341 this->handleDirtyContext(); | 341 this->handleDirtyContext(); |
342 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r
owBytes)) { | 342 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r
owBytes)) { |
343 fStats.incTextureUploads(); | 343 fStats.incTextureUploads(); |
344 return true; | 344 return true; |
345 } | 345 } |
346 return false; | 346 return false; |
347 } | 347 } |
348 | 348 |
| 349 bool GrGpu::transferPixels(GrSurface* surface, |
| 350 int left, int top, int width, int height, |
| 351 GrPixelConfig config, GrTransferBuffer* buffer, |
| 352 size_t offset, size_t rowBytes) { |
| 353 SkASSERT(buffer); |
| 354 |
| 355 this->handleDirtyContext(); |
| 356 if (this->onTransferPixels(surface, left, top, width, height, config, |
| 357 buffer, offset, rowBytes)) { |
| 358 fStats.incTransfersToTexture(); |
| 359 return true; |
| 360 } |
| 361 return false; |
| 362 } |
| 363 |
349 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { | 364 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
350 SkASSERT(target); | 365 SkASSERT(target); |
351 this->handleDirtyContext(); | 366 this->handleDirtyContext(); |
352 this->onResolveRenderTarget(target); | 367 this->onResolveRenderTarget(target); |
353 } | 368 } |
354 | 369 |
355 //////////////////////////////////////////////////////////////////////////////// | 370 //////////////////////////////////////////////////////////////////////////////// |
356 | 371 |
357 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { | 372 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { |
358 this->handleDirtyContext(); | 373 this->handleDirtyContext(); |
359 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c
aps())) { | 374 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c
aps())) { |
360 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 375 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
361 } | 376 } |
362 | 377 |
363 GrVertices::Iterator iter; | 378 GrVertices::Iterator iter; |
364 const GrNonInstancedVertices* verts = iter.init(vertices); | 379 const GrNonInstancedVertices* verts = iter.init(vertices); |
365 do { | 380 do { |
366 this->onDraw(args, *verts); | 381 this->onDraw(args, *verts); |
367 fStats.incNumDraws(); | 382 fStats.incNumDraws(); |
368 } while ((verts = iter.next())); | 383 } while ((verts = iter.next())); |
369 } | 384 } |
OLD | NEW |