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
This commit is contained in:
senorblanco 2014-08-15 10:48:43 -07:00 committed by Commit bot
parent cccb3b44e4
commit 673d9732bf
4 changed files with 15 additions and 0 deletions

View File

@ -256,6 +256,9 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
desc.fConfig = kRGBA_8888_GrPixelConfig; desc.fConfig = kRGBA_8888_GrPixelConfig;
GrAutoScratchTexture dst(context, desc); GrAutoScratchTexture dst(context, desc);
if (NULL == dst.texture()) {
return false;
}
GrContext::AutoMatrix am; GrContext::AutoMatrix am;
am.setIdentity(context); am.setIdentity(context);
GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget());

View File

@ -389,6 +389,9 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
desc.fConfig = kSkia8888_GrPixelConfig; desc.fConfig = kSkia8888_GrPixelConfig;
GrAutoScratchTexture ast(context, desc); GrAutoScratchTexture ast(context, desc);
if (NULL == ast.texture()) {
return false;
}
SkAutoTUnref<GrTexture> dst(ast.detach()); SkAutoTUnref<GrTexture> dst(ast.detach());
GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); GrContext::AutoRenderTarget art(context, dst->asRenderTarget());

View File

@ -506,6 +506,9 @@ bool apply_morphology(const SkBitmap& input,
if (radius.fWidth > 0) { if (radius.fWidth > 0) {
GrAutoScratchTexture ast(context, desc); GrAutoScratchTexture ast(context, desc);
if (NULL == ast.texture()) {
return false;
}
GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()); GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth, apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth,
morphType, Gr1DKernelEffect::kX_Direction); morphType, Gr1DKernelEffect::kX_Direction);
@ -519,6 +522,9 @@ bool apply_morphology(const SkBitmap& input,
} }
if (radius.fHeight > 0) { if (radius.fHeight > 0) {
GrAutoScratchTexture ast(context, desc); GrAutoScratchTexture ast(context, desc);
if (NULL == ast.texture()) {
return false;
}
GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()); GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget());
apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight, apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight,
morphType, Gr1DKernelEffect::kY_Direction); morphType, Gr1DKernelEffect::kY_Direction);

View File

@ -132,6 +132,9 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
desc.fConfig = kSkia8888_GrPixelConfig; desc.fConfig = kSkia8888_GrPixelConfig;
GrAutoScratchTexture ast(context, desc); GrAutoScratchTexture ast(context, desc);
if (NULL == ast.texture()) {
return false;
}
SkAutoTUnref<GrTexture> dst(ast.detach()); SkAutoTUnref<GrTexture> dst(ast.detach());
GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); GrContext::AutoRenderTarget art(context, dst->asRenderTarget());