Chromium Code Reviews| 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..24b9a5989ca08162792b3b29d03c6ead5272eaf7 |
| --- /dev/null |
| +++ b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html |
| @@ -0,0 +1,79 @@ |
| +<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> |
| + <video id="hw-video" 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="sw-video" loop> |
|
Justin Novosad
2014/10/20 20:39:02
What exactly makes this video sw and the other one
dshwang
2014/10/20 20:46:47
sw-canvas uses sw-video while hw-canvas uses hw-vi
Justin Novosad
2014/10/20 20:51:42
I don't understand what is the difference between
|
| + <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> |
|
Justin Novosad
2014/10/20 20:39:02
Inconsistent indentation
dshwang
2014/10/20 20:46:47
do you mean 4-space indentation?
Justin Novosad
2014/10/20 20:51:42
No. I mean <video> and the matching </video> are n
|
| + <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 hw_video = document.getElementById("hw-video"); |
| + hw_video.addEventListener("playing", onHwVideoPlaying, true); |
| + hw_video.play(); |
| + function onHwVideoPlaying() { |
| + hw_video.removeEventListener("playing", onHwVideoPlaying, true); |
| + if (blockUntilPlayingBothVideo) { |
| + blockUntilPlayingBothVideo = false; |
| + } else { |
| + drawImageToCanvas(); |
| + } |
| + } |
| + var sw_video = document.getElementById("sw-video"); |
| + sw_video.addEventListener("playing", onSwVideoPlaying, true); |
| + sw_video.play(); |
| + function onSwVideoPlaying() { |
| + sw_video.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(sw_video, sw_ctx, sw_canvas); |
| + drawVideo(hw_video, hw_ctx, hw_canvas); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + } |
| + </script> |
| +</body> |
| +</html> |