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
2 files changed