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

Unified Diff: src/gpu/GrContext.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 402e2ec9aec77c0406d6196fc31d149b36f2f7a1..b9cbf3f1a3a97ac044ed210a136ec9a072f5dcfb 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -446,9 +446,8 @@ GrTexture* GrContext::createNewScratchTexture(const GrTextureDesc& desc) {
return texture;
}
-GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, ScratchTexMatch match,
- bool calledDuringFlush) {
-
+GrTexture* GrContext::refScratchTexture(const GrTextureDesc& inDesc, ScratchTexMatch match,
+ bool calledDuringFlush) {
// kNoStencil has no meaning if kRT isn't set.
SkASSERT((inDesc.fFlags & kRenderTarget_GrTextureFlagBit) ||
!(inDesc.fFlags & kNoStencil_GrTextureFlagBit));
@@ -1306,9 +1305,8 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = writeConfig;
- GrAutoScratchTexture ast(this, desc);
- GrTexture* texture = ast.texture();
- if (NULL == texture) {
+ SkAutoTUnref<GrTexture> texture(this->refScratchTexture(desc, kApprox_ScratchTexMatch));
+ if (!texture) {
return false;
}
@@ -1438,7 +1436,6 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
// conversions in the draw we set the corresponding bool to false so that we don't reapply it
// on the read back pixels.
GrTexture* src = target->asTexture();
- GrAutoScratchTexture ast;
if (src && (swapRAndB || unpremul || flipY)) {
// Make the scratch a render so we can read its pixels.
GrTextureDesc desc;
@@ -1460,8 +1457,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
fGpu->fullReadPixelsIsFasterThanPartial()) {
match = kExact_ScratchTexMatch;
}
- ast.set(this, desc, match);
- GrTexture* texture = ast.texture();
+ SkAutoTUnref<GrTexture> texture(this->refScratchTexture(desc, match));
if (texture) {
// compute a matrix to perform the draw
SkMatrix textureMatrix;
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698