Dont call updatePolish if an item is not visible
[ChangeLog][QtQuick][QQuickItem] "updatePolish" is not called for invisible items any more. Task-number: QTBUG-31830 Change-Id: Idad6107afaf0c6e6c96d9404ac286695c21883c7 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
parent
a9bef84675
commit
439f31f128
|
@ -257,8 +257,10 @@ void QQuickWindowPrivate::polishItems()
|
|||
|
||||
for (QSet<QQuickItem *>::iterator it = itms.begin(); it != itms.end(); ++it) {
|
||||
QQuickItem *item = *it;
|
||||
QQuickItemPrivate::get(item)->polishScheduled = false;
|
||||
item->updatePolish();
|
||||
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
|
||||
itemPrivate->polishScheduled = false;
|
||||
if (item->isVisible() || (itemPrivate->extra.isAllocated() && itemPrivate->extra->effectRefCount>0))
|
||||
item->updatePolish();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import QtQuick 2.0
|
||||
import QtTest 1.0
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
TestCase {
|
||||
id:testCase
|
||||
|
@ -10,10 +11,16 @@ TestCase {
|
|||
function cleanupTestCase() {
|
||||
wait(100) //wait for a short while to make sure no leaked textures
|
||||
}
|
||||
Window {
|
||||
id: win
|
||||
visible: true
|
||||
}
|
||||
|
||||
function testData(type) {
|
||||
if (type === "2d")
|
||||
return [
|
||||
{ tag:"image threaded", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}},
|
||||
{ tag:"image canvas invisible", properties:{visible: false, width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}},
|
||||
// { tag:"image cooperative", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Cooperative}},
|
||||
{ tag:"image immediate", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Immediate}},
|
||||
// { tag:"fbo cooperative", properties:{width:100, height:100, renderTarget:Canvas.FramebufferObject, renderStrategy:Canvas.Cooperative}},
|
||||
|
@ -24,7 +31,7 @@ TestCase {
|
|||
}
|
||||
|
||||
function createCanvasObject(data) {
|
||||
return component.createObject(testCase, data.properties);
|
||||
return component.createObject(win, data.properties);
|
||||
}
|
||||
|
||||
function comparePixel(ctx,x,y,r,g,b,a, d)
|
||||
|
|
|
@ -180,11 +180,20 @@ CanvasTestCase {
|
|||
tryCompare(c, "availableChangedCount", 1);
|
||||
//scene graph could be available immediately
|
||||
//in this case, we force waiting a short while until the init paint finished
|
||||
tryCompare(c, "paintedCount", 1);
|
||||
if (c.visible) {
|
||||
tryCompare(c, "paintedCount", 1);
|
||||
} else {
|
||||
tryCompare(c, "paintedCount", 0);
|
||||
}
|
||||
ctx.fillRect(0, 0, c.width, c.height);
|
||||
c.toDataURL();
|
||||
tryCompare(c, "paintedCount", 2);
|
||||
tryCompare(c, "paintCount", 1);
|
||||
if (c.visible) {
|
||||
tryCompare(c, "paintCount", 1);
|
||||
tryCompare(c, "paintedCount", 2);
|
||||
} else {
|
||||
tryCompare(c, "paintCount", 0);
|
||||
tryCompare(c, "paintedCount", 1);
|
||||
}
|
||||
c.destroy();
|
||||
}
|
||||
function test_loadImage(row) {
|
||||
|
|
Loading…
Reference in New Issue