From cea0b5db7f16177882bbfbbe7b4f92307b045bf7 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 10 Sep 2009 16:28:20 +1000 Subject: Return the correct QGLFormat to the OpenGL1 paint engine for FBO's QGLPaintDevice::format() was returning the context's format, not the format of the window surface's FBO. This caused the OpenGL1 paint engine to think that the window didn't have depth and stencil buffers, even though the FBO most certainly did. This change makes QGLPaintDevice::format() virtual and overrides it in QGLFBOGLPaintDevice to return an updated format that includes the context parameters plus the extra features that the FBO supports. Reviewed-by: Tom Cooksey --- src/opengl/qglframebufferobject.cpp | 15 +++++++++++++-- src/opengl/qglframebufferobject_p.h | 5 ++++- src/opengl/qglpaintdevice_p.h | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 094f675..f15aa01 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -299,10 +299,21 @@ bool QGLFramebufferObjectFormat::operator!=(const QGLFramebufferObjectFormat& ot return !(*this == other); } -void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f) +void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, + QGLFramebufferObject::Attachment attachment) { fbo = f; m_thisFBO = fbo->d_func()->fbo; // This shouldn't be needed + + // The context that the fbo was created in may not have depth + // and stencil buffers, but the fbo itself might. + fboFormat = QGLContext::currentContext()->format(); + if (attachment == QGLFramebufferObject::CombinedDepthStencil) { + fboFormat.setDepth(true); + fboFormat.setStencil(true); + } else if (attachment == QGLFramebufferObject::Depth) { + fboFormat.setDepth(true); + } } void QGLFBOGLPaintDevice::ensureActiveTarget() @@ -395,7 +406,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo); - glDevice.setFBO(q); + glDevice.setFBO(q, attachment); QT_CHECK_GLERROR(); // init texture diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index c11c496..f80209d 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -110,15 +110,18 @@ public: virtual QPaintEngine* paintEngine() const {return fbo->paintEngine();} virtual QSize size() const {return fbo->size();} virtual QGLContext* context() const {return const_cast(QGLContext::currentContext());} + virtual QGLFormat format() const {return fboFormat;} virtual void ensureActiveTarget(); virtual void beginPaint(); virtual void endPaint(); - void setFBO(QGLFramebufferObject* f); + void setFBO(QGLFramebufferObject* f, + QGLFramebufferObject::Attachment attachment); private: bool wasBound; QGLFramebufferObject* fbo; + QGLFormat fboFormat; }; class QGLFramebufferObjectPrivate diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index 66b24a9..1e7ba8d 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -73,7 +73,7 @@ public: virtual void endPaint(); virtual QGLContext* context() const = 0; - QGLFormat format() const; + virtual QGLFormat format() const; virtual QSize size() const = 0; // returns the QGLPaintDevice for the given QPaintDevice -- cgit v0.12 From 08b54f274d57e4735d0042e295237f176506433d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 10 Sep 2009 09:24:59 +0200 Subject: Compile Reviewed-by: Jeremy Katz --- tests/auto/qthread/tst_qthread.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index dec25bd..64bdfd0 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -629,6 +629,12 @@ void noop(void*) { } typedef HANDLE ThreadHandle; #endif +#ifdef Q_OS_WIN +#define WIN_FIX_STDCALL __stdcall +#else +#define WIN_FIX_STDCALL +#endif + class NativeThreadWrapper { public: @@ -647,7 +653,7 @@ public: QWaitCondition stopCondition; protected: static void *runUnix(void *data); - static unsigned __stdcall runWin(void *data); + static unsigned WIN_FIX_STDCALL runWin(void *data); FunctionPointer functionPointer; void *data; @@ -711,7 +717,7 @@ void *NativeThreadWrapper::runUnix(void *that) return 0; } -unsigned __stdcall NativeThreadWrapper::runWin(void *data) +unsigned WIN_FIX_STDCALL NativeThreadWrapper::runWin(void *data) { runUnix(data); return 0; -- cgit v0.12 From 680cbc408e7aadf19f58da2d65495e5e8e6d37b0 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 10 Sep 2009 08:40:54 +0100 Subject: Make exception safety test work with XML output and warnings The QTestLib XML output system throws exceptions when the system is out of memory, which is normally quite reasonable. However when it is used to report warnings during a catch block, this terminates the program. So this change temporarily disables allocation failures while the warning is being recorded. Reviewed-by: Jason Barron --- .../tst_exceptionsafety_objects.cpp | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index e3a70e9..420962d 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -49,8 +49,8 @@ QT_USE_NAMESPACE // this test only works with // * GLIBC // * MSVC - only debug builds (we need the crtdbg.h helpers) -// * SYMBIAN - only when __UHEAP_BURSTFAILNEXT is available -#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && (!defined(Q_OS_SYMBIAN) || !defined(__UHEAP_BURSTFAILNEXT)))) && !defined(Q_MOC_RUN) +// * SYMBIAN +#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && !defined(Q_OS_SYMBIAN))) && !defined(Q_MOC_RUN) QTEST_NOOP_MAIN #else @@ -65,6 +65,7 @@ class tst_ExceptionSafetyObjects: public QObject public slots: void initTestCase(); + void cleanupTestCase(); private slots: void objects_data(); @@ -81,6 +82,10 @@ private slots: void linkedList_data(); void linkedList(); + +private: + static QtMsgHandler testMessageHandler; + static void safeMessageHandler(QtMsgType, const char *); }; // helper structs to create an arbitrary widget @@ -268,8 +273,22 @@ public: } }; +QtMsgHandler tst_ExceptionSafetyObjects::testMessageHandler; + +void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char *msg) +{ + // this temporarily suspends OOM testing while handling a message + int currentIndex = mallocFailIndex; + AllocFailer allocFailer(0); + allocFailer.deactivate(); + (*testMessageHandler)(type, msg); + allocFailer.reactivateAt(currentIndex); +} + void tst_ExceptionSafetyObjects::initTestCase() { + testMessageHandler = qInstallMsgHandler(safeMessageHandler); + QVERIFY(AllocFailer::initialize()); // sanity check whether OOM simulation works @@ -307,6 +326,11 @@ void tst_ExceptionSafetyObjects::initTestCase() QCOMPARE(malloc2Failed, 1); } +void tst_ExceptionSafetyObjects::cleanupTestCase() +{ + qInstallMsgHandler(testMessageHandler); +} + void tst_ExceptionSafetyObjects::objects() { QFETCH(AbstractTester *, objectCreator); -- cgit v0.12 From c75c685280730e6a0e257ab2ede6f7266f2b70a1 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 10 Sep 2009 09:57:32 +0200 Subject: Add a layout in the demo it looks better. Reviewed-by:jan-arve --- .../audio/audiodevices/audiodevicesbase.ui | 444 ++++++++++----------- 1 file changed, 211 insertions(+), 233 deletions(-) diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui index 674f201..29dd40e 100644 --- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui +++ b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui @@ -1,7 +1,8 @@ - + + AudioDevicesBase - - + + 0 0 @@ -9,246 +10,223 @@ 702 - + AudioDevicesBase - - - - 0 - 28 - 504 - 653 - - - - - - 40 - 21 - 321 - 506 - - - - - - - - 1 - 0 - - - - Device - - - - - - - Mode - - - - - - - - - - - - - QFrame::Panel - - - QFrame::Raised - - - Actual Settings - - - Qt::AlignCenter - - - - - - - QFrame::Panel - - - QFrame::Raised - - - Nearest Settings - - - Qt::AlignCenter - - - - - - - Frequency - - - - - - - Frequency - - - - - - - - - - - - - Channels - - - - - - - Channel - - - - - - - - - - - - - Codecs - - - - - - - Codec - - - - - - - - - - - - - SampleSize - - - - - - - SampleSize - - - - - - - - - - - - - SampleType - - - - - - - SampleType - - - - - - - - - - - - - Endianess - - - - - - - Endianess - - - - - - - - - - - - - - 0 - 40 - - - - - - - - Test - - - - - + + + + + + + + + 1 + 0 + + + + Device + + + + + + + Mode + + + + + + + + + + + + + QFrame::Panel + + + QFrame::Raised + + + Actual Settings + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Raised + + + Nearest Settings + + + Qt::AlignCenter + + + + + + + Frequency + + + + + + + Frequency + + + + + + + + + + + + + Channels + + + + + + + Channel + + + + + + + + + + + + + Codecs + + + + + + + Codec + + + + + + + + + + + + + SampleSize + + + + + + + SampleSize + + + + + + + + + + + + + SampleType + + + + + + + SampleType + + + + + + + + + + + + + Endianess + + + + + + + Endianess + + + + + + + + + + + + + + 0 + 40 + + + + + + + + Test + + + + + + - - + + 0 0 504 - 28 - - - - - - - 0 - 681 - 504 - 21 + 22 + -- cgit v0.12 From d7fac182fe090831ac5f9e70d0615aec298ff1e2 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 10 Sep 2009 09:54:28 +0200 Subject: Autotest fix for QMainWindow On embedded, the size of the screen is too small to leave enough space for the dock widgets. --- tests/auto/qmainwindow/tst_qmainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index 6505f90..38d23b6 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -1692,8 +1692,12 @@ void tst_QMainWindow::dockWidgetSize() mainWindow.show(); QTest::qWait(100); - QCOMPARE(widget.size(), widget.sizeHint()); - QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint()); + if (mainWindow.size() == mainWindow.sizeHint()) { + QCOMPARE(widget.size(), widget.sizeHint()); + QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint()); + } else { + //otherwise the screen is too small and the size are irrelevant + } } -- cgit v0.12