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 if (!buffer) { | |
bsalomon
2016/01/05 14:01:17
wondering whether this should be an assert since G
jvanverth1
2016/01/05 17:21:28
Done.
| |
354 return false; | |
355 } | |
356 | |
357 this->handleDirtyContext(); | |
358 if (this->onTransferPixels(surface, left, top, width, height, config, | |
359 buffer, offset, rowBytes)) { | |
360 fStats.incTransfersToTexture(); | |
361 return true; | |
362 } | |
363 return false; | |
364 } | |
365 | |
349 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { | 366 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
350 SkASSERT(target); | 367 SkASSERT(target); |
351 this->handleDirtyContext(); | 368 this->handleDirtyContext(); |
352 this->onResolveRenderTarget(target); | 369 this->onResolveRenderTarget(target); |
353 } | 370 } |
354 | 371 |
355 //////////////////////////////////////////////////////////////////////////////// | 372 //////////////////////////////////////////////////////////////////////////////// |
356 | 373 |
357 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { | 374 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { |
358 this->handleDirtyContext(); | 375 this->handleDirtyContext(); |
359 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c aps())) { | 376 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c aps())) { |
360 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 377 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
361 } | 378 } |
362 | 379 |
363 GrVertices::Iterator iter; | 380 GrVertices::Iterator iter; |
364 const GrNonInstancedVertices* verts = iter.init(vertices); | 381 const GrNonInstancedVertices* verts = iter.init(vertices); |
365 do { | 382 do { |
366 this->onDraw(args, *verts); | 383 this->onDraw(args, *verts); |
367 fStats.incNumDraws(); | 384 fStats.incNumDraws(); |
368 } while ((verts = iter.next())); | 385 } while ((verts = iter.next())); |
369 } | 386 } |
OLD | NEW |