| Index: LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html
|
| diff --git a/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ef1abd29a411546e7632a3564b65dc6fbe234ee1
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html
|
| @@ -0,0 +1,83 @@
|
| +<html>
|
| +<head>
|
| + <title>Ensure correct behavior of drawImage video elements on both software canvas and accelerated canvas. crbug.com/424591</title>
|
| + <style trpe="text/css">
|
| + video {
|
| + display: none;
|
| + }
|
| + </style>
|
| +</head>
|
| +<body>
|
| + <canvas id="hw-canvas" width=300 height=300></canvas>
|
| + <canvas id="sw-canvas" width=150 height=150></canvas>
|
| + <!--
|
| + If we creates two video elements for each canvas, each video caches sw bitmap or
|
| + hw bitmap respectively. So the -expected.html creates two videos.
|
| + -->
|
| + <video id="video-for-hw-canvas" loop>
|
| + <source src="resources/canvas_video.mp4" type='video/mp4' />
|
| + <source src="resources/canvas_video.webm" type='video/webm' />
|
| + <source src="resources/canvas_video.ogv" type='video/ogg' />
|
| + </video>
|
| + <video id="video-for-sw-canvas" loop>
|
| + <source src="resources/canvas_video.mp4" type='video/mp4' />
|
| + <source src="resources/canvas_video.webm" type='video/webm' />
|
| + <source src="resources/canvas_video.ogv" type='video/ogg' />
|
| + </video>
|
| + <script>
|
| + if (window.testRunner) {
|
| + testRunner.waitUntilDone();
|
| + }
|
| + if (window.internals)
|
| + window.internals.settings.setMinimumAccelerated2dCanvasSize(257*256);
|
| +
|
| + var hw_canvas = document.getElementById("hw-canvas");
|
| + var hw_ctx = hw_canvas.getContext("2d");
|
| + // Although enabling accelerated-2d-canvas, canvas with the dimension
|
| + // less than 257*256 is not accelerated.
|
| + var sw_canvas = document.getElementById("sw-canvas");
|
| + var sw_ctx = sw_canvas.getContext("2d");
|
| +
|
| + var blockUntilPlayingBothVideo = true;
|
| + var video_for_hw_canvas = document.getElementById("video-for-hw-canvas");
|
| + video_for_hw_canvas.addEventListener("playing", onHwVideoPlaying, true);
|
| + video_for_hw_canvas.play();
|
| + function onHwVideoPlaying() {
|
| + video_for_hw_canvas.removeEventListener("playing", onHwVideoPlaying, true);
|
| + if (blockUntilPlayingBothVideo) {
|
| + blockUntilPlayingBothVideo = false;
|
| + } else {
|
| + drawImageToCanvas();
|
| + }
|
| + }
|
| + var video_for_sw_canvas = document.getElementById("video-for-sw-canvas");
|
| + video_for_sw_canvas.addEventListener("playing", onSwVideoPlaying, true);
|
| + video_for_sw_canvas.play();
|
| + function onSwVideoPlaying() {
|
| + video_for_sw_canvas.removeEventListener("playing", onSwVideoPlaying, true);
|
| + if (blockUntilPlayingBothVideo) {
|
| + blockUntilPlayingBothVideo = false;
|
| + } else {
|
| + drawImageToCanvas();
|
| + }
|
| + }
|
| +
|
| + function drawVideo(video, ctx, canvas) {
|
| + ctx.globalAlpha = 1;
|
| + ctx.fillStyle = "blue";
|
| + ctx.fillRect(0, 0, canvas.width, canvas.width);
|
| + ctx.drawImage(video, 0, 0);
|
| + ctx.globalAlpha = 0.5;
|
| + ctx.drawImage(video, 0, 60);
|
| + }
|
| +
|
| + function drawImageToCanvas() {
|
| + // draw a different video on a different canvas.
|
| + drawVideo(video_for_sw_canvas, sw_ctx, sw_canvas);
|
| + drawVideo(video_for_hw_canvas, hw_ctx, hw_canvas);
|
| + if (window.testRunner)
|
| + testRunner.notifyDone();
|
| + }
|
| + </script>
|
| +</body>
|
| +</html>
|
|
|