From da261b786f2300bf395134f5abfefde3d1d474cc Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 9 Sep 2009 10:16:57 +0200 Subject: Try to fix tst_q3popupmenu with slow windows manager --- tests/auto/q3popupmenu/tst_q3popupmenu.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/auto/q3popupmenu/tst_q3popupmenu.cpp b/tests/auto/q3popupmenu/tst_q3popupmenu.cpp index 3be416c..5585c3a 100644 --- a/tests/auto/q3popupmenu/tst_q3popupmenu.cpp +++ b/tests/auto/q3popupmenu/tst_q3popupmenu.cpp @@ -117,6 +117,8 @@ void tst_Q3PopupMenu::task177490_highlighted() QApplication::processEvents(); #endif Q3PopupMenu menu1; + //don't let the window manager move the popup while we are testing + menu1.setWindowFlags(Qt::X11BypassWindowManagerHint); menu1.insertItem("Item 1"); Q3PopupMenu menu2; @@ -133,16 +135,12 @@ void tst_Q3PopupMenu::task177490_highlighted() QTest::mouseMove(&menu1, QPoint(x, y1)); QTest::mouseMove(&menu1, QPoint(x, y1 + 1)); - QTest::qWait(1000); + QTest::qWait(100); QTest::mouseMove(&menu1, QPoint(x, y2)); QTest::mouseMove(&menu1, QPoint(x, y2 + 1)); - QTest::qWait(1000); + QTest::qWait(100); - if (!menu2.isVisible()) - QEXPECT_FAIL( - "", "expected failure due to visibilty/focus problem; to be investigated later", - Abort); QCOMPARE(spy.count(), 2); // one per menu item } -- cgit v0.12 From cfed7f06e186630c4c84d9cf278a2540a45dde2d Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 9 Sep 2009 09:52:54 +0200 Subject: Remove duplicate setFBO calls introduced by QGLPaintDevice merge Reviewed-by: Trustme --- src/opengl/qglframebufferobject.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index f14fa4d..c1049b6 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -382,7 +382,6 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, { QGLContext *currentContext = const_cast(QGLContext::currentContext()); ctx = QGLContextPrivate::contextGroup(currentContext); - glDevice.setFBO(q); bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject); if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(currentContext))) @@ -644,7 +643,6 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target) : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->glDevice.setFBO(this); d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); } -- cgit v0.12 From c363cd989a07056b0b8ea39e44c719512bb1e619 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 9 Sep 2009 10:23:49 +0200 Subject: Fix build breakage on Mac Carbon A new QGLFramebufferObject constructor was added after the QGLPaintDevice was branched which therefore didn't get patched. Reviewed-by: Trustme --- src/opengl/qglframebufferobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index c1049b6..094f675 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -652,7 +652,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, QMacCompatGLenum t : d_ptr(new QGLFramebufferObjectPrivate) { Q_D(QGLFramebufferObject); - d->init(size, NoAttachment, target, DEFAULT_FORMAT); + d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); } #endif -- cgit v0.12 From 67645790afd965e3fdf312d5233d7c2f0dc3619a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 9 Sep 2009 10:22:55 +0200 Subject: Fixed y-inversion of pixmap drawing on gl graphics system Reviewed-by: Trond --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 +++-- src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 2 ++ src/opengl/qgl.cpp | 8 ++++---- src/opengl/qgl_p.h | 10 ++++++---- src/opengl/qpaintengine_opengl.cpp | 16 ++++++++++++++-- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index e24539b..0ad454f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -423,8 +423,9 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() const QPixmap& texPixmap = currentBrush->texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1; } brushTextureDirty = false; } @@ -517,7 +518,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } - QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() ); + QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 * textureInvertedY / texPixmap.height()); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); QVector2D halfViewportSize(width*0.5, height*0.5); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index cb23b11..2b16019 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -261,6 +261,8 @@ public: bool needsSync; bool inRenderText; + + float textureInvertedY; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 9e0c5f8..3c23149 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4851,7 +4851,7 @@ QGLFormat QGLDrawable::format() const return QGLFormat(); } -GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format, +QGLTexture *QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { QGLTexture *texture = 0; @@ -4866,10 +4866,10 @@ GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format else if (wsurf) texture = wsurf->context()->d_func()->bindTexture(image, target, format, options); #endif - return texture->id; + return texture; } -GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, +QGLTexture *QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { QGLTexture *texture = 0; @@ -4883,7 +4883,7 @@ GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint form else if (wsurf) texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, options); #endif - return texture->id; + return texture; } QColor QGLDrawable::backgroundColor() const diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index d4b7597..2eb4aa5 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -358,10 +358,12 @@ public: void doneCurrent(); QSize size() const; QGLFormat format() const; - GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA, - QGLContext::BindOptions = QGLContext::InternalBindOption); - GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA, - QGLContext::BindOptions = QGLContext::InternalBindOption); + QGLTexture *bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, + GLint format = GL_RGBA, + QGLContext::BindOptions = QGLContext::InternalBindOption); + QGLTexture *bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, + GLint format = GL_RGBA, + QGLContext::BindOptions = QGLContext::InternalBindOption); QColor backgroundColor() const; QGLContext *context() const; bool autoFillBackground() const; diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index bf4d4b9..8c545d2 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4335,10 +4335,11 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con } else { d->flushDrawQueue(); + QGLTexture *tex; if (scaled.isNull()) - d->drawable.bindTexture(pm); + tex = d->drawable.bindTexture(pm); else - d->drawable.bindTexture(scaled); + tex = d->drawable.bindTexture(scaled); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, d->use_smooth_pixmap_transform); #ifndef QT_OPENGL_ES @@ -4351,6 +4352,15 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con GLdouble tc_w = r.width()/pm.width(); GLdouble tc_h = r.height()/pm.height(); + // Rotate the texture so that it is aligned correctly and the + // wrapping is done correctly + if (tex->options & QGLContext::InvertedYBindOption) { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glRotatef(180.0, 0.0, 1.0, 0.0); + glRotatef(180.0, 0.0, 0.0, 1.0); + } + q_vertexType vertexArray[4*2]; q_vertexType texCoordArray[4*2]; @@ -4369,6 +4379,8 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); + if (tex->options & QGLContext::InvertedYBindOption) + glPopMatrix(); glDisable(GL_TEXTURE_2D); #ifndef QT_OPENGL_ES -- cgit v0.12 From 2cb0292aaa2aa60dbfdcc0391753774bf3823151 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 9 Sep 2009 10:38:23 +0200 Subject: Tweak the test Give it another spin through the event loop, to make sure that all the painting gets done. (This is not connected to the glib timer event test failure.) --- tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp b/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp index 3a2e79b..014074a 100644 --- a/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp +++ b/tests/auto/qwswindowsystem/tst_qwswindowsystem.cpp @@ -239,6 +239,7 @@ void tst_QWSWindowSystem::windowOpacity() QColor(255, 255, 255, 0)); w2.setPalette(palette); QApplication::processEvents(); + QApplication::processEvents(); QCOMPARE(win1->allocatedRegion(), QRegion(rect)); QCOMPARE(win2->allocatedRegion(), QRegion(rect)); VERIFY_COLOR(rect, w1.color()); -- cgit v0.12 From bb6aee6989aadfa1bcf4b36f302540440b3acc93 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 9 Sep 2009 10:37:57 +0200 Subject: Fix crash in QtScript with exceptions. When trying to determine if there is a handler for an exception, determine the returnPC for the call frame traversal frmo the corrent CallFrame object. Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 3af4a29..c538eb1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -586,13 +586,14 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV unsigned bytecodeOffsetTemp = bytecodeOffset; CodeBlock *codeBlockTemp = codeBlock; while (!(handler = codeBlockTemp->handlerForBytecodeOffset(bytecodeOffsetTemp))) { + void* returnPC = callFrameTemp->returnPC(); callFrameTemp = callFrameTemp->callerFrame(); if (callFrameTemp->hasHostCallFrameFlag()) { hasHandler = false; break; } else { codeBlockTemp = callFrameTemp->codeBlock(); - bytecodeOffsetTemp = bytecodeOffsetForPC(callFrameTemp, codeBlockTemp, callFrameTemp->returnPC()); + bytecodeOffsetTemp = bytecodeOffsetForPC(callFrameTemp, codeBlockTemp, returnPC); } } if (debugger) -- cgit v0.12 From 515828f43d1aeee3ad50f6da55a12afce43f1557 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 9 Sep 2009 11:19:29 +0200 Subject: More robust graphicsview test --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index b52cb7d..bb0ea70 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2173,14 +2173,12 @@ void tst_QGraphicsView::viewportUpdateMode() qt_x11_wait_for_window_manager(&view); #endif QTest::qWait(50); + QTRY_VERIFY(!view.lastUpdateRegions.isEmpty()); view.lastUpdateRegions.clear(); // Issue two scene updates. scene.update(QRectF(0, 0, 10, 10)); scene.update(QRectF(20, 0, 10, 10)); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif QTest::qWait(50); // The view gets two updates for the update scene updates. -- cgit v0.12 From 12dbb637d42de5cc47cfff242d923d2dd5fce260 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 9 Sep 2009 11:51:13 +0200 Subject: Made GL1 engine have proper y-rotation since qgldrawable refactor Reviewed-by: Tom --- src/opengl/qpaintengine_opengl.cpp | 30 +++++++++++++++++++++--------- src/opengl/qpaintengine_opengl_p.h | 3 ++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 0219b55..15cfcfc 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4300,8 +4300,10 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR else { GLenum target = qt_gl_preferredTextureTarget(); d->flushDrawQueue(); - d->device->context()->bindTexture(pm, target); - drawTextureRect(pm.width(), pm.height(), r, sr, target); + QGLTexture *tex = + d->device->context()->d_func()->bindTexture(pm, target, GL_RGBA, + QGLContext::InternalBindOption); + drawTextureRect(pm.width(), pm.height(), r, sr, target, tex); } } @@ -4416,13 +4418,15 @@ void QOpenGLPaintEngine::drawImage(const QRectF &r, const QImage &image, const Q else { GLenum target = qt_gl_preferredTextureTarget(); d->flushDrawQueue(); - d->device->context()->bindTexture(image, target); - drawTextureRect(image.width(), image.height(), r, sr, target); + QGLTexture *tex = + d->device->context()->d_func()->bindTexture(image, target, GL_RGBA, + QGLContext::InternalBindOption); + drawTextureRect(image.width(), image.height(), r, sr, target, tex); } } void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRectF &r, - const QRectF &sr, GLenum target) + const QRectF &sr, GLenum target, QGLTexture *tex) { Q_D(QOpenGLPaintEngine); #ifndef QT_OPENGL_ES @@ -4437,8 +4441,13 @@ void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRec if (target == GL_TEXTURE_2D) { x1 = sr.x() / tx_width; x2 = x1 + sr.width() / tx_width; - y1 = 1 - (sr.bottom() / tx_height); - y2 = 1 - (sr.y() / tx_height); + if (tex->options & QGLContext::InvertedYBindOption) { + y1 = 1 - (sr.bottom() / tx_height); + y2 = 1 - (sr.y() / tx_height); + } else { + y1 = sr.bottom() / tx_height; + y2 = sr.y() / tx_height; + } } else { x1 = sr.x(); x2 = sr.right(); @@ -5193,9 +5202,12 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * glActiveTexture(GL_TEXTURE0 + brush_texture_location); if (current_style == Qt::TexturePattern) - device->context()->bindTexture(cbrush.textureImage()); + device->context()->d_func()->bindTexture(cbrush.textureImage(), GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); else - device->context()->bindTexture(qt_imageForBrush(current_style, true)); + device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, true), + GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, use_smooth_pixmap_transform); } diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index 1cac3ad..13299da 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -146,7 +146,8 @@ public: private: void drawPolyInternal(const QPolygonF &pa, bool close = true); - void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, GLenum target); + void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, + GLenum target, QGLTexture *tex); Q_DISABLE_COPY(QOpenGLPaintEngine) }; -- cgit v0.12