From 2df64d04bee04b9a30d6d62582199cc9ec524632 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Wed, 7 Mar 2012 09:28:27 +1000 Subject: [PATCH] Change the default renderTarget and renderStrategy As we always use OpenGL and scenegraph render thread now, the best default render target should be FBO and the best render strategy should be cooperative mode (use the render thread). Task-number:QTBUG-23956 Change-Id: I64b070dec566e359d27c84680fef1c691d6ce411 Reviewed-by: Michael Brasser --- src/quick/items/context2d/qquickcanvasitem.cpp | 8 ++++---- tests/auto/quick/qquickcanvasitem/data/tst_arc.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml | 2 ++ tests/auto/quick/qquickcanvasitem/data/tst_composite.qml | 4 ++-- tests/auto/quick/qquickcanvasitem/data/tst_drawimage.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_line.qml | 4 ++-- tests/auto/quick/qquickcanvasitem/data/tst_path.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_state.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_text.qml | 2 +- tests/auto/quick/qquickcanvasitem/data/tst_transform.qml | 2 +- 17 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index ed16ea0..f89ac18 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -86,8 +86,8 @@ QQuickCanvasItemPrivate::QQuickCanvasItemPrivate() , hasCanvasWindow(false) , available(false) , contextInitialized(false) - , renderTarget(QQuickCanvasItem::Image) - , renderStrategy(QQuickCanvasItem::Threaded) + , renderTarget(QQuickCanvasItem::FramebufferObject) + , renderStrategy(QQuickCanvasItem::Cooperative) { } @@ -379,7 +379,7 @@ void QQuickCanvasItem::setCanvasWindow(const QRectF& rect) context will choose appropriate options and Canvas will signal the change to the properties. - The default render target is \c Canvas.Image. + The default render target is \c Canvas.FramebufferObject. */ QQuickCanvasItem::RenderTarget QQuickCanvasItem::renderTarget() const { @@ -419,7 +419,7 @@ void QQuickCanvasItem::setRenderTarget(QQuickCanvasItem::RenderTarget target) the GUI thread. Selecting \c Canvas.Cooperative, does not guarantee rendering will occur on a thread separate from the GUI thread. - The default value is \c Canvas.Threaded. + The default value is \c Canvas.Cooperative. \sa QtQuick2::Canvas::renderTarget */ diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml b/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml index 6006a5a..ffe6583 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml @@ -3,7 +3,7 @@ import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "arc"; when: windowShown function test_angle_1() { diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml b/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml index cc1d886..8609ad0 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml @@ -3,7 +3,7 @@ import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "arcTo"; when: windowShown function test_coincide() { diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml index 348a7b3..23d7b71 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml @@ -15,6 +15,8 @@ Rectangle { context.fillStyle = "red"; context.fillRect(0, 0, 100, 100); } + renderTarget:Canvas.Image + renderStrategy:Canvas.Threaded property int paintCount:spyPaint.count property int paintedCount:spyPainted.count property int canvasSizeChangedCount:spyCanvasSizeChanged.count diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml b/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml index 11e1dce..bdc9d37 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget:Canvas.Image + id:canvas; width:100;height:50; renderTarget:Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "composite"; when: windowShown function test_clearRect() { @@ -377,4 +377,4 @@ Canvas { } } -} \ No newline at end of file +} diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_drawimage.qml b/tests/auto/quick/qquickcanvasitem/data/tst_drawimage.qml index 102217d..75dd2b3 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_drawimage.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_drawimage.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded Component.onCompleted: { canvas.loadImage('green.png'); canvas.loadImage('red.png'); diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml b/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml index 8f5a78c..153a103 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml @@ -3,7 +3,7 @@ import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:1;height:1;renderTarget:Canvas.Image + id:canvas; width:1;height:1;renderTarget:Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "fillStyle"; when: windowShown function test_default() { diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml b/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml index d454c2e..10ee6a6 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "gradient"; when: windowShown function test_basic() { diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_line.qml b/tests/auto/quick/qquickcanvasitem/data/tst_line.qml index baf9987..f1c2820 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_line.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_line.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import"testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50;renderTarget: Canvas.Image + id:canvas; width:100;height:50;renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "line"; when: windowShown function test_default() { @@ -828,4 +828,4 @@ Canvas { } } -} \ No newline at end of file +} diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_path.qml b/tests/auto/quick/qquickcanvasitem/data/tst_path.qml index b04ccf5..6aaecbd 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_path.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_path.qml @@ -3,7 +3,7 @@ import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "path"; when: windowShown diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml b/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml index dd5b662..29c8bc9 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { //TODO name: "pattern"; when: windowShown diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml index 1a3793d..8fd390a 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { //TODO name: "pixel"; when: windowShown diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml b/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml index 4405ca6..bcb602a 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { //TODO diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_state.qml b/tests/auto/quick/qquickcanvasitem/data/tst_state.qml index 8042cf6..def312d 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_state.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_state.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { id:testCase name: "state"; when: windowShown diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml b/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml index 6b42f8a..2521643 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml @@ -3,7 +3,7 @@ import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget:Canvas.Image + id:canvas; width:100;height:50; renderTarget:Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "strokeStyle"; when: windowShown function test_default() { diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_text.qml b/tests/auto/quick/qquickcanvasitem/data/tst_text.qml index baeb17c..11618e9 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_text.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_text.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { //TODO name: "text"; when: windowShown diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml b/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml index 834a22f..b8505c6 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import "testhelper.js" as Helper Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image + id:canvas; width:100;height:50; renderTarget: Canvas.Image; renderStrategy:Canvas.Threaded TestCase { name: "transform"; when: windowShown function test_order() { -- 2.7.4