From: Aaron Kennedy Date: Thu, 9 Jun 2011 05:31:31 +0000 (+1000) Subject: Merge branch 'master' into qtquick2 X-Git-Tag: qt-v5.0.0-alpha1~2170^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d16155bb8fef642ce6bb5cab7cb26b1289a1e6b;p=profile%2Fivi%2Fqtdeclarative.git Merge branch 'master' into qtquick2 Conflicts: src/declarative/items/qsgcanvas.cpp src/declarative/items/qsgcanvasitem.cpp --- 2d16155bb8fef642ce6bb5cab7cb26b1289a1e6b diff --cc src/declarative/items/qsgcanvas.cpp index 8caf185,240088c..dce5fe0 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@@ -222,31 -248,25 +248,27 @@@ void QSGCanvas::showEvent(QShowEvent *e QGLWidget::showEvent(e); - if (d->threadedRendering) { - if (!d->animationDriver) { - d->animationDriver = d->context->createAnimationDriver(this); - connect(d->animationDriver, SIGNAL(started()), d->thread, SLOT(animationStarted()), Qt::DirectConnection); - connect(d->animationDriver, SIGNAL(stopped()), d->thread, SLOT(animationStopped()), Qt::DirectConnection); - } - d->animationDriver->install(); - d->thread->startRenderThread(); - setUpdatesEnabled(true); - } else { - makeCurrent(); + if (!d->contextFailed) { + if (d->threadedRendering) { - d->contextInThread = true; - doneCurrent(); + if (!d->animationDriver) { + d->animationDriver = d->context->createAnimationDriver(this); - connect(d->animationDriver, SIGNAL(started()), this, SLOT(_q_animationStarted()), Qt::DirectConnection); - connect(d->animationDriver, SIGNAL(stopped()), this, SLOT(_q_animationStopped()), Qt::DirectConnection); ++ connect(d->animationDriver, SIGNAL(started()), d->thread, SLOT(animationStarted()), Qt::DirectConnection); ++ connect(d->animationDriver, SIGNAL(stopped()), d->thread, SLOT(animationStopped()), Qt::DirectConnection); + } + d->animationDriver->install(); - d->mutex.lock(); - d->thread->start(); - d->wait.wait(&d->mutex); - d->mutex.unlock(); ++ d->thread->startRenderThread(); ++ setUpdatesEnabled(true); + } else { + makeCurrent(); + + if (!d->context || !d->context->isReady()) { + d->initializeSceneGraph(); + d->animationDriver = d->context->createAnimationDriver(this); + connect(d->animationDriver, SIGNAL(started()), this, SLOT(update())); + } - if (!d->context || !d->context->isReady()) { - d->initializeSceneGraph(); - d->animationDriver = d->context->createAnimationDriver(this); - connect(d->animationDriver, SIGNAL(started()), this, SLOT(update())); + d->animationDriver->install(); } - - d->animationDriver->install(); } } @@@ -254,12 -274,11 +276,13 @@@ void QSGCanvas::hideEvent(QHideEvent *e { Q_D(QSGCanvas); - if (d->threadedRendering) { - d->thread->stopRenderThread(); - } + if (!d->contextFailed) { - if (d->threadedRendering) - d->stopRenderingThread(); ++ if (d->threadedRendering) { ++ d->thread->stopRenderThread(); ++ } - d->animationDriver->uninstall(); + d->animationDriver->uninstall(); + } QGLWidget::hideEvent(e); } @@@ -464,16 -374,10 +378,11 @@@ QSGCanvasPrivate::QSGCanvasPrivate( , hoverItem(0) , dirtyItemList(0) , context(0) + , contextFailed(false) - , contextInThread(false) , threadedRendering(false) - , exitThread(false) , animationRunning(false) - , idle(false) - , needsRepaint(true) , renderThreadAwakened(false) - , inSync(false) - , thread(new MyThread(this)) + , thread(0) , animationDriver(0) { threadedRendering = !qmlNoThreadedRenderer(); diff --cc src/declarative/items/qsgcanvas_p.h index 9d37391,9ea11f5..87fae1c --- a/src/declarative/items/qsgcanvas_p.h +++ b/src/declarative/items/qsgcanvas_p.h @@@ -156,25 -152,12 +152,12 @@@ public QSGContext *context; - uint contextInThread : 1; + uint contextFailed : 1; - uint contextInThread : 1; uint threadedRendering : 1; - uint exitThread : 1; uint animationRunning: 1; - uint idle : 1; // Set to true when render thread sees no change and enters a wait() - uint needsRepaint : 1; // Set by callback from render if scene needs repainting. uint renderThreadAwakened : 1; - uint inSync: 1; - struct MyThread : public QThread { - MyThread(QSGCanvasPrivate *r) : renderer(r) {} - virtual void run() { renderer->runThread(); } - static void doWait() { QThread::msleep(16); } - QSGCanvasPrivate *renderer; - }; - MyThread *thread; - QMutex mutex; - QWaitCondition wait; + QSGCanvasRenderThread *thread; QSize widgetSize; QSize viewportSize; diff --cc src/declarative/items/qsgcanvasitem.cpp index a6403c0,fa99c9b..264752e --- a/src/declarative/items/qsgcanvasitem.cpp +++ b/src/declarative/items/qsgcanvasitem.cpp @@@ -117,7 -111,7 +117,6 @@@ QScriptValue QSGCanvasItem::getContext( void QSGCanvasItem::requestPaint() { - //Q_D(QSGCanvasItem); - // Q_D(QSGCanvasItem); //TODO:update(d->context->dirtyRect()); update(); }