Chromium Code Reviews| Index: src/core/SkImageFilter.cpp |
| diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
| index d7af4e65d0656c13572683b08a429c52f13f87ad..f20b2ed156c10e5d8a20e75f5ff6812ce461393e 100644 |
| --- a/src/core/SkImageFilter.cpp |
| +++ b/src/core/SkImageFilter.cpp |
| @@ -264,9 +264,19 @@ bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, |
| bool SkImageFilter::filterInput(int index, Proxy* proxy, const SkBitmap& src, |
| const Context& context, |
| - SkBitmap* result, SkIPoint* offset) const { |
| + SkBitmap* result, SkIPoint* offset, |
| + bool relaxSizeConstraint) const { |
| SkImageFilter* input = this->getInput(index); |
| - return !input || input->filterImage(proxy, src, context, result, offset); |
| + if (!input) { |
| + return true; |
| + } |
| +#if SK_SUPPORT_GPU |
|
Stephen White
2015/10/22 15:25:04
Now that we're no longer using GPU-specific enums,
reed1
2015/10/22 16:24:55
Done. Good catch.
|
| + if (relaxSizeConstraint && (kExact_SizeConstraint == context.sizeConstraint())) { |
| + return input->filterImage(proxy, src, Context(context, kApprox_SizeConstraint), |
| + result, offset); |
| + } |
| +#endif |
| + return input->filterImage(proxy, src, context, result, offset); |
| } |
| bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, |
| @@ -347,7 +357,8 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont |
| desc.fHeight = bounds.height(); |
| desc.fConfig = kRGBA_8888_GrPixelConfig; |
| - SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc)); |
| + SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc, |
| + GrTextureProvider::FromImageFilter(ctx.sizeConstraint()))); |
| if (!dst) { |
| return false; |
| } |
| @@ -466,8 +477,9 @@ void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBit |
| } |
| bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy, |
| - const SkBitmap& src, const Context& ctx, |
| - SkBitmap* result, SkIPoint* offset) const { |
| + const SkBitmap& src, const Context& origFilterContext, |
| + SkBitmap* result, SkIPoint* offset, |
| + bool relaxSizeConstraint) const { |
| SkImageFilter* input = this->getInput(index); |
| if (!input) { |
| return true; |
| @@ -477,6 +489,12 @@ bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy, |
| // called are restored before we return to the caller. |
| GrContext* context = src.getTexture()->getContext(); |
| + SizeConstraint constraint = origFilterContext.sizeConstraint(); |
| + if (relaxSizeConstraint && (kExact_SizeConstraint == constraint)) { |
| + constraint = kApprox_SizeConstraint; |
| + } |
| + Context ctx(origFilterContext, constraint); |
| + |
| if (input->canFilterImageGPU()) { |
| return input->filterImageGPU(proxy, src, ctx, result, offset); |
| } else { |