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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 mipLevel.fRowBytes = rowBytes; | 395 mipLevel.fRowBytes = rowBytes; |
396 SkSTArray<1, GrMipLevel> texels; | 396 SkSTArray<1, GrMipLevel> texels; |
397 texels.push_back(mipLevel); | 397 texels.push_back(mipLevel); |
398 | 398 |
399 return this->writePixels(surface, left, top, width, height, config, texels); | 399 return this->writePixels(surface, left, top, width, height, config, texels); |
400 } | 400 } |
401 | 401 |
402 bool GrGpu::transferPixels(GrSurface* surface, | 402 bool GrGpu::transferPixels(GrSurface* surface, |
403 int left, int top, int width, int height, | 403 int left, int top, int width, int height, |
404 GrPixelConfig config, GrBuffer* transferBuffer, | 404 GrPixelConfig config, GrBuffer* transferBuffer, |
405 size_t offset, size_t rowBytes) { | 405 size_t offset, size_t rowBytes, GrFence* fence) { |
406 SkASSERT(transferBuffer); | 406 SkASSERT(transferBuffer); |
| 407 SkASSERT(fence); |
407 | 408 |
408 this->handleDirtyContext(); | 409 this->handleDirtyContext(); |
409 if (this->onTransferPixels(surface, left, top, width, height, config, | 410 if (this->onTransferPixels(surface, left, top, width, height, config, |
410 transferBuffer, offset, rowBytes)) { | 411 transferBuffer, offset, rowBytes)) { |
411 SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); | 412 SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); |
412 this->didWriteToSurface(surface, &rect); | 413 this->didWriteToSurface(surface, &rect); |
413 fStats.incTransfersToTexture(); | 414 fStats.incTransfersToTexture(); |
| 415 |
| 416 if (*fence) { |
| 417 this->deleteFence(*fence); |
| 418 } |
| 419 *fence = this->insertFence(); |
| 420 |
414 return true; | 421 return true; |
415 } | 422 } |
416 return false; | 423 return false; |
417 } | 424 } |
418 | 425 |
419 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { | 426 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
420 SkASSERT(target); | 427 SkASSERT(target); |
421 this->handleDirtyContext(); | 428 this->handleDirtyContext(); |
422 this->onResolveRenderTarget(target); | 429 this->onResolveRenderTarget(target); |
423 } | 430 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. | 496 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. |
490 if (a[i].x() != b[i].x()) { | 497 if (a[i].x() != b[i].x()) { |
491 return a[i].x() < b[i].x(); | 498 return a[i].x() < b[i].x(); |
492 } | 499 } |
493 if (a[i].y() != b[i].y()) { | 500 if (a[i].y() != b[i].y()) { |
494 return a[i].y() < b[i].y(); | 501 return a[i].y() < b[i].y(); |
495 } | 502 } |
496 } | 503 } |
497 return false; // Equal. | 504 return false; // Equal. |
498 } | 505 } |
OLD | NEW |