Check all scratch texture allocations for image filters.
BUG=403677
R=bsalomon@google.com
NOTREECHECKS=true
Author: senorblanco@chromium.org
Review URL: https://codereview.chromium.org/473283002
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 26aaa02..bae7ac0 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -389,6 +389,9 @@
desc.fConfig = kSkia8888_GrPixelConfig;
GrAutoScratchTexture ast(context, desc);
+ if (NULL == ast.texture()) {
+ return false;
+ }
SkAutoTUnref<GrTexture> dst(ast.detach());
GrContext::AutoRenderTarget art(context, dst->asRenderTarget());
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 49df654..67769f2 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -506,6 +506,9 @@
if (radius.fWidth > 0) {
GrAutoScratchTexture ast(context, desc);
+ if (NULL == ast.texture()) {
+ return false;
+ }
GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth,
morphType, Gr1DKernelEffect::kX_Direction);
@@ -519,6 +522,9 @@
}
if (radius.fHeight > 0) {
GrAutoScratchTexture ast(context, desc);
+ if (NULL == ast.texture()) {
+ return false;
+ }
GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight,
morphType, Gr1DKernelEffect::kY_Direction);
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index cf32cf5..c876d5f 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -132,6 +132,9 @@
desc.fConfig = kSkia8888_GrPixelConfig;
GrAutoScratchTexture ast(context, desc);
+ if (NULL == ast.texture()) {
+ return false;
+ }
SkAutoTUnref<GrTexture> dst(ast.detach());
GrContext::AutoRenderTarget art(context, dst->asRenderTarget());