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

Side by Side 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: Add more detailed comments including why two videos are needed. 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <title>Ensure correct behavior of drawImage video elements on both software ca nvas and accelerated canvas. crbug.com/424591</title>
4 <!--
5 This test is made to check a video bug rather than a canvas bug. When we use both sw
6 canvas and hw canvas, the video bug appears.
7 The video impl has its own cache mechanism to cache SkBitmap after convertin g
8 video frame to SkBitmap.
9 When hw canvas draws video, video caches SkBitmap backed on GrTexture. When sw
10 canvas draws video, video caches SkBitmap backed on system memory.
11 The problem appears when we draws the video on both hw canvas and sw canvas.
12 When hw canvas draws, the video caches GrTexture based SkBitmap. and then wh en
13 sw canvas draws, the video draws GrTexture based SkBitmap on sw canvas.
14 Otherwise, if sw canvas draws prior, the video draws system memory SkBitmap on
15 hw canvas.
16 -->
17 <style trpe="text/css">
18 video {
19 display: none;
20 }
21 </style>
22 </head>
23 <body>
24 <canvas id="hw-canvas" width=300 height=300></canvas>
25 <canvas id="sw-canvas" width=150 height=150></canvas>
26 <video id="video" loop>
27 <source src="resources/canvas_video.mp4" type='video/mp4' />
28 <source src="resources/canvas_video.webm" type='video/webm' />
29 <source src="resources/canvas_video.ogv" type='video/ogg' />
30 </video>
31 <script>
32 if (window.testRunner) {
33 testRunner.dumpAsTextWithPixelResults();
34 testRunner.waitUntilDone();
35 }
36 if (window.internals)
37 window.internals.settings.setMinimumAccelerated2dCanvasSize(257*256);
38
39 var hw_canvas = document.getElementById("hw-canvas");
40 var hw_ctx = hw_canvas.getContext("2d");
41 // Although enabling accelerated-2d-canvas, canvas with the dimension
42 // less than 257*256 is not accelerated.
43 var sw_canvas = document.getElementById("sw-canvas");
44 var sw_ctx = sw_canvas.getContext("2d");
45
46 var video = document.getElementById("video");
47 video.addEventListener("playing", drawImageToCanvas, true);
48 video.play();
49
50 function drawVideo(ctx, canvas) {
51 ctx.globalAlpha = 1;
52 ctx.fillStyle = "blue";
53 ctx.fillRect(0, 0, canvas.width, canvas.width);
54 ctx.drawImage(video, 0, 0);
55 ctx.globalAlpha = 0.5;
56 ctx.drawImage(video, 0, 60);
57 }
58
59 function drawImageToCanvas() {
60 video.removeEventListener("playing", drawImageToCanvas, true);
61 for (i = 0; i < 10; i++) {
62 drawVideo(sw_ctx, sw_canvas);
63 drawVideo(hw_ctx, hw_canvas);
64 }
65 if (window.testRunner)
66 testRunner.notifyDone();
67 }
68 </script>
69 </body>
70 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/yuv-video-on-accelerated-canvas-expected.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698