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

Side by Side Diff: extra/canvas-compositing-test.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « extra/big-fbos-example.html ('k') | extra/canvas-compositing-test.png » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (C) 2009 Apple Computer, Inc. All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
7 1. Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 2. Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12
13 THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 -->
25
26 <!DOCTYPE html>
27 <html>
28 <head>
29 <meta charset="utf-8">
30 <title>Canvas Compositing Test</title>
31 <link rel="stylesheet" href="../resources/js-test-style.css"/>
32 <script src="../resources/js-test-pre.js"></script>
33 <script src="../conformance/resources/webgl-test.js"> </script>
34 </head>
35 <body>
36 Below are 2 50x50 pixel canvas but using CSS to display them at 100x100 pixels. <br/>
37 They are solid black with a red triangle<br/>
38 They each have a 10px CSS solid black border around them.<br/>
39 Depending on how the browser composites the canvas with the page they will get
40 a white outline<hr/>
41 <div>
42 2d canvas<br/>
43 <canvas id="example2" width="50" height="50" style="width: 100px; height: 100px; border: 10px solid black;"></canvas>
44 </div>
45 <hr/>
46 3d canvas<br/>
47 <div>
48 <canvas id="example" width="50" height="50" style="width: 100px; height: 100px; border: 10px solid black;"></canvas>
49 </div>
50 <hr/>
51 img tag<br/>
52 <img src="50x50pixel-black-with-red-triangle.png" style="width: 100px; height: 1 00px; border: 10px solid black;"/>
53 <div id="description"></div>
54 <div id="console"></div>
55 <script id="vshader" type="x-shader/x-vertex">
56 attribute vec4 vPosition;
57 void main()
58 {
59 gl_Position = vPosition;
60 }
61 </script>
62
63 <script id="fshader" type="x-shader/x-fragment">
64 void main()
65 {
66 gl_FragColor = vec4(1.0,0.0,0.0,1.0);
67 }
68 </script>
69
70 <script>
71 function fail(x,y, buf, shouldBe)
72 {
73 var i = (y*50+x) * 4;
74 var reason = "pixel at ("+x+","+y+") is ("+buf[i]+","+buf[i+1]+","+b uf[i+2]+","+buf[i+3]+"), should be "+shouldBe;
75 testFailed(reason);
76 }
77
78 function pass()
79 {
80 testPassed("drawing is correct");
81 }
82
83 function init()
84 {
85 var canvas2d = document.getElementById("example2");
86 var ctx2d = canvas2d.getContext("2d");
87 ctx2d.fillStyle = "rgba(0, 0, 0, 255)"
88 ctx2d.fillRect(0, 0, 50, 50);
89 ctx2d.fillStyle = "rgba(255, 0, 0, 255)"
90 ctx2d.beginPath();
91 ctx2d.moveTo(25, 12.5);
92 ctx2d.lineTo(12.5, 37.5);
93 ctx2d.lineTo(37.5, 37.5);
94 ctx2d.lineTo(25, 12.5);
95 ctx2d.fill();
96
97
98 if (window.initNonKhronosFramework) {
99 window.initNonKhronosFramework(false);
100 }
101
102 gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
103 gl.viewport(0, 0, 50, 50);
104
105 var vertexObject = gl.createBuffer();
106 gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
107 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5 ,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
108 gl.enableVertexAttribArray(0);
109 gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
110
111 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
112 gl.drawArrays(gl.TRIANGLES, 0, 3);
113 }
114
115 init();
116 successfullyParsed = true;
117 </script>
118 </body>
119 <script src="../resources/js-test-post.js"></script>
120
121 <script>
122 </script>
123
124 </body>
125 </html>
OLDNEW
« no previous file with comments | « extra/big-fbos-example.html ('k') | extra/canvas-compositing-test.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698