Debian Codegraph @

dojox/gfx/tests/performance/gfx_fill.html

raw symbols SCIP
1 <html>
2 <head>
3 <title>Testing Fill Performance</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <style type="text/css">
6 @import "../../../../dojo/resources/dojo.css";
7 @import "../../../../dijit/tests/css/dijitTests.css";
8 </style>
9 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
10 <script type="text/javascript" src="../../../../util/doh/runner.js"></script>
11 <script type="text/javascript">
12 dojo.require("doh.runner");
13 dojo.require("dojox.gfx");
14 dojo.require("dojo.colors");
15
16
17 var surface;
18 createSurface = function(){
19 surface = dojox.gfx.createSurface("test", 500, 500);
20 };
21
22 destroySurface = function(){
23 if(surface){
24 surface.destroy();
25 surface = null;
26 }
27 }
28 dojo.addOnLoad(function(){
29 doh.register("gfx.fill.performance", [
30 {
31 name: "Fill Concentric Circles",
32 testType: "perf",
33 trialDuration: 100,
34 trialDelay: 50,
35 trialIterations: 50,
36 setUp: function() {
37 createSurface();
38 },
39 tearDown: function(){
40 destroySurface();
41 },
42 runTest: function(){
43 surface.clear();
44 var path = surface.createPath("");
45 // form concentric circles
46 var center = {x: 250, y: 250};
47 for(var r = 200; r > 0; r -= 30){
48 // make two 180 degree arcs to form a circle
49 var start = {x: center.x, y: center.y - r};
50 var end = {x: center.x, y: center.y + r};
51 path.moveTo(start).arcTo(r, r, 0, true, true, end).arcTo(r, r, 0, true, true, start).closePath();
52 }
53 // set visual attributes
54 path.setFill("red").setStroke("black");
55 }
56 },
57 {
58 name: "Fill Square",
59 testType: "perf",
60 trialDuration: 100,
61 trialDelay: 50,
62 trialIterations: 50,
63 setUp: function() {
64 createSurface();
65 },
66 tearDown: function(){
67 destroySurface();
68 },
69 runTest: function(){
70 surface.clear();
71 surface.createRect({
72 width: 100,
73 height: 100,
74 x: 100,
75 y: 100
76 }).setFill("blue").setStroke("black");
77 }
78 },
79 {
80 name: "Fill Rectangle",
81 testType: "perf",
82 trialDuration: 100,
83 trialDelay: 50,
84 trialIterations: 50,
85 setUp: function() {
86 createSurface();
87 },
88 tearDown: function(){
89 destroySurface();
90 },
91 runTest: function(){
92 surface.clear();
93 var path = surface.createPath("");
94 surface.createRect({
95 width: 100,
96 height: 200,
97 x: 100,
98 y: 100
99 }).setFill("red").setStroke("black");
100 }
101 },
102 {
103 name: "Fill Circle",
104 testType: "perf",
105 trialDuration: 100,
106 trialDelay: 50,
107 trialIterations: 50,
108 setUp: function() {
109 createSurface();
110 },
111 tearDown: function(){
112 destroySurface();
113 },
114 runTest: function(){
115 surface.clear();
116 surface.createEllipse({
117 cx: 150,
118 cy: 150,
119 rx: 100,
120 ry: 100
121 }).setFill("green").setStroke("black");
122 }
123 },
124 {
125 name: "Fill Rectangle Linear Gradient",
126 testType: "perf",
127 trialDuration: 50,
128 trialDelay: 50,
129 trialIterations: 50,
130 setUp: function() {
131 createSurface();
132 },
133 tearDown: function(){
134 destroySurface();
135 },
136 runTest: function(){
137 surface.clear();
138 surface.createRect({
139 width: 100,
140 height: 75,
141 x: 100,
142 y: 100
143 }).setFill({
144 colors: [
145 { offset: 0, color: [255, 255, 0, 0] },
146 { offset: 0.5, color: "red" },
147 { offset: 1, color: [255, 255, 0, 0] }
148 ],
149 type: "linear",
150 x1: 0,
151 y1: 0,
152 x2: 200,
153 y2: 0
154 });
155 }
156 },
157 {
158 name: "Fill Circle Linear Gradient",
159 testType: "perf",
160 trialDuration: 50,
161 trialDelay: 50,
162 trialIterations: 50,
163 setUp: function() {
164 createSurface();
165 },
166 tearDown: function(){
167 destroySurface();
168 },
169 runTest: function(){
170 surface.clear();
171 surface.createEllipse({
172 cx: 150,
173 cy: 150,
174 rx: 100,
175 ry: 100
176 }).setFill({
177 colors: [
178 { offset: 0, color: [255, 255, 0, 0] },
179 { offset: 0.5, color: "red" },
180 { offset: 1, color: [255, 255, 0, 0] }
181 ],
182 type: "linear",
183 x1: 0,
184 y1: 0,
185 x2: 200,
186 y2: 0
187 }).setStroke("black");
188 }
189 }
190 ]);
191 doh.run();
192 });
193 </script>
194 </head>
195 <body>
196 <h1>Testing Fill Performance</h1>
197 <div id="test" style="width: 500px; height: 500px;"></div>
198 </body>
199 </html>