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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-expected.html

Issue 2294383002: Make OffscreenCanvas a member of CanvasImageSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <style type="text/css"> 3 <style type="text/css">
4 video { 4 video {
5 display: none; 5 display: none;
6 } 6 }
7 </style> 7 </style>
8 </head> 8 </head>
9 <body> 9 <body>
10 <video id="video" width="30" height="30"> 10 <video id="video" width="30" height="30">
11 <source src="resources/canvas_video.webm" type="video/webm" /> 11 <source src="resources/canvas_video.webm" type="video/webm" />
12 </video> 12 </video>
13 <canvas id="videoOutput" width="150" height="150"></canvas> 13 <canvas id="videoOutput" width="150" height="150"></canvas>
14 <canvas id="imageOutput" width="150" height="150"></canvas> 14 <canvas id="imageOutput" width="150" height="150"></canvas>
15 <canvas id="canvasOutput" width="150" height="150"></canvas> 15 <canvas id="canvasOutput" width="150" height="150"></canvas>
16 <canvas id="offscreenCanvas2DOutput" width="150" height="150"></canvas>
17 <canvas id="offscreenCanvasWebGLOutput" width="150" height="150"></canvas>
16 18
17 <script> 19 <script>
18 function drawImageSourceToHTMLCanvas(imageSource, outputCanvas) { 20 function drawImageSourceToHTMLCanvas(imageSource, outputCanvas) {
19 var ctx = outputCanvas.getContext('2d'); 21 var ctx = outputCanvas.getContext('2d');
20 22
21 ctx.drawImage(imageSource, 0, 0); 23 ctx.drawImage(imageSource, 0, 0);
22 ctx.drawImage(imageSource, 30, 30, 30, 30); 24 ctx.drawImage(imageSource, 30, 30, 30, 30);
23 // stretch the image 25 // stretch the image
24 ctx.drawImage(imageSource, 8, 8, 15, 15, 60, 60, 60, 60); 26 ctx.drawImage(imageSource, 8, 8, 15, 15, 60, 60, 60, 60);
25 // reduce the image 27 // reduce the image
(...skipping 22 matching lines...) Expand all
48 var htmlCanvas = document.createElement('canvas'); 50 var htmlCanvas = document.createElement('canvas');
49 htmlCanvas.width = 30; 51 htmlCanvas.width = 30;
50 htmlCanvas.height = 30; 52 htmlCanvas.height = 30;
51 var htmlCanvasCtx = htmlCanvas.getContext("2d"); 53 var htmlCanvasCtx = htmlCanvas.getContext("2d");
52 htmlCanvasCtx.fillStyle = "blue"; 54 htmlCanvasCtx.fillStyle = "blue";
53 htmlCanvasCtx.fillRect(0, 0, 15, 30); 55 htmlCanvasCtx.fillRect(0, 0, 15, 30);
54 htmlCanvasCtx.fillStyle = "red"; 56 htmlCanvasCtx.fillStyle = "red";
55 htmlCanvasCtx.fillRect(15, 0, 30, 30); 57 htmlCanvasCtx.fillRect(15, 0, 30, 30);
56 drawImageSourceToHTMLCanvas(htmlCanvas, document.getElementById('canvasOutput')) ; 58 drawImageSourceToHTMLCanvas(htmlCanvas, document.getElementById('canvasOutput')) ;
57 59
60 // Assume html and offscreen canvases should yield identical results
61 drawImageSourceToHTMLCanvas(htmlCanvas, document.getElementById('offscreenCanvas 2DOutput'));
62
63 // Image source as OffscreenCanvas with webGL context
64 var glCanvas = document.createElement('canvas');
65 glCanvas.width = glCanvas.height = 30;
66 var gl = glCanvas.getContext("webgl");
67 gl.clearColor(0.0, 0.0, 1.0, 1.0);
68 gl.clear(gl.COLOR_BUFFER_BIT);
69 drawImageSourceToHTMLCanvas(glCanvas, document.getElementById('offscreenCanvasWe bGLOutput'));
70
58 </script> 71 </script>
59 </body> 72 </body>
60 73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698