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

Unified Diff: src/effects/SkMorphologyImageFilter.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/SkGpuBlurUtils.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMorphologyImageFilter.cpp
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 3e3dbe41fe9ea8b4151f01712b169583b6a85c34..6c3e6f6dc7633d9ee468bcdf14c1603130a2daf8 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -503,11 +503,9 @@ bool apply_morphology(const SkBitmap& input,
GrMorphologyEffect::MorphologyType morphType,
SkISize radius,
SkBitmap* dst) {
- GrTexture* srcTexture = input.getTexture();
+ SkAutoTUnref<GrTexture> srcTexture(SkRef(input.getTexture()));
SkASSERT(srcTexture);
GrContext* context = srcTexture->getContext();
- srcTexture->ref();
- SkAutoTUnref<GrTexture> src(srcTexture);
GrContext::AutoMatrix am;
am.setIdentity(context);
@@ -524,32 +522,32 @@ bool apply_morphology(const SkBitmap& input,
SkIRect srcRect = rect;
if (radius.fWidth > 0) {
- GrAutoScratchTexture ast(context, desc);
- if (NULL == ast.texture()) {
+ GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch);
+ if (NULL == texture) {
return false;
}
- GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
- apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth,
+ GrContext::AutoRenderTarget art(context, texture->asRenderTarget());
+ apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fWidth,
morphType, Gr1DKernelEffect::kX_Direction);
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
dstRect.width(), radius.fHeight);
context->clear(&clearRect, GrMorphologyEffect::kErode_MorphologyType == morphType ?
SK_ColorWHITE :
SK_ColorTRANSPARENT, false);
- src.reset(ast.detach());
+ srcTexture.reset(texture);
srcRect = dstRect;
}
if (radius.fHeight > 0) {
- GrAutoScratchTexture ast(context, desc);
- if (NULL == ast.texture()) {
+ GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch);
+ if (NULL == texture) {
return false;
}
- GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
- apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight,
+ GrContext::AutoRenderTarget art(context, texture->asRenderTarget());
+ apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fHeight,
morphType, Gr1DKernelEffect::kY_Direction);
- src.reset(ast.detach());
+ srcTexture.reset(texture);
}
- SkImageFilter::WrapTexture(src, rect.width(), rect.height(), dst);
+ SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst);
return true;
}
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698