# HG changeset patch # User sl # Date 1401371271 -7200 # Node ID 35f01a0d460a2a94f9a4204ebdd0c3320492dfdf # Parent 737f8bb110becfaf4cb7df692c911f42655d6b36 Adding set pixel method to our QML MiniDisplay. Adding more metrics and options to our test tab. diff -r 737f8bb110be -r 35f01a0d460a MiniDisplay/minidisplay.cpp --- a/MiniDisplay/minidisplay.cpp Thu May 29 14:27:08 2014 +0200 +++ b/MiniDisplay/minidisplay.cpp Thu May 29 15:47:51 2014 +0200 @@ -198,6 +198,22 @@ } /** + * @brief MiniDisplay::setPixel + * @param x + * @param y + * @param on + */ +void MiniDisplay::setPixel(int x, int y, bool on) +{ + if (!iDisplay.IsOpen()) + { + return; + } + + iDisplay.SetPixel(x,y,true); +} + +/** * @brief MiniDisplay::vendor * @return */ diff -r 737f8bb110be -r 35f01a0d460a MiniDisplay/minidisplay.h --- a/MiniDisplay/minidisplay.h Thu May 29 14:27:08 2014 +0200 +++ b/MiniDisplay/minidisplay.h Thu May 29 15:47:51 2014 +0200 @@ -36,6 +36,11 @@ Q_INVOKABLE void renderOwnWindow(); Q_INVOKABLE void renderWindow(QQuickWindow* aWindow); Q_INVOKABLE void renderImage(QImage* aImage); + // + Q_INVOKABLE void setPixel(int x, int y, bool on); + + + public: //Properties diff -r 737f8bb110be -r 35f01a0d460a TestsTab.qml --- a/TestsTab.qml Thu May 29 14:27:08 2014 +0200 +++ b/TestsTab.qml Thu May 29 15:47:51 2014 +0200 @@ -44,25 +44,56 @@ smooth: false } - ColumnLayout { + GridLayout { anchors.fill:parent anchors.margins: 6 - spacing: 4 + //spacing: 4 + columns: 4 + + Label { + text: "Frames:" + antialiasing: false + } + + Label { + text: "Time (s):" + antialiasing: false + } + + Label { + text: "Time/Frame (ms):" + antialiasing: false + } + + Label { + text: "FPS:" + antialiasing: false + } Label { id: labelFrameCount - //anchors.centerIn: parent text: "Frame Count" antialiasing: false } Label { id: labelTime - //anchors.centerIn: parent text: "Time" antialiasing: false } + Label { + id: labelTimePerFrame + text: "Time/Frame" + antialiasing: false + } + + Label { + id: labelFps + text: "FPS" + antialiasing: false + } + } @@ -71,19 +102,50 @@ //! [timer] Timer { + id: timer interval: splash.timeoutInterval; running: true; repeat: true onTriggered: { //visible = false var current = new Date(); - var seconds = (current.getTime() - splash.startTime.getTime())/1000; + var milliseconds = (current.getTime() - splash.startTime.getTime()); splash.frameCounter++; labelFrameCount.text=splash.frameCounter; - labelTime.text=seconds; - display.renderWindow(splash); - display.swapBuffers(); - splash.timeout() + labelTime.text=milliseconds/1000; + labelTimePerFrame.text=(milliseconds/splash.frameCounter).toFixed(3); + labelFps.text=(1000/(milliseconds/splash.frameCounter)).toFixed(0); + + if (checkBoxDoClear.checked) + { + display.clear(); + } + + if (checkBoxRenderToDisplay.checked) + { + if (checkBoxFillOnly.checked) + { + display.fill(); + } + else if (checkBoxOnePixelOnly.checked) + { + display.setPixel(0,0,true); + } + else + { + display.renderWindow(splash); + } + + if (!checkBoxNoSwapBuffers.checked) + { + display.swapBuffers(); + } + + } + + + + splash.timeout(); } } //! [timer] @@ -105,5 +167,51 @@ display.swapBuffers(); } } + + Button { + text: qsTr("Reset stats") + onClicked: { + splash.startTime = new Date(); + splash.frameCounter = 0; + } + } + + CheckBox { + text: qsTr("Run timer") + checked: true + onCheckedChanged: { + (checked?timer.start():timer.stop()) + } + } + + CheckBox { + id: checkBoxDoClear + text: qsTr("Do clear") + checked: true + } + + CheckBox { + id: checkBoxRenderToDisplay + text: qsTr("Render to display") + checked: true + } + + CheckBox { + id: checkBoxFillOnly + text: qsTr("Fill only") + checked: false + } + + CheckBox { + id: checkBoxNoSwapBuffers + text: qsTr("No swap buffers") + checked: false + } + + CheckBox { + id: checkBoxOnePixelOnly + text: qsTr("One pixel only") + checked: false + } } }