Fix for empty saveLayer() with a filter which affects transparent black.
authorsenorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 6 May 2014 22:52:55 +0000 (22:52 +0000)
committersenorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 6 May 2014 22:52:55 +0000 (22:52 +0000)
commit68250c8e7c2bf5d669397c849259c3bcad40237e
treeaa329d70ad41c951d75d2d91b7b9cec10592746c
parent0992404e3815b7b0d00c64fc4f6beceac4bba10f
Fix for empty saveLayer() with a filter which affects transparent black.

If an saveLayer()/restore() is recorded, tilegrid/rtree will cull them
out and not draw anything. This is correct for most cases, but if the
paint in the saveLayer() is one that affects transparent black (e.g.,
it contains a color filter or image filter which affects transparent
black), this is incorrect: the filter should be applied.

Fixed by adding a no-op between the saveLayer() and restore(), and
adding a bbox node pointing at that node with the saveLayer()'s bounds.

This exposed a bug in SkPictureRecord.cpp's match(), where it would
assert if the NOOP was the last op seen. Fixed with an early-out before
calling peek_op_and_size().

BUG=skia:2254

Review URL: https://codereview.chromium.org/262363007

git-svn-id: http://skia.googlecode.com/svn/trunk@14604 2bbb7eff-a529-9590-31e7-b0007b416f81
src/core/SkBBoxHierarchyRecord.cpp
src/core/SkPictureRecord.cpp
src/core/SkPictureRecord.h
tests/ImageFilterTest.cpp