aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-22 16:36:57 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-22 16:36:57 +0200
commitc704226b6815df4d989142729bae9fadd14f6f9d (patch)
tree4df1121d070b43bd20af27c8f0018e9ced2cf0f9 /src/quick/scenegraph
parentb0c8debfd19ea5752066cb4b933d504b2fa220c5 (diff)
parent3e3b5709025d3564215cfca4f9aa5da95742a61f (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp5
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp32
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgpainternode.cpp31
4 files changed, 11 insertions, 63 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 419062d025..3df11532e4 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -95,7 +95,8 @@ const char *QSGTextMaskMaterialData::fragmentShader() const {
"uniform sampler2D texture; \n"
"uniform lowp vec4 color; \n"
"void main() { \n"
- " gl_FragColor = vec4(texture2D(texture, sampleCoord).rgb * color.a, 1.0); \n"
+ " lowp vec4 glyph = texture2D(texture, sampleCoord); \n"
+ " gl_FragColor = vec4(glyph.rgb * color.a, glyph.a); \n"
"}";
}
@@ -162,7 +163,7 @@ void QSGTextMaskMaterialData::updateState(const RenderState &state, QSGMaterial
state.context()->functions()->glBlendColor(c.redF(),
c.greenF(),
c.blueF(),
- 1.0f);
+ c.alphaF());
}
}
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 33a99d1506..04981b54e7 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -215,49 +215,25 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
{
- bool renderWithoutShowing = QQuickWindowPrivate::get(window)->renderWithoutShowing;
- if ((!window->isExposed() && !renderWithoutShowing) || !m_windows.contains(window))
+ if (!QQuickWindowPrivate::get(window)->isRenderable() || !m_windows.contains(window))
return;
WindowData &data = const_cast<WindowData &>(m_windows[window]);
- QQuickWindow *masterWindow = 0;
- if (!window->isVisible() && !renderWithoutShowing) {
- // Find a "proper surface" to bind...
- for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin();
- it != m_windows.constEnd() && !masterWindow; ++it) {
- if (it.key()->isVisible())
- masterWindow = it.key();
- }
- } else {
- masterWindow = window;
- }
-
- if (!masterWindow)
- return;
-
- if (!QQuickWindowPrivate::get(masterWindow)->isRenderable()) {
- qWarning().nospace()
- << "Unable to find a renderable master window "
- << masterWindow << "when trying to render"
- << window << " (" << window->geometry() << ").";
- return;
- }
-
bool current = false;
if (!gl) {
gl = new QOpenGLContext();
- gl->setFormat(masterWindow->requestedFormat());
+ gl->setFormat(window->requestedFormat());
if (!gl->create()) {
delete gl;
gl = 0;
}
- current = gl->makeCurrent(masterWindow);
+ current = gl->makeCurrent(window);
if (current)
sg->initialize(gl);
} else {
- current = gl->makeCurrent(masterWindow);
+ current = gl->makeCurrent(window);
}
bool alsoSwap = data.updatePending;
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index b457c33bed..4cca87e990 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -328,9 +328,9 @@ public:
QEventLoop eventLoop;
- uint pendingUpdate : 2;
- uint sleeping : 1;
- uint syncResultedInChanges : 1;
+ uint pendingUpdate;
+ uint sleeping;
+ uint syncResultedInChanges;
volatile bool guiIsLocked;
volatile bool shouldExit;
diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp
index e5cf6b8295..97b3500ad0 100644
--- a/src/quick/scenegraph/util/qsgpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgpainternode.cpp
@@ -73,10 +73,6 @@ QSGPainterTexture::QSGPainterTexture()
m_retain_image = true;
}
-#ifdef QT_OPENGL_ES
-extern void qsg_swizzleBGRAToRGBA(QImage *image);
-#endif
-
void QSGPainterTexture::bind()
{
if (m_dirty_rect.isNull()) {
@@ -84,33 +80,8 @@ void QSGPainterTexture::bind()
return;
}
- bool oldMipmapsGenerated = m_mipmaps_generated;
- m_mipmaps_generated = true;
+ setImage(m_image);
QSGPlainTexture::bind();
- m_mipmaps_generated = oldMipmapsGenerated;
-
- QImage subImage = m_image.copy(m_dirty_rect);
-
- int w = m_dirty_rect.width();
- int h = m_dirty_rect.height();
-
-#ifdef QT_OPENGL_ES
- qsg_swizzleBGRAToRGBA(&subImage);
- glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
- GL_RGBA, GL_UNSIGNED_BYTE, subImage.constBits());
-#else
- glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
- GL_BGRA, GL_UNSIGNED_BYTE, subImage.constBits());
-#endif
-
- if (m_has_mipmaps && !m_mipmaps_generated) {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
- m_mipmaps_generated = true;
- }
-
- m_dirty_texture = false;
- m_dirty_bind_options = false;
m_dirty_rect = QRect();
}