From 6b6b206ed8634323570712e003fc159fbf5f8303 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 28 Jan 2010 08:18:34 +1000 Subject: Better support for user-generated binary shaders If the user provided their own shader with glShaderBinary(), QGLShaderProgram::addShader() would refuse to add it because it wasn't marked as "compiled". According to the OpenGL/ES 2.0 specification: "It is permissible to attach a shader object to a program object before source code has been loaded into the shader object or before the shader object has been compiled." Based on this, the compile check has been removed from addShader() which should make supporting binary shaders easier. Similarly, link() and programId() have been modified to support applications that use glProgramBinaryOES() to specify program binaries. Task-number: QTBUG-7490 Reviewed-by: Tom Cooksey --- src/opengl/qglshaderprogram.cpp | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 5e2f1f5..79484fa 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -106,6 +106,19 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 2 + \section1 Binary shaders and programs + + Binary shaders may be specified using \c{glShaderBinary()} on + the return value from QGLShader::shaderId(). The QGLShader instance + containing the binary can then be added to the shader program with + addShader() and linked in the usual fashion with link(). + + Binary programs may be specified using \c{glProgramBinaryOES()} + on the return value from programId(). Then the application should + call link(), which will notice that the program has already been + specified and linked, allowing other operations to be performed + on the shader program. + \sa QGLShader */ @@ -632,8 +645,6 @@ bool QGLShaderProgram::addShader(QGLShader *shader) qWarning("QGLShaderProgram::addShader: Program and shader are not associated with same context."); return false; } - if (!shader->d_func()->compiled) - return false; if (!shader->d_func()->shaderGuard.id()) return false; glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); @@ -820,8 +831,20 @@ bool QGLShaderProgram::link() GLuint program = d->programGuard.id(); if (!program) return false; + GLint value; + if (d->shaders.isEmpty()) { + // If there are no explicit shaders, then it is possible that the + // application added a program binary with glProgramBinaryOES(), + // or otherwise populated the shaders itself. Check to see if the + // program is already linked and bail out if so. + value = 0; + glGetProgramiv(program, GL_LINK_STATUS, &value); + d->linked = (value != 0); + if (d->linked) + return true; + } glLinkProgram(program); - GLint value = 0; + value = 0; glGetProgramiv(program, GL_LINK_STATUS, &value); d->linked = (value != 0); value = 0; @@ -928,6 +951,15 @@ void QGLShaderProgram::release() GLuint QGLShaderProgram::programId() const { Q_D(const QGLShaderProgram); + GLuint id = d->programGuard.id(); + if (id) + return id; + + // Create the identifier if we don't have one yet. This is for + // applications that want to create the attached shader configuration + // themselves, particularly those using program binaries. + if (!const_cast(this)->init()) + return 0; return d->programGuard.id(); } -- cgit v0.12 From 902229bfffd709fb3294ac92180f1b171dc37eb8 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 28 Jan 2010 10:46:01 +0100 Subject: don't build unneeded QtDesigner parts on Windows CE We just build uitools like on Symbian. The following subdirs have been removed from tools/designer/src/src.pro tools/designer/src/lib tools/designer/src/components Reviewed-by: mauricek --- tools/designer/src/src.pro | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/designer/src/src.pro b/tools/designer/src/src.pro index e1710b8..78665b7 100644 --- a/tools/designer/src/src.pro +++ b/tools/designer/src/src.pro @@ -9,6 +9,4 @@ SUBDIRS = \ CONFIG(shared,shared|static):SUBDIRS += plugins -wince*: SUBDIRS -= designer plugins -symbian: SUBDIRS = uitools -contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= lib components \ No newline at end of file +symbian|wince*: SUBDIRS = uitools -- cgit v0.12 From 7c2000060bbc152ae32594f3d4dd60bd3351dab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 28 Jan 2010 13:29:54 +0100 Subject: Fixed an endless loop if printing web pages. Entering a page range which is valid, but outside of the printable range would result in an infinite loop. Task-number: QTBUG-6051 Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 29bde0d..e4c2afc 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -1369,6 +1369,11 @@ void QWebFrame::print(QPrinter *printer) const // paranoia check fromPage = qMax(1, fromPage); toPage = qMin(printContext.pageCount(), toPage); + if (toPage < fromPage) { + // if the user entered a page range outside the actual number + // of printable pages, just return + return; + } if (printer->pageOrder() == QPrinter::LastPageFirst) { int tmp = fromPage; -- cgit v0.12 From 0585997b7dbe25ece9f60684171c16206d10d65f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 28 Jan 2010 16:34:21 +0100 Subject: Fix a regression: icons with slightly wrong ICO header did not load. Regression was introduced by commit fd9cdaa55da455b90eacec571aeb2c84fa55f7e0. Also fix a completely broken autotest that didn't actually test anything. Task-number: QTBUG-7688 Reviewed-by: Alexis --- src/plugins/imageformats/ico/qicohandler.cpp | 4 ++++ tests/auto/qimagereader/baseline/35floppy.ico | Bin 4286 -> 0 bytes tests/auto/qimagereader/baseline/35floppy.png | Bin 0 -> 329 bytes tests/auto/qimagereader/baseline/connect.png | Bin 0 -> 12943 bytes tests/auto/qimagereader/baseline/kde_favicon.ico | Bin 1150 -> 0 bytes tests/auto/qimagereader/baseline/kde_favicon.png | Bin 0 -> 514 bytes tests/auto/qimagereader/baseline/semitransparent.ico | Bin 9662 -> 0 bytes tests/auto/qimagereader/baseline/semitransparent.png | Bin 0 -> 545 bytes tests/auto/qimagereader/tst_qimagereader.cpp | 13 ++++++++++--- 9 files changed, 14 insertions(+), 3 deletions(-) delete mode 100644 tests/auto/qimagereader/baseline/35floppy.ico create mode 100644 tests/auto/qimagereader/baseline/35floppy.png create mode 100644 tests/auto/qimagereader/baseline/connect.png delete mode 100644 tests/auto/qimagereader/baseline/kde_favicon.ico create mode 100644 tests/auto/qimagereader/baseline/kde_favicon.png delete mode 100644 tests/auto/qimagereader/baseline/semitransparent.ico create mode 100644 tests/auto/qimagereader/baseline/semitransparent.png diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index 4f49476..b2351fa 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -556,7 +556,11 @@ QImage ICOReader::iconAt(int index) else // # colors used icoAttrib.ncolors = header.biClrUsed ? header.biClrUsed : 1 << icoAttrib.nbits; icoAttrib.w = iconEntry.bWidth; + if (icoAttrib.w == 0) + icoAttrib.w = header.biWidth; icoAttrib.h = iconEntry.bHeight; + if (icoAttrib.h == 0) + icoAttrib.h = header.biHeight/2; QImage::Format format = QImage::Format_ARGB32; if (icoAttrib.nbits == 24) diff --git a/tests/auto/qimagereader/baseline/35floppy.ico b/tests/auto/qimagereader/baseline/35floppy.ico deleted file mode 100644 index 59fd37e..0000000 Binary files a/tests/auto/qimagereader/baseline/35floppy.ico and /dev/null differ diff --git a/tests/auto/qimagereader/baseline/35floppy.png b/tests/auto/qimagereader/baseline/35floppy.png new file mode 100644 index 0000000..56b9b44 Binary files /dev/null and b/tests/auto/qimagereader/baseline/35floppy.png differ diff --git a/tests/auto/qimagereader/baseline/connect.png b/tests/auto/qimagereader/baseline/connect.png new file mode 100644 index 0000000..9544bb9 Binary files /dev/null and b/tests/auto/qimagereader/baseline/connect.png differ diff --git a/tests/auto/qimagereader/baseline/kde_favicon.ico b/tests/auto/qimagereader/baseline/kde_favicon.ico deleted file mode 100644 index 15bcdbb..0000000 Binary files a/tests/auto/qimagereader/baseline/kde_favicon.ico and /dev/null differ diff --git a/tests/auto/qimagereader/baseline/kde_favicon.png b/tests/auto/qimagereader/baseline/kde_favicon.png new file mode 100644 index 0000000..e19287b Binary files /dev/null and b/tests/auto/qimagereader/baseline/kde_favicon.png differ diff --git a/tests/auto/qimagereader/baseline/semitransparent.ico b/tests/auto/qimagereader/baseline/semitransparent.ico deleted file mode 100644 index dd23de9..0000000 Binary files a/tests/auto/qimagereader/baseline/semitransparent.ico and /dev/null differ diff --git a/tests/auto/qimagereader/baseline/semitransparent.png b/tests/auto/qimagereader/baseline/semitransparent.png new file mode 100644 index 0000000..a3ad780 Binary files /dev/null and b/tests/auto/qimagereader/baseline/semitransparent.png differ diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 72c5c8b..e7cfe68 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -1633,7 +1633,8 @@ void tst_QImageReader::pixelCompareWithBaseline_data() QTest::newRow("floppy (16px,32px - 16 colors)") << "35floppy.ico"; QTest::newRow("semitransparent") << "semitransparent.ico"; - QTest::newRow("slightlybroken") << "kde_favicon.ico"; + QTest::newRow("slightlybrokenBMPHeader") << "kde_favicon.ico"; + QTest::newRow("sightlybrokenIconHeader") << "connect.ico"; } void tst_QImageReader::pixelCompareWithBaseline() @@ -1641,14 +1642,20 @@ void tst_QImageReader::pixelCompareWithBaseline() QFETCH(QString, fileName); QImage icoImg; + const QString inputFileName(QString::fromAscii("images/%1").arg(fileName)); + QFileInfo fi(inputFileName); + // might fail if the plugin does not exist, which is ok. - if (icoImg.load(QString::fromAscii("images/%1").arg(fileName))) { - QString baselineFileName = QString::fromAscii("baseline/%1").arg(fileName); + if (icoImg.load(inputFileName)) { + icoImg = icoImg.convertToFormat(QImage::Format_ARGB32_Premultiplied); + const QString baselineFileName(QString::fromAscii("baseline/%1.png").arg(fi.baseName())); #if 0 icoImg.save(baselineFileName); #else QImage baseImg; QVERIFY(baseImg.load(baselineFileName)); + baseImg = baseImg.convertToFormat(QImage::Format_ARGB32_Premultiplied); + QCOMPARE(int(baseImg.format()), int(icoImg.format())); QCOMPARE(baseImg, icoImg); #endif } -- cgit v0.12