Commit 604a9c1f authored by fmalita's avatar fmalita Committed by Commit bot

Advance image animations when drawing as shaders

Currently, we refresh image animations from their draw() impl.

But the rounded-rect fast path introduced in http://crrev.com/1949253004
draws images via shaders, so it may never call Image::draw() to advance
animations.

Update applyShader() to refresh the animations explicitly, similar to
the draw() case.

BUG=644112

Review-Url: https://codereview.chromium.org/2340683002
Cr-Commit-Position: refs/heads/master@{#418544}
parent 8e13fba3
<html>
<head>
<style type="text/css" media="screen">
div {
border-radius: 1px;
background-color: #009900;
height: 200px;
width: 200px;
}
</style>
</head>
<body>
<p>Div background should animate between red and green. DRT should snapshot when it is green.</p>
<div></div>
</body>
</html>
<html>
<head>
<style type="text/css" media="screen">
div {
border-radius: 1px;
background-size: 200px 200px;
background-image: url('resources/red-green-animated.gif');
height: 200px;
width: 200px;
}
</style>
<script type="text/javascript" charset="utf-8">
if (window.testRunner)
testRunner.waitUntilDone();
function pageLoaded()
{
testRunner.layoutAndPaintAsyncThen(function () {
window.setTimeout(function() {
if (window.testRunner)
testRunner.notifyDone();
}, 200); // Red frame of GIF has 100ms duration
});
}
window.addEventListener('load', pageLoaded, false);
</script>
</script>
</head>
<body>
<p>Div background should animate between red and green. DRT should snapshot when it is green.</p>
<div></div>
</body>
</html>
......@@ -273,6 +273,9 @@ bool Image::applyShader(SkPaint& paint, const SkMatrix& localMatrix)
paint.setShader(
image->makeShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &localMatrix));
// Animation is normally refreshed in draw() impls, which we don't call when painting via shaders.
startAnimation();
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment