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

Unified Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 1929833004: Revert of Refactor drawContext/RenderTarget creation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/core/SkImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkAlphaThresholdFilter.cpp
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index cec45ba9114243cb9ba768ee9b7585226e216604..bfbcfd21f8b959e8acfeeab9fc0c0e41a032457c 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -95,16 +95,24 @@
sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* context,
const SkMatrix& inMatrix,
const SkIRect& bounds) const {
- GrPixelConfig config;
+ GrSurfaceDesc maskDesc;
if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
- config = kAlpha_8_GrPixelConfig;
+ maskDesc.fConfig = kAlpha_8_GrPixelConfig;
} else {
- config = kRGBA_8888_GrPixelConfig;
- }
-
- sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
- bounds.width(), bounds.height(),
- config));
+ maskDesc.fConfig = kRGBA_8888_GrPixelConfig;
+ }
+ maskDesc.fFlags = kRenderTarget_GrSurfaceFlag;
+ // Add one pixel of border to ensure that clamp mode will be all zeros
+ // the outside.
+ maskDesc.fWidth = bounds.width();
+ maskDesc.fHeight = bounds.height();
+ sk_sp<GrTexture> maskTexture(context->textureProvider()->createApproxTexture(maskDesc));
+ if (!maskTexture) {
+ return nullptr;
+ }
+
+ sk_sp<GrDrawContext> drawContext(
+ context->drawContext(sk_ref_sp(maskTexture->asRenderTarget())));
if (!drawContext) {
return nullptr;
}
@@ -121,7 +129,7 @@
iter.next();
}
- return drawContext->asTexture();
+ return maskTexture;
}
#endif
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698