1.1 --- a/TestsTab.qml Mon Jun 02 21:56:03 2014 +0200
1.2 +++ b/TestsTab.qml Tue Jun 03 16:11:47 2014 +0200
1.3 @@ -37,7 +37,8 @@
1.4 //! [screen-properties]
1.5 width: rectangleScreen.width
1.6 height: rectangleScreen.height
1.7 - property int frameCounter:0;
1.8 + //property int frameCounter:0;
1.9 + property int firstFrame:-1;
1.10 property var startTime:new Date();
1.11
1.12 Rectangle {
1.13 @@ -111,76 +112,87 @@
1.14 antialiasing: false
1.15 }
1.16
1.17 + //onA: {}
1.18 +
1.19 }
1.20
1.21
1.22 + function doFrame(frameCount)
1.23 + {
1.24 + var current = new Date();
1.25 + var milliseconds = (current.getTime() - startTime.getTime());
1.26
1.27 + if (firstFrame==-1)
1.28 + {
1.29 + firstFrame=frameCount
1.30 + }
1.31 +
1.32 +
1.33 + var frameCounter=frameCount-firstFrame;
1.34 + labelFrameCount.text=frameCounter;
1.35 + labelTime.text=milliseconds/1000;
1.36 + labelTimePerFrame.text=(milliseconds/frameCounter).toFixed(3);
1.37 + labelFps.text=(1000/(milliseconds/frameCounter)).toFixed(0);
1.38 +
1.39 + if (checkBoxDoClear.checked)
1.40 + {
1.41 + display.clear();
1.42 + }
1.43 +
1.44 + if (checkBoxRenderToDisplay.checked)
1.45 + {
1.46 + if (checkBoxFillAndClearOnly.checked)
1.47 + {
1.48 + //Trying to make it a worse case scenario for our frame diff algo
1.49 + if (doFill)
1.50 + {
1.51 + display.fill();
1.52 + }
1.53 + else
1.54 + {
1.55 + display.clear();
1.56 + }
1.57 +
1.58 + if (frameCounter%2)
1.59 + {
1.60 + doFill=!doFill;
1.61 + }
1.62 + }
1.63 + else if (checkBoxOnePixelOnly.checked)
1.64 + {
1.65 + display.setPixel(0,0,frameCounter%2);
1.66 + }
1.67 + else
1.68 + {
1.69 + display.renderWindow(frameWindow);
1.70 + }
1.71 +
1.72 + if (!checkBoxNoSwapBuffers.checked)
1.73 + {
1.74 + display.swapBuffers();
1.75 + }
1.76 +
1.77 + }
1.78 + }
1.79
1.80
1.81 //! [timer]
1.82 Timer {
1.83 id: timer
1.84 - interval: frameWindow.timeoutInterval; running: true; repeat: true
1.85 + interval: frameWindow.timeoutInterval; running: false; repeat: true
1.86 property bool doFill: true
1.87 onTriggered: {
1.88 //visible = false
1.89 -
1.90 - var current = new Date();
1.91 - var milliseconds = (current.getTime() - frameWindow.startTime.getTime());
1.92 -
1.93 - frameWindow.frameCounter++;
1.94 - labelFrameCount.text=frameWindow.frameCounter;
1.95 - labelTime.text=milliseconds/1000;
1.96 - labelTimePerFrame.text=(milliseconds/frameWindow.frameCounter).toFixed(3);
1.97 - labelFps.text=(1000/(milliseconds/frameWindow.frameCounter)).toFixed(0);
1.98 -
1.99 - if (checkBoxDoClear.checked)
1.100 - {
1.101 - display.clear();
1.102 - }
1.103 -
1.104 - if (checkBoxRenderToDisplay.checked)
1.105 - {
1.106 - if (checkBoxFillAndClearOnly.checked)
1.107 - {
1.108 - //Trying to make it a worse case scenario for our frame diff algo
1.109 - if (doFill)
1.110 - {
1.111 - display.fill();
1.112 - }
1.113 - else
1.114 - {
1.115 - display.clear();
1.116 - }
1.117 -
1.118 - if (frameWindow.frameCounter%2)
1.119 - {
1.120 - doFill=!doFill;
1.121 - }
1.122 - }
1.123 - else if (checkBoxOnePixelOnly.checked)
1.124 - {
1.125 - display.setPixel(0,0,frameWindow.frameCounter%2);
1.126 - }
1.127 - else
1.128 - {
1.129 - display.renderWindow(frameWindow);
1.130 - }
1.131 -
1.132 - if (!checkBoxNoSwapBuffers.checked)
1.133 - {
1.134 - display.swapBuffers();
1.135 - }
1.136 -
1.137 - }
1.138 + //frameWindow.doFrame();
1.139
1.140 //Signal our timeout
1.141 - frameWindow.timeout();
1.142 + //frameWindow.timeout();
1.143 }
1.144 }
1.145 //! [timer]
1.146 Component.onCompleted: {
1.147 - visible = true
1.148 + visible = true;
1.149 + display.connectWindow(frameWindow,doFrame);
1.150 }
1.151
1.152 }
1.153 @@ -202,7 +214,8 @@
1.154 text: qsTr("Reset stats")
1.155 onClicked: {
1.156 frameWindow.startTime = new Date();
1.157 - frameWindow.frameCounter = 0;
1.158 + //frameWindow.frameCounter = 0;
1.159 + frameWindow.firstFrame = -1;
1.160 }
1.161 }
1.162