Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html

Issue 656683007: Add a layout test for potential bug on drawing video on SkCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use window.internals.settings.setMinimumAccelerated2dCanvasSize Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 50%
copy from LayoutTests/fast/canvas/canvas-drawImage-video.html
copy to LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas.html
index 1647594a6a2866d908b23973e6d663fc18979f90..eaba4d9e1347cd6e562e20e394fe3856d4643817 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>
+ <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' />
@@ -19,24 +20,35 @@
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
}
+ if (window.internals)
+ window.internals.settings.setMinimumAccelerated2dCanvasSize(257*256);
dshwang 2014/10/20 20:30:00 this line is added.
- 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.
+ 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();
}

Powered by Google App Engine
This is Rietveld 408576698