| 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 | 10 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 #endif | 448 #endif |
| 449 } | 449 } |
| 450 | 450 |
| 451 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could | 451 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could |
| 452 // have per-sample dst values by making the copy multisampled. | 452 // have per-sample dst values by making the copy multisampled. |
| 453 GrTextureDesc desc; | 453 GrTextureDesc desc; |
| 454 this->initCopySurfaceDstDesc(rt, &desc); | 454 this->initCopySurfaceDstDesc(rt, &desc); |
| 455 desc.fWidth = copyRect.width(); | 455 desc.fWidth = copyRect.width(); |
| 456 desc.fHeight = copyRect.height(); | 456 desc.fHeight = copyRect.height(); |
| 457 | 457 |
| 458 GrAutoScratchTexture ast(fContext, desc, GrContext::kApprox_ScratchTexMatch)
; | 458 SkAutoTUnref<GrTexture> copy( |
| 459 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
| 459 | 460 |
| 460 if (NULL == ast.texture()) { | 461 if (!copy) { |
| 461 GrPrintf("Failed to create temporary copy of destination texture.\n"); | 462 GrPrintf("Failed to create temporary copy of destination texture.\n"); |
| 462 return false; | 463 return false; |
| 463 } | 464 } |
| 464 SkIPoint dstPoint = {0, 0}; | 465 SkIPoint dstPoint = {0, 0}; |
| 465 if (this->copySurface(ast.texture(), rt, copyRect, dstPoint)) { | 466 if (this->copySurface(copy, rt, copyRect, dstPoint)) { |
| 466 dstCopy->setTexture(ast.texture()); | 467 dstCopy->setTexture(copy); |
| 467 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); | 468 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); |
| 468 return true; | 469 return true; |
| 469 } else { | 470 } else { |
| 470 return false; | 471 return false; |
| 471 } | 472 } |
| 472 } | 473 } |
| 473 | 474 |
| 474 void GrDrawTarget::drawIndexed(GrPrimitiveType type, | 475 void GrDrawTarget::drawIndexed(GrPrimitiveType type, |
| 475 int startVertex, | 476 int startVertex, |
| 476 int startIndex, | 477 int startIndex, |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 | 1152 |
| 1152 uint32_t GrDrawTargetCaps::CreateUniqueID() { | 1153 uint32_t GrDrawTargetCaps::CreateUniqueID() { |
| 1153 static int32_t gUniqueID = SK_InvalidUniqueID; | 1154 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 1154 uint32_t id; | 1155 uint32_t id; |
| 1155 do { | 1156 do { |
| 1156 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 1157 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 1157 } while (id == SK_InvalidUniqueID); | 1158 } while (id == SK_InvalidUniqueID); |
| 1158 return id; | 1159 return id; |
| 1159 } | 1160 } |
| 1160 | 1161 |
| OLD | NEW |