1 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintAndPixelTest()">
2 <script xlink:href="../../../fast/repaint/resources/text-based-repaint.js"></script>
3 <script type="text/javascript">
4 window.testIsAsync = true;
5 window.outputRepaintRects = false;
6 var start = new Date();
8 <text x="10" y="15" font-weight="900" font-size="5">SVG Performance test.</text>
9 <text x="10" y="95" font-weight="900" font-size="5">Test not started.</text>
10 <rect x="0" y="0" height="100" width="100" stroke="black" fill="none"/>
11 <script type="text/javascript"><![CDATA[
12 var svg = document.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'svg')[0];
13 var t = document.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'text')[1];
15 var Xs = new Array(9, 65, 92, 30, 92, 40, 65, 47, 79, 10, 77, 45,
16 27, 13, 43, 52, 55, 46, 1, 24, 42, 11, 15, 18, 42, 49, 50, 30, 69,
17 95, 36, 49, 46, 85, 54, 26, 15, 56, 18, 92, 40, 41, 66, 85, 7, 47,
18 66, 13, 72, 29, 48, 57, 61, 46, 70, 3, 62, 34, 74, 13, 32, 20, 8,
19 2, 60, 97, 58, 1, 0, 89, 85, 48, 52, 98, 12, 26, 5, 5, 48, 19, 22,
20 34, 83, 13, 65, 77, 23, 40, 56, 65, 13, 54, 81, 10, 53, 25, 93,
23 var Ys = new Array(42, 80, 93, 30, 54, 33, 76, 56, 2, 79, 37, 80,
24 80, 19, 99, 31, 89, 22, 23, 42, 27, 81, 26, 19, 80, 6, 62, 67, 73,
25 18, 69, 10, 42, 88, 100, 99, 47, 88, 26, 46, 49, 60, 7, 10, 48, 29,
26 25, 26, 33, 73, 84, 24, 42, 74, 5, 49, 69, 81, 19.5, 67, 10, 53, 79,
27 56, 32, 98, 78, 7, 3, 68, 12, 80, 42, 24, 82, 69, 9, 43, 47, 19,
28 69, 45, 41, 64, 1, 39, 25, 84, 35, 77, 26, 43, 32, 75, 89, 66, 48,
31 var Ss = new Array(5, 3, 1, 3, 1, 8, 8, 7, 8, 5, 1, 4, 4, 2, 1, 2,
32 2, 6, 4, 3, 1, 5, 1, 2, 6, 1, 5, 7, 3, 6, 6, 4, 7, 2, 5, 3, 5, 3,
33 5, 2, 8, 1, 2, 1, 6, 4, 3, 2, 4, 8, 3, 5, 8, 8, 2, 2, 2, 8, 5, 6,
34 4, 8, 5, 3, 6, 2, 3, 2, 3, 6, 3, 5, 8, 7, 2, 4, 8, 8, 6, 4, 6, 1,
35 8, 6, 7, 4, 7, 8, 3, 7, 7, 8, 4, 2, 2, 8, 2, 8, 7, 3);
37 var Rs = new Array(157, 142, 37, 13, 349, 83, 158, 214, 34, 353,
38 196, 29, 296, 225, 124, 355, 68, 305, 315, 190, 146, 274, 167,
39 132, 298, 272, 266, 265, 28, 213, 99, 260, 323, 233, 111, 270,
40 165, 177, 58, 350, 322, 137, 163, 80, 206, 138, 20, 355, 32, 310,
41 309, 260, 153, 309, 151, 189, 52, 170, 326, 157, 65, 41, 28, 92,
42 96, 196, 250, 313, 125, 226, 63, 245, 158, 196, 7, 169, 96, 224,
43 222, 273, 37, 26, 331, 302, 57, 55, 171, 347, 319, 54, 83, 189,
44 281, 79, 75, 138, 223, 138, 238, 69);
48 var maxPerBlock = Xs.length / (idealTime / delay);
49 var maxBlocks = Xs.length / maxPerBlock;
51 function repaintTest() {
52 for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
53 var index = count * maxPerBlock + subcount;
54 var newI = document.createElementNS('http://www.w3.org/2000/svg', 'image');
55 newI.setAttribute('x', Xs[index] - (99 / Ss[index]) / 2);
56 newI.setAttribute('y', Ys[index] - (195 / Ss[index]) / 2);
57 newI.setAttribute('height', 195 / Ss[index]);
58 newI.setAttribute('width', 99 / Ss[index]);
59 newI.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'resources/smallcats.gif');
60 newI.setAttribute('transform', 'translate(50, 50) rotate(' + Rs[index] + ') translate(-50, -50)');
61 newI.appendChild(document.createTextNode(index)); // 'TEST'));
62 svg.insertBefore(newI, t);
65 if (count < maxBlocks) {
66 window.setTimeout(repaintTest, delay);
67 t.firstChild.data = 'Test in progress... ' + count + ' of ' + maxBlocks;
69 if (window.testRunner)
70 t.firstChild.data = 'Test completed';
73 var elapsed = (end - start) / 1000;
74 t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
75 if (parent.reportResults) parent.reportResults(end - start);