Implement approx-match support in image filter saveLayer() offscreen.
authorsenorblanco <senorblanco@chromium.org>
Sat, 28 Mar 2015 20:43:14 +0000 (13:43 -0700)
committerCommit bot <commit-bot@chromium.org>
Sat, 28 Mar 2015 20:43:14 +0000 (13:43 -0700)
commitb97dafefe63ea0a1bbce8e8b209f4920983fb8b9
tree069e7aa4d234b37b86c08b5aa30a712b81f7a45f
parentd8b34c26c2a2f8e37e0cc9a7910306aecacadd92
Implement approx-match support in image filter saveLayer() offscreen.

Currently, the GPU-side image filter implementation creates exact-match
textures for the offscreen backing stores for saveLayer().  This is
because several filters have GPU implementations which depend on the
texture coordinates being 0..1.

The fix is three-fold:

1) Store the actual requested size in the SkGpuDevice, so that when
wrapping it in an SkBitmap for passing to filterImage(), we can give
it the original size.
2) Fix the filters (SkMagnifierImageFilter, more TBD) whose GPU
implementation depends on 0..1 texture coordinates.
3) Remove the exception for GPU-side image filters in
SkCanvas::internalSaveLayer().

N.B.: this change will cause some minor pixel diffs in the
GPU results of the following GMs (and possibly more):
matriximagefilter, matrixconvolution, imagefiltersscaled,
lighting, imagemagnifier, filterfastbounds,
complexclip_aa_Layer_invert, complexclip_aa_layer,
complexclip_bw_layer_invert, complexclip_bw_layer.

BUG=skia:3532

Review URL: https://codereview.chromium.org/1034733002
src/core/SkCanvas.cpp
src/effects/SkMagnifierImageFilter.cpp
src/gpu/SkGpuDevice.cpp
src/gpu/SkGpuDevice.h