summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-20 20:30:52 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-20 20:30:52 (GMT)
commit660ec910ef60513b511e2292255e53701dbb239b (patch)
treee3dc228a708a90116d0420933dafac05e7ac4445
parentd5f606f111527516bfe038a4045c8ec92f0499f7 (diff)
parentbd34833eb6d6d1a4cd848b002e44e18986376218 (diff)
downloadQt-660ec910ef60513b511e2292255e53701dbb239b.zip
Qt-660ec910ef60513b511e2292255e53701dbb239b.tar.gz
Qt-660ec910ef60513b511e2292255e53701dbb239b.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed compile warning on Windows. Fixed painter path drawing on FBO without stencil buffer. Fixed color of cosmetic pens when printing under Windows. Fixed infinite loop when loading jpeg without EOI from memory.
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2
-rw-r--r--src/gui/image/qjpeghandler.cpp19
-rw-r--r--src/gui/painting/qprintengine_win.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp26
-rw-r--r--src/opengl/qglframebufferobject.cpp4
-rw-r--r--tests/auto/qimagereader/images/qtbug13653-no_eoi.jpgbin0 -> 8250 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc1
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp5
8 files changed, 46 insertions, 13 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index c166c30..54fdf3f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4751,7 +4751,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
ENSURE_TRANSFORM_PTR
QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toAlignedRect()
: transformPtr->mapRect(brect).toAlignedRect();
- viewBoundingRect.adjust(-rectAdjust, -rectAdjust, rectAdjust, rectAdjust);
+ viewBoundingRect.adjust(-int(rectAdjust), -int(rectAdjust), rectAdjust, rectAdjust);
if (widget)
item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);
drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect)
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index eda5efb..e685694 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -134,15 +134,18 @@ static void qt_init_source(j_decompress_ptr)
static boolean qt_fill_input_buffer(j_decompress_ptr cinfo)
{
my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
+ qint64 num_read = 0;
if (src->memDevice) {
src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos());
- src->bytes_in_buffer = (size_t)(src->memDevice->data().size() - src->memDevice->pos());
- return true;
+ num_read = src->memDevice->data().size() - src->memDevice->pos();
+ src->device->seek(src->memDevice->data().size());
+ } else {
+ src->next_input_byte = src->buffer;
+ num_read = src->device->read((char*)src->buffer, max_buf);
}
- src->next_input_byte = src->buffer;
- int num_read = src->device->read((char*)src->buffer, max_buf);
if (num_read <= 0) {
// Insert a fake EOI marker - as per jpeglib recommendation
+ src->next_input_byte = src->buffer;
src->buffer[0] = (JOCTET) 0xFF;
src->buffer[1] = (JOCTET) JPEG_EOI;
src->bytes_in_buffer = 2;
@@ -183,13 +186,7 @@ static void qt_term_source(j_decompress_ptr cinfo)
{
my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
if (!src->device->isSequential())
- {
- // read() isn't used for memDevice, so seek past everything that was used
- if (src->memDevice)
- src->device->seek(src->device->pos() + (src->memDevice->data().size() - src->memDevice->pos() - src->bytes_in_buffer));
- else
- src->device->seek(src->device->pos() - src->bytes_in_buffer);
- }
+ src->device->seek(src->device->pos() - src->bytes_in_buffer);
}
#if defined(Q_C_CALLBACKS)
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index dd4de99..afae0a5 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -851,7 +851,7 @@ void QWin32PrintEnginePrivate::strokePath_dev(const QPainterPath &path, const QC
HPEN pen = ExtCreatePen(((penWidth == 0) ? PS_COSMETIC : PS_GEOMETRIC)
| PS_SOLID | capStyle | joinStyle,
- penWidth, &brush, 0, 0);
+ (penWidth == 0) ? 1 : penWidth, &brush, 0, 0);
HGDIOBJ old_pen = SelectObject(hdc, pen);
StrokePath(hdc);
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index aa217f6..2347e66 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -866,6 +866,32 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
if (do_vectorpath_cache)
path.makeCacheable();
+ if (!device->format().stencil()) {
+ // If there is no stencil buffer, triangulate the path instead.
+
+ QRectF bbox = path.controlPointRect();
+ // If the path doesn't fit within these limits, it is possible that the triangulation will fail.
+ bool withinLimits = (bbox.left() > -0x8000 * inverseScale)
+ && (bbox.right() < 0x8000 * inverseScale)
+ && (bbox.top() > -0x8000 * inverseScale)
+ && (bbox.bottom() < 0x8000 * inverseScale);
+ if (withinLimits) {
+ QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale));
+
+ QVarLengthArray<float> vertices(polys.vertices.size());
+ for (int i = 0; i < polys.vertices.size(); ++i)
+ vertices[i] = float(inverseScale * polys.vertices.at(i));
+
+ prepareForDraw(currentBrush.isOpaque());
+ setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData());
+ glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.constData());
+ } else {
+ // We can't handle big, concave painter paths with OpenGL without stencil buffer.
+ qWarning("Painter path exceeds +/-32767 pixels.");
+ }
+ return;
+ }
+
// The path is too complicated & needs the stencil technique
vertexCoordinateArray.clear();
vertexCoordinateArray.addPath(path, inverseScale, false);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 9b8a3d1..adbba85 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -324,6 +324,10 @@ void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f,
fboFormat.setStencil(true);
} else if (attachment == QGLFramebufferObject::Depth) {
fboFormat.setDepth(true);
+ fboFormat.setStencil(false);
+ } else {
+ fboFormat.setDepth(false);
+ fboFormat.setStencil(false);
}
GLenum format = f->format().internalTextureFormat();
diff --git a/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg b/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg
new file mode 100644
index 0000000..605e8a8
--- /dev/null
+++ b/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 1acc82f..5536b38 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -63,5 +63,6 @@
<file>images/rect.svgz</file>
<file>images/corrupt.svg</file>
<file>images/corrupt.svgz</file>
+ <file>images/qtbug13653-no_eoi.jpg</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 5b30b04..3bee5d9 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -239,6 +239,7 @@ void tst_QImageReader::readImage_data()
#if defined QTEST_HAVE_JPEG
QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg");
+ QTest::newRow("JPEG: qtbug13653") << QString("qtbug13653-no_eoi.jpg") << true << QByteArray("jpeg");
#endif
#if defined QTEST_HAVE_GIF
QTest::newRow("GIF: earth") << QString("earth.gif") << true << QByteArray("gif");
@@ -1039,6 +1040,7 @@ void tst_QImageReader::readFromDevice_data()
QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg");
QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg");
QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-4") << QString("qtbug13653-no_eoi.jpg") << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif");
@@ -1314,6 +1316,9 @@ void tst_QImageReader::readFromResources_data()
QTest::newRow("YCbCr_rgb.jpg") << QString("YCbCr_rgb.jpg")
<< QByteArray("jpg") << QSize(75, 50)
<< QString("");
+ QTest::newRow("qtbug13653-no_eoi.jpg") << QString("qtbug13653-no_eoi.jpg")
+ << QByteArray("jpg") << QSize(240, 180)
+ << QString("");
#endif
#ifdef QTEST_HAVE_MNG
QTest::newRow("corrupt.mng") << QString("corrupt.mng")