Frame culling now done in QML rather than CPP.
2 import QtQuick.Controls 1.2
3 import QtQuick.Window 2.1
5 import QtQuick.Layouts 1.1
12 //SystemPalette { id: palette }
17 //This window is our VFD frame
23 //Splash screen type do not have any border which is what we want
24 flags: Qt.SplashScreen
26 //property int timeoutInterval: 41
28 property int timeoutInterval: 33
30 //! [splash-properties]
31 //! [screen-properties]
32 //Here comes some trick to keep our display frame within our app.
33 //This make sure this window follows our app window.
34 x: appWindow.x+appWindow.width-256-13
35 y: appWindow.y+appWindow.height-64-30
37 //! [screen-properties]
38 width: rectangleScreen.width
39 height: rectangleScreen.height
40 //property int frameCounter:0;
41 property int firstFrame:-1;
42 property var startTime:new Date();
46 anchors.centerIn: parent
58 anchors.verticalCenter: parent.verticalCenter
59 anchors.horizontalCenter: parent.horizontalCenter
60 text: "start ------ abcdefghijklmnopqrtaksdjfkdfjklsdjflksdjfklsjadfkljsad;flasjdlfjasdfjldsdfljf---- end"
61 //text: "start ------ end"
82 text: "Time/Frame (ms):"
104 id: labelTimePerFrame
120 function doFrame(frameCount)
127 var current = new Date();
128 var milliseconds = (current.getTime() - startTime.getTime());
132 firstFrame=frameCount
136 var frameCounter=frameCount-firstFrame;
137 labelFrameCount.text=frameCounter;
138 labelTime.text=milliseconds/1000;
139 labelTimePerFrame.text=(milliseconds/frameCounter).toFixed(3);
140 labelFps.text=(1000/(milliseconds/frameCounter)).toFixed(0);
142 if (checkBoxDoClear.checked)
147 if (checkBoxRenderToDisplay.checked)
149 if (checkBoxFillAndClearOnly.checked)
151 //Trying to make it a worse case scenario for our frame diff algo
166 else if (checkBoxOnePixelOnly.checked)
168 display.setPixel(0,0,frameCounter%2);
172 display.renderWindow(frameWindow);
175 if (!checkBoxNoSwapBuffers.checked)
177 display.swapBuffers();
187 interval: frameWindow.timeoutInterval; running: false; repeat: true
188 property bool doFill: true
191 //frameWindow.doFrame();
194 //frameWindow.timeout();
198 Component.onCompleted: {
200 display.connectWindow(frameWindow,doFrame);
211 text: qsTr("Render Window")
213 display.renderWindow(frameWindow);
214 display.swapBuffers();
219 text: qsTr("Reset stats")
221 frameWindow.startTime = new Date();
222 //frameWindow.frameCounter = 0;
223 frameWindow.firstFrame = -1;
228 text: qsTr("Run timer")
231 (checked?timer.start():timer.stop())
237 text: qsTr("Do clear")
242 id: checkBoxRenderToDisplay
243 text: qsTr("Render to display")
248 id: checkBoxFillAndClearOnly
249 text: qsTr("Only fill and clear")
254 id: checkBoxNoSwapBuffers
255 text: qsTr("No swap buffers")
260 id: checkBoxOnePixelOnly
261 text: qsTr("One pixel only")
266 text: qsTr("Off-Screen")
268 onCheckedChanged: {display.offScreenMode = checked;}
272 text: qsTr("Frame differencing")
274 onCheckedChanged: {display.frameDifferencing = checked;}
280 border.color: "black"
282 anchors.horizontalCenter: parent.horizontalCenter
284 height: text.height + 10
290 anchors.verticalCenter: parent.verticalCenter
291 anchors.horizontalCenter: parent.horizontalCenter
292 text: "start ------ abcdefghijklmnopqrtaksdjfkdfjklsdjflksdjfklsjadfkljsad;flasjdlfjasdfjldsdfljf---- end"
293 //text: "start ------ end"