From aa351766d6cecd6cad43cb40596d3ae9166a9647 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 11 Mar 2010 14:03:14 +0100 Subject: Avoid unnecessary memory allocation in the jpeg handler's image detection The handler calls peek with 2 bytes to inspect the first two bytes. Instead of calling the overload of peek() that returns a new QByteArray with just two bytes, allocate 2 bytes on the stack and call the overload of peek() that writes into the specified buffer. Reviewed-by: Joao --- src/plugins/imageformats/jpeg/qjpeghandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 6cb93ad..98bd88f 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -1188,7 +1188,11 @@ bool QJpegHandler::canRead(QIODevice *device) return false; } - return device->peek(2) == "\xFF\xD8"; + char buffer[2]; + if (device->peek(buffer, 2) != 2) + return false; + + return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8; } bool QJpegHandler::read(QImage *image) -- cgit v0.12 From 41bd30db724aa5cb816f6dea2b9fc5fd2cf7351c Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Thu, 11 Mar 2010 16:50:39 +0100 Subject: Minisplitter doesn't paint to the bottom/right The problem is not related to the Splitter handle but related to an optimization in the paintengine. We were comparing if the size of the widget had changed before setting the new mask, which might not be correct. We could have changed the mask without changing the widget size. Task-number: QTCREATORBUG-753 Reviewed-by: Morten Reviewed-by: Samuel --- src/gui/kernel/qwidget_mac.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 5bce17f..bee93b5 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4682,8 +4682,10 @@ void QWidgetPrivate::syncCocoaMask() if (!q->testAttribute(Qt::WA_WState_Created) || !extra) return; - if (extra->hasMask && extra->maskBits.size() != q->size()) { - extra->maskBits = QImage(q->size(), QImage::Format_Mono); + if (extra->hasMask) { + if(extra->maskBits.size() != q->size()) { + extra->maskBits = QImage(q->size(), QImage::Format_Mono); + } extra->maskBits.fill(QColor(Qt::color1).rgba()); extra->maskBits.setNumColors(2); extra->maskBits.setColor(0, QColor(Qt::color0).rgba()); -- cgit v0.12 From 5058983c6ee286ca89598e0fed862f55250db26b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 11 Mar 2010 14:27:03 +0100 Subject: Doc: Removed lie that access to QBuffer is unbuffered. In fact QIODevice still _does_ buffer access through QBuffer currently. Reviewed-by: Markus Goetz Reviewed-by: Joao --- src/corelib/io/qiodevice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 662100a..c93f0c3 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -282,8 +282,7 @@ QIODevicePrivate::~QIODevicePrivate() Certain flags, such as \c Unbuffered and \c Truncate, are meaningless when used with some subclasses. Some of these restrictions are implied by the type of device that is represented - by a subclass; for example, access to a QBuffer is always - unbuffered. In other cases, the restriction may be due to the + by a subclass. In other cases, the restriction may be due to the implementation, or may be imposed by the underlying platform; for example, QTcpSocket does not support \c Unbuffered mode, and limitations in the native API prevent QFile from supporting \c -- cgit v0.12 From 37353a95fd11ec03ccde5c4e85ef2f0a605b85db Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 11 Mar 2010 17:23:21 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 266a6c4f1938dd9edf4a8125faf91c62495e3ce2 ) Changes in WebKit/qt since the last update: [Qt] Avoid double-buffering with Qt image decoders http://trac.webkit.org/changeset/55844 --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 13 +++++++++++++ .../webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 6a2e75f..a2d5f37 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - f3110d2f94c825477afac054ed448e45d47f5670 + 266a6c4f1938dd9edf4a8125faf91c62495e3ce2 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 61c2227..a3f70d3 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-03-11 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Avoid double-buffering with Qt image decoders + + Pass QIODevice::Unbuffered when opening the QBuffer that + wraps the image data, to hint to Qt that no extra buffering + is needed. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::setData): + 2010-01-14 Diego Gonzalez Reviewed by Kenneth Christiansen. diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index b6823dd..9bcb3e9 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -79,7 +79,7 @@ void ImageDecoderQt::setData(SharedBuffer* data, bool allDataReceived) QByteArray imageData = QByteArray::fromRawData(m_data->data(), m_data->size()); m_buffer = new QBuffer; m_buffer->setData(imageData); - m_buffer->open(QBuffer::ReadOnly); + m_buffer->open(QBuffer::ReadOnly | QIODevice::Unbuffered); m_reader = new QImageReader(m_buffer, m_format); } -- cgit v0.12