Fix end-of-pattern matching for Skia recording optimization.
authordneto <dneto@chromium.org>
Wed, 30 Jul 2014 22:42:22 +0000 (15:42 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 30 Jul 2014 22:42:22 +0000 (15:42 -0700)
commit3f22e8c44a16d93377c0a3881f936e692b5b3320
treef47787b30555eee25078d6b411f3fbb54e0f2eaf
parent3d822c29d4272a6749e59801b202b1ed6d611be8
Fix end-of-pattern matching for Skia recording optimization.

The recorder optimizer's pattern matcher was accepting command sequences
when it shouldn't have.

In the submitted case, and the pattern matcher was looking for:
saveLayer, drawBitmap, restore
and in the rendering for the submitted case, the sequence of commands
were:
saveLayer, drawBitmap, drawBitmap, restore

This sequence was improperly accepted by the matcher, and the optimizer
reduced the sequence to:
drawBitmap, drawBitmap
where the opacity from the saveLayer paint argument was applied
to the first drawBitmap only.

The user-visible effect in Chrome was a flashing effect on an image
caused by incorrect (too-high) opacity.

The patch adds a Skia test to check for pixel colour values in
a similarly structured recording.  All other Skia tests pass.
Blink layout tests also pass with this change.

BUG=chromium:344987
R=robertphillips@google.com, reed@google.com, mtklein@google.com

Author: dneto@chromium.org

Review URL: https://codereview.chromium.org/430503004
src/core/SkPictureRecord.cpp
tests/PictureTest.cpp