diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-01 12:44:51 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-01 12:44:51 +0200 |
commit | b78372c4ba31da2d941d70ba23a927deae7d830c (patch) | |
tree | 25d9eeefbbb4c6ace084c56e58ac7bd1927217b5 /src/quick | |
parent | 9990c0f577f6a6a67ccebffb56ad1afc7a98ed1d (diff) | |
parent | 7ea1f75fd877f312d70a90ab0405f3ca03914171 (diff) |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: I996a85744753598bb48c7e0d7954049202f4f037
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/designer/designersupport.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickrendercontrol.cpp | 30 | ||||
-rw-r--r-- | src/quick/items/qquickrendercontrol_p.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultimagenode.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgwindowsrenderloop.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgatlastexture.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgtexture.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickpropertychanges.cpp | 37 |
14 files changed, 71 insertions, 26 deletions
diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp index 99dcf2ca71..82f796361b 100644 --- a/src/quick/designer/designersupport.cpp +++ b/src/quick/designer/designersupport.cpp @@ -94,7 +94,7 @@ void DesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool hide) texture->setSize(referencedItem->boundingRect().size().toSize()); texture->setRecursive(true); #ifndef QT_OPENGL_ES - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) texture->setFormat(GL_RGBA8); else texture->setFormat(GL_RGBA); diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index d919ae9a0f..e2a26836cf 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -245,4 +245,34 @@ QQuickWindow *QQuickRenderControl::window() const return d->window; } +/*! + \fn QWindow *QQuickRenderControl::renderWindow(QPoint *offset) + + Reimplemented in subclasses to return the real window this render control + is rendering into. + + If \a offset in non-null, it is set to the offset of the control + inside the window. +*/ + +/*! + Returns the real window that \a win is being rendered to, if any. + + If \a offset in non-null, it is set to the offset of the rendering + inside its window. + + */ + +QWindow *QQuickRenderControl::renderWindowFor(QQuickWindow *win, QPoint *offset) +{ + if (!win) + return 0; + QQuickRenderControl *rc = QQuickWindowPrivate::get(win)->renderControl; + if (rc) + return rc->renderWindow(offset); + return 0; +} + + + QT_END_NAMESPACE diff --git a/src/quick/items/qquickrendercontrol_p.h b/src/quick/items/qquickrendercontrol_p.h index 98dc946303..4cc2cf1252 100644 --- a/src/quick/items/qquickrendercontrol_p.h +++ b/src/quick/items/qquickrendercontrol_p.h @@ -63,6 +63,8 @@ public: ~QQuickRenderControl(); QQuickWindow *window() const; + virtual QWindow *renderWindow(QPoint */*offset*/) { return 0; } + static QWindow *renderWindowFor(QQuickWindow *win, QPoint *offset = 0); void windowDestroyed(); diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 265ca5543e..e8f803f2a9 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -2191,7 +2191,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) glLineWidth(g->lineWidth()); #if !defined(QT_OPENGL_ES_2) - else if (!QOpenGLContext::currentContext()->isES() && g->drawingMode() == GL_POINTS) + else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) glPointSize(g->lineWidth()); #endif diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 2d2b643e37..64506d1c26 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -198,7 +198,7 @@ void QSGContext::renderContextInitialized(QSGRenderContext *renderContext) if (!d->distanceFieldAntialiasingDecided) { d->distanceFieldAntialiasingDecided = true; #ifndef Q_OS_WIN - if (renderContext->openglContext()->isES()) + if (renderContext->openglContext()->isOpenGLES()) d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing; #endif } diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index 18142cc585..48b405467b 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -231,7 +231,7 @@ void QSGDefaultDistanceFieldGlyphCache::createTexture(TextureInfo *texInfo, int glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLContext::currentContext()->isES()) + if (!QOpenGLContext::currentContext()->isOpenGLES()) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); const GLint internalFormat = isCoreProfile() ? GL_R8 : GL_ALPHA; const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA; @@ -374,7 +374,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #if !defined(QT_OPENGL_ES_2) - if (!ctx->isES()) + if (!ctx->isOpenGLES()) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); #endif glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index 9113d1e447..d925b1c7c4 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -362,7 +362,7 @@ void QSGDefaultImageNode::updateGeometry() QOpenGLContext *ctx = QOpenGLContext::currentContext(); #ifndef QT_OPENGL_ES_2 - if (ctx->isES()) + if (ctx->isOpenGLES()) #endif { bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 808bf07cfc..e76aa1bbb5 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -332,7 +332,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) if (QOpenGLContextPrivate::globalShareContext()) gl->setShareContext(QOpenGLContextPrivate::globalShareContext()); if (!gl->create()) { - const bool isEs = gl->isES(); + const bool isEs = gl->isOpenGLES(); delete gl; gl = 0; handleContextCreationFailure(window, isEs); diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 3ded6b8ca2..0aa30280e5 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -954,7 +954,7 @@ void QSGThreadedRenderLoop::handleExposure(Window *w) w->thread->gl->setShareContext(QOpenGLContextPrivate::globalShareContext()); w->thread->gl->setFormat(w->window->requestedFormat()); if (!w->thread->gl->create()) { - const bool isEs = w->thread->gl->isES(); + const bool isEs = w->thread->gl->isOpenGLES(); delete w->thread->gl; w->thread->gl = 0; handleContextCreationFailure(w->window, isEs); diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 531f7c7551..e20f9cdb9e 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -183,7 +183,7 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window) m_gl->setShareContext(QOpenGLContextPrivate::globalShareContext()); bool created = m_gl->create(); if (!created) { - const bool isEs = m_gl->isES(); + const bool isEs = m_gl->isOpenGLES(); delete m_gl; m_gl = 0; handleContextCreationFailure(window, isEs); diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index 17f5460d9a..e37344b21c 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -147,7 +147,7 @@ Atlas::Atlas(const QSize &size) m_externalFormat = GL_BGRA; #ifndef QT_OPENGL_ES - if (QOpenGLContext::currentContext()->isES()) { + if (QOpenGLContext::currentContext()->isOpenGLES()) { #endif #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) @@ -334,7 +334,7 @@ void Atlas::bind(QSGTexture::Filtering filtering) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLContext::currentContext()->isES()) + if (!QOpenGLContext::currentContext()->isOpenGLES()) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); #endif glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_size.width(), m_size.height(), 0, m_externalFormat, GL_UNSIGNED_BYTE, 0); diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp index db8ed03b8d..f5a75fd627 100644 --- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp +++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp @@ -115,7 +115,7 @@ QSGDefaultDepthStencilBuffer::QSGDefaultDepthStencilBuffer(QOpenGLContext *conte m_functions.glGenRenderbuffers(1, &m_depthBuffer); m_functions.glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); GLenum internalFormat = GL_DEPTH_COMPONENT; - if (context->isES()) + if (context->isOpenGLES()) internalFormat = m_functions.hasOpenGLExtension(QOpenGLExtensions::Depth24) ? GL_DEPTH_COMPONENT24_OES : GL_DEPTH_COMPONENT16; if (format.samples && m_functions.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) { @@ -131,7 +131,7 @@ QSGDefaultDepthStencilBuffer::QSGDefaultDepthStencilBuffer(QOpenGLContext *conte #ifdef QT_OPENGL_ES const GLenum internalFormat = GL_STENCIL_INDEX8; #else - const GLenum internalFormat = context->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; + const GLenum internalFormat = context->isOpenGLES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; #endif if (format.samples && m_functions.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) { m_functions.glRenderbufferStorageMultisample(GL_RENDERBUFFER, format.samples, diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index c6e5f7ac7b..cd0b64fe49 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -689,7 +689,7 @@ void QSGPlainTexture::bind() #ifdef QT_OPENGL_ES internalFormat = GL_BGRA; #else - if (context->isES()) + if (context->isOpenGLES()) internalFormat = GL_BGRA; #endif // QT_OPENGL_ES } else if (!wrongfullyReportsBgra8888Support diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 188b91b15e..1786317356 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -272,12 +272,11 @@ QByteArray QQuickPropertyChangesParser::compile(const QV4::CompiledData::QmlUnit ds << data.count(); for (int ii = 0; ii < data.count(); ++ii) { const QV4::CompiledData::Binding *binding = data.at(ii).second; + ds << data.at(ii).first << int(binding->type); QVariant var; - bool isScript = binding->type == QV4::CompiledData::Binding::Type_Script; - QQmlBinding::Identifier id = QQmlBinding::Invalid; switch (binding->type) { case QV4::CompiledData::Binding::Type_Script: - id = bindingIdentifier(binding); + ds << bindingIdentifier(binding); // Fall through as we also need the expression string. // Signal handlers still need to be constructed by string ;( case QV4::CompiledData::Binding::Type_String: @@ -291,13 +290,12 @@ QByteArray QQuickPropertyChangesParser::compile(const QV4::CompiledData::QmlUnit break; case QV4::CompiledData::Binding::Type_Translation: case QV4::CompiledData::Binding::Type_TranslationById: - Q_UNREACHABLE(); + ds << binding->value.translationData.commentIndex << binding->value.translationData.number; + var = binding->stringIndex; default: break; } - ds << data.at(ii).first << isScript << var; - if (isScript) - ds << id; + ds << var; } return rv; @@ -315,14 +313,21 @@ void QQuickPropertyChangesPrivate::decode() ds >> count; for (int ii = 0; ii < count; ++ii) { QString name; - bool isScript; + int type; QVariant data; QQmlBinding::Identifier id = QQmlBinding::Invalid; + QV4::CompiledData::TranslationData tsd; ds >> name; - ds >> isScript; - ds >> data; - if (isScript) + ds >> type; + + if (type == QV4::CompiledData::Binding::Type_Script) { ds >> id; + } else if (type == QV4::CompiledData::Binding::Type_Translation + || type == QV4::CompiledData::Binding::Type_TranslationById) { + ds >> tsd.commentIndex >> tsd.number; + } + + ds >> data; QQmlProperty prop = property(name); //### better way to check for signal property? if (prop.type() & QQmlProperty::SignalProperty) { @@ -331,7 +336,7 @@ void QQuickPropertyChangesPrivate::decode() handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(qmlContext(q)), object, cdata->functionForBindingId(id))); signalReplacements << handler; - } else if (isScript) { // binding + } else if (type == QV4::CompiledData::Binding::Type_Script) { // binding QString expression = data.toString(); QUrl url = QUrl(); int line = -1; @@ -346,6 +351,14 @@ void QQuickPropertyChangesPrivate::decode() expressions << ExpressionChange(name, id, expression, url, line, column); } else { + if (type == QV4::CompiledData::Binding::Type_Translation + || type == QV4::CompiledData::Binding::Type_TranslationById) { + QV4::CompiledData::Binding tmpBinding; + tmpBinding.type = type; + tmpBinding.stringIndex = data.toInt(); + tmpBinding.value.translationData = tsd; + data = tmpBinding.valueAsString(&cdata->qmlUnit->header); + } properties << qMakePair(name, data); } } |