Go to file
senorblanco 46112cf2a7 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,
SkLightingImageFilter, SkMatrixConvolutionImageFilter,
SkMatrixImageFilter) whose GPU implementation depends on
0..1 texture coordinates.
3) Remove the exception for GPU-side image filters in
SkCanvas::internalSaveLayer().

For the lighting filters, there were two bugs which were
cancelling each other out: the sobel filter matrix was
being computed upside down, but then we'd negate the
resulting normal. This worked fine in the exact-match case,
but in the approx-match case we'd sample garbage along
the edge pixels. Also, we never implemented the edge pixels
according to spec in the GPU case. It requires a
different fragment shader for each edge of the nine-patch,
which meant we couldn't use asFragmentProcessor(), and had
to implement the drawing via a filterImageGPU() override.
In order to avoid polluting the public API, I inserted a
new base class, SkLightingImageFilterInternal above
Sk[Diffuse|Specular]LightingImageFilter to handle the
implementation.

For the SkMatrixConvolutionImageFilter, it seems the
GLSL clamp() function occasionally returns values outside
the clamped range, resulting in access of garbage
texels even in GL_NEAREST. The fix here is to clamp to a
rect inset by half a texel. There was also a bug in
the unpremultiply step when fConvolveAlpha is false.

For SkMatrixImageFilter, the fix was to make the generic
draw path be more careful about when to use texture domain.
If the bitmap already has a texture, use texture domain
if the srcRect is smaller than the entire texture (not
the entire bitmap).

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

Committed: https://skia.googlesource.com/skia/+/b97dafefe63ea0a1bbce8e8b209f4920983fb8b9

Committed: https://skia.googlesource.com/skia/+/f5f8518fe0bbd2703e4ffc1b11ad7b4312ff7641

Review URL: https://codereview.chromium.org/1034733002
2015-04-01 14:17:14 -07:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Add timing SkCodec to nanobench. 2015-04-01 12:09:17 -07:00
bin tools: add sync-and-gyp script 2015-03-27 12:11:49 -07:00
debugger Debugger: remove dead feature (SkPicture offset display) & fix bug (unbalanced indents) 2015-03-26 10:08:04 -07:00
dm DM: JSON output adds process_max_resident_set_size_MB 2015-04-01 13:31:34 -07:00
docs Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
example C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
experimental C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
forth Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
gm Implement approx-match support in image filter saveLayer() offscreen. 2015-04-01 14:17:14 -07:00
gyp move Atlas Text Context to its own file 2015-04-01 12:40:54 -07:00
include Switch to one single bitmap text blob cache allocation 2015-04-01 11:30:28 -07:00
platform_tools Update the Android scripts to refresh device names and capabilities. 2015-04-01 12:15:39 -07:00
resources Ico test with embedded png 2015-04-01 12:09:22 -07:00
samplecode C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
site C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
src Implement approx-match support in image filter saveLayer() offscreen. 2015-04-01 14:17:14 -07:00
tests That last CL subverted the purpose of the test. Put it back how it was. 2015-04-01 13:36:23 -07:00
third_party Revert of Enable both static and dynamically linked libpng (patchset #4 id:60001 of https://codereview.chromium.org/1032253003/) 2015-04-01 11:20:12 -07:00
tools Turn on Chromium's top 25 page set 2015-03-31 10:59:15 -07:00
.gitignore git: add skps to .gitignore 2015-02-13 18:57:33 -08:00
AUTHORS Fix GIF transparency. 2015-02-04 21:31:23 -08:00
codereview.settings Automatically add a docs preview link and NOTRY=true when there are only docs changes. 2015-02-26 10:16:13 -08:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS add new Skia team member to committers list 2015-02-03 11:10:57 -08:00
DEPS WIP: Added support for giflib, updated jpeg and png 2015-03-30 07:52:52 -07:00
Doxyfile C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
gyp_skia allow caller to override the default output directory for gyp 2014-09-29 11:42:25 -07:00
gyp_skia.py Roll gyp deps from 1765 to 1796. 2013-11-21 18:11:14 +00:00
HASHTAGS Fix cr SKPs naming 2015-03-31 08:03:02 -07:00
LICENSE Manually update copyright notices in files that defied the automated process 2011-07-28 14:24:55 +00:00
make.bat Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
make.py Run gyp on Win with --no-parallel -G config=$(BUILDTYPE), fix pylint 2015-03-03 13:15:38 -05:00
Makefile Run gyp with --no-parallel -G config=$(BUILDTYPE) 2015-03-03 06:05:56 -08:00
OWNERS add root files from chrome 2013-08-13 19:11:15 +00:00
PRESUBMIT.py Find the HASHTAGS file even if you are not at the checkout root. 2015-04-01 09:12:51 -07:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium add root files from chrome 2013-08-13 19:11:15 +00:00
skia.gyp Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
SKP_VERSION Update SKP version 2015-03-29 01:19:04 -07:00
whitespace.txt Whitespace change to see if Android bots are fixed 2015-03-27 09:46:25 -07:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.