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

Side by Side Diff: third_party/webgl/conformance-suites/1.0.0/extra/canvas-compositing-test.html

Issue 9360034: Remove everthing except conformance tests in the deps/third_party/webgl (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 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
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 <title>Canvas Compositing Test</title>
30 <link rel="stylesheet" href="../resources/js-test-style.css"/>
31 <script src="../resources/js-test-pre.js"></script>
32 <script src="../conformance/resources/webgl-test.js"> </script>
33 </head>
34 <body>
35 Below are 2 50x50 pixel canvas but using CSS to display them at 100x100 pixels. <br/>
36 They are solid black with a red triangle<br/>
37 They each have a 10px CSS solid black border around them.<br/>
38 Depending on how the browser composites the canvas with the page they will get
39 a white outline<hr/>
40 <div>
41 2d canvas<br/>
42 <canvas id="example2" width="50" height="50" style="width: 100px; height: 100px; border: 10px solid black;"></canvas>
43 </div>
44 <hr/>
45 3d canvas<br/>
46 <div>
47 <canvas id="example" width="50" height="50" style="width: 100px; height: 100px; border: 10px solid black;"></canvas>
48 </div>
49 <hr/>
50 img tag<br/>
51 <img src="50x50pixel-black-with-red-triangle.png" style="width: 100px; height: 1 00px; border: 10px solid black;"/>
52 <div id="description"></div>
53 <div id="console"></div>
54 <script id="vshader" type="x-shader/x-vertex">
55 attribute vec4 vPosition;
56 void main()
57 {
58 gl_Position = vPosition;
59 }
60 </script>
61
62 <script id="fshader" type="x-shader/x-fragment">
63 void main()
64 {
65 gl_FragColor = vec4(1.0,0.0,0.0,1.0);
66 }
67 </script>
68
69 <script>
70 function fail(x,y, buf, shouldBe)
71 {
72 var i = (y*50+x) * 4;
73 var reason = "pixel at ("+x+","+y+") is ("+buf[i]+","+buf[i+1]+","+b uf[i+2]+","+buf[i+3]+"), should be "+shouldBe;
74 testFailed(reason);
75 }
76
77 function pass()
78 {
79 testPassed("drawing is correct");
80 }
81
82 function init()
83 {
84 var canvas2d = document.getElementById("example2");
85 var ctx2d = canvas2d.getContext("2d");
86 ctx2d.fillStyle = "rgba(0, 0, 0, 255)"
87 ctx2d.fillRect(0, 0, 50, 50);
88 ctx2d.fillStyle = "rgba(255, 0, 0, 255)"
89 ctx2d.beginPath();
90 ctx2d.moveTo(25, 12.5);
91 ctx2d.lineTo(12.5, 37.5);
92 ctx2d.lineTo(37.5, 37.5);
93 ctx2d.lineTo(25, 12.5);
94 ctx2d.fill();
95
96
97 if (window.initNonKhronosFramework) {
98 window.initNonKhronosFramework(false);
99 }
100
101 gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
102 gl.viewport(0, 0, 50, 50);
103
104 var vertexObject = gl.createBuffer();
105 gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
106 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5 ,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
107 gl.enableVertexAttribArray(0);
108 gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
109
110 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
111 gl.drawArrays(gl.TRIANGLES, 0, 3);
112 }
113
114 init();
115 successfullyParsed = true;
116 </script>
117 </body>
118 <script src="../resources/js-test-post.js"></script>
119
120 <script>
121 </script>
122
123 </body>
124 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698