| Index: LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html
|
| diff --git a/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7934f6e321599e92e75b5e0ea53d65e887d5d1b7
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html
|
| @@ -0,0 +1,70 @@
|
| +<html>
|
| +<head>
|
| + <title>Ensure correct behavior of drawImage video elements on both software canvas and accelerated canvas. crbug.com/424591</title>
|
| + <!--
|
| + This test is made to check a video bug rather than a canvas bug. When we use both sw
|
| + canvas and hw canvas, the video bug appears.
|
| + The video impl has its own cache mechanism to cache SkBitmap after converting
|
| + video frame to SkBitmap.
|
| + When hw canvas draws video, video caches SkBitmap backed on GrTexture. When sw
|
| + canvas draws video, video caches SkBitmap backed on system memory.
|
| + The problem appears when we draws the video on both hw canvas and sw canvas.
|
| + When hw canvas draws, the video caches GrTexture based SkBitmap. and then when
|
| + sw canvas draws, the video draws GrTexture based SkBitmap on sw canvas.
|
| + Otherwise, if sw canvas draws prior, the video draws system memory SkBitmap on
|
| + hw canvas.
|
| + -->
|
| + <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="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>
|
| + <script>
|
| + if (window.testRunner) {
|
| + testRunner.dumpAsTextWithPixelResults();
|
| + 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 video = document.getElementById("video");
|
| + video.addEventListener("playing", drawImageToCanvas, true);
|
| + video.play();
|
| +
|
| + function drawVideo(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() {
|
| + 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();
|
| + }
|
| + </script>
|
| +</body>
|
| +</html>
|
|
|