Chromium Code Reviews| Index: LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html |
| diff --git a/LayoutTests/fast/canvas/canvas-drawImage-video.html b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html |
| similarity index 53% |
| copy from LayoutTests/fast/canvas/canvas-drawImage-video.html |
| copy to LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html |
| index 1647594a6a2866d908b23973e6d663fc18979f90..bb0957320346aba990572af72d977791cf0c5904 100644 |
| --- a/LayoutTests/fast/canvas/canvas-drawImage-video.html |
| +++ b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html |
| @@ -1,6 +1,6 @@ |
| <html> |
| <head> |
| - <title>Ensure correct behavior of drawImage video elements.</title> |
| + <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; |
| @@ -8,7 +8,8 @@ |
| </style> |
| </head> |
| <body> |
| - <canvas id="canvas"></canvas> |
| + <canvas id="hw-canvas" width=300 height=300></canvas> |
|
Justin Novosad
2014/10/17 16:23:46
For layouts test it does not work like this for co
|
| + <canvas id="sw-canvas" width=150 height=150></canvas> |
| <video id="video" loop> |
| <source src="resources/canvas_video.mp4" type='video/mp4' /> |
| <source src="resources/canvas_video.webm" type='video/webm' /> |
| @@ -20,23 +21,32 @@ |
| testRunner.waitUntilDone(); |
| } |
| - var length = 150; |
| - var canvas = document.getElementById("canvas"); |
| - canvas.setAttribute("width", length); |
| - canvas.setAttribute("height", length); |
| - var ctx = canvas.getContext("2d"); |
| + 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. |
|
Justin Novosad
2014/10/17 16:23:46
Not true in layout tests
|
| + var sw_canvas = document.getElementById("sw-canvas"); |
| + var sw_ctx = sw_canvas.getContext("2d"); |
| var video = document.getElementById("video"); |
| video.addEventListener("playing", drawImageToCanvas, true); |
| video.play(); |
| - function drawImageToCanvas() { |
| - video.removeEventListener("playing", drawImageToCanvas, true); |
| + function drawVideo(ctx, canvas) { |
| + ctx.globalAlpha = 1; |
| ctx.fillStyle = "blue"; |
| - ctx.fillRect(0, 0, length, length); |
| + ctx.fillRect(0, 0, canvas.width, canvas.width); |
| ctx.drawImage(video, 0, 0); |
| ctx.globalAlpha = 0.5; |
| ctx.drawImage(video, 0, 60); |
| + } |
| + |
| + function drawImageToCanvas() { |
| + video.removeEventListener("playing", drawImageToCanvas, true); |
| + for (i = 0; i < 10; i++) { |
| + drawVideo(sw_ctx, sw_canvas); |
| + drawVideo(hw_ctx, hw_canvas); |
| + } |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |