aboutsummaryrefslogtreecommitdiffstats
path: root/src/benchmarks/auto/canvas/canvas_text_simple.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/benchmarks/auto/canvas/canvas_text_simple.qml')
-rw-r--r--src/benchmarks/auto/canvas/canvas_text_simple.qml29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/benchmarks/auto/canvas/canvas_text_simple.qml b/src/benchmarks/auto/canvas/canvas_text_simple.qml
new file mode 100644
index 0000000..7668a42
--- /dev/null
+++ b/src/benchmarks/auto/canvas/canvas_text_simple.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+import QmlBench 1.0
+
+// Testing the performance of canvas-based text rendering
+Item {
+ id: root;
+ property int count: 100;
+ property int staticCount: 1000;
+
+ property real t;
+ NumberAnimation on t { from: 0; to: 1; duration: 2347; loops: Animation.Infinite }
+
+ Canvas {
+ anchors.fill: parent
+
+ property real t: root.t;
+ onTChanged: requestPaint();
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.clearRect(0, 0, width, height);
+ var str = "" + Math.floor( t * 1000 ) / 1000;
+
+ for (var i = 0; i < root.count; ++i) {
+ ctx.fillText(str, QmlBench.getRandom() * root.width, QmlBench.getRandom() * root.height);
+ }
+ }
+ }
+}