Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1202)

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 638403003: Remove uses of GrAutoScratchTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698