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

Unified Diff: src/effects/SkGpuBlurUtils.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/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkGpuBlurUtils.cpp
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index 76c3b3bb7fe5dd609e461fd4c43cf21a362362e6..3297d2fc77c1e6265697ccb5f24ae390752ddaab 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -178,9 +178,19 @@ GrTexture* GaussianBlur(GrContext* context,
desc.fHeight = SkScalarFloorToInt(srcRect.height());
desc.fConfig = srcTexture->config();
- GrAutoScratchTexture temp1, temp2;
- GrTexture* dstTexture = temp1.set(context, desc);
- GrTexture* tempTexture = canClobberSrc ? srcTexture : temp2.set(context, desc);
+ GrTexture* dstTexture;
+ GrTexture* tempTexture;
+ SkAutoTUnref<GrTexture> temp1, temp2;
+
+ temp1.reset(context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch));
+ dstTexture = temp1.get();
+ if (canClobberSrc) {
+ tempTexture = srcTexture;
+ } else {
+ temp2.reset(context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch));
+ tempTexture = temp2.get();
+ }
+
if (NULL == dstTexture || NULL == tempTexture) {
return NULL;
}
@@ -295,14 +305,7 @@ GrTexture* GaussianBlur(GrContext* context,
srcTexture = dstTexture;
SkTSwap(dstTexture, tempTexture);
}
- if (srcTexture == temp1.texture()) {
- return temp1.detach();
- } else if (srcTexture == temp2.texture()) {
- return temp2.detach();
- } else {
- srcTexture->ref();
- return srcTexture;
- }
+ return SkRef(srcTexture);
}
#endif
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698