diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-03 11:58:17 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-03 11:58:17 (GMT) |
commit | 877505bc0029925598c754d535515ab9b4f027a2 (patch) | |
tree | e018ff3f496a163efd4366a180bbe285f4d4c707 /src/gui | |
parent | a64d3dddfbe22b26fd0d2d1e7387ed7125951109 (diff) | |
parent | 67a02b1c2e73e76604aa24836a768673992e48d3 (diff) | |
download | Qt-877505bc0029925598c754d535515ab9b4f027a2.zip Qt-877505bc0029925598c754d535515ab9b4f027a2.tar.gz Qt-877505bc0029925598c754d535515ab9b4f027a2.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (55 commits)
Fix tst_collections::insert_remove_loop on 32bit
Fix warnings with clang
Add member-swap to shared datatypes that don't have it.
Containers: add member-swap
Fix license headers
Put more platform info in the report headers
QVarLenghtArray: Implement more API from QVector
Fixed index type after reapplying commit 89cbb165.
Reapply "Fixed painter path drawing on FBO without stencil buffer."
Fixes: Reading and writing PNG iTXt international text chunks
Fixes: corruption of whitespace in text fields when reading PNG images
Clean up some comments
Fixes unstability caused by a dangling pointer in GL text rendering
Fix getting git info on Win
Remove historic remains of qt3 testing
Testing auto-rebuild on server
Another change for running on actual server
Preparations for running on actual server
Add OS and git data to PlatformInfo
Revert "Don't define highp/mediump/lowp if desktop GL has them"
...
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qbitmap.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qbitmap.h | 1 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qicon.h | 2 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 1 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpicture.h | 1 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 2 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 82 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qbrush.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qbrush.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpen.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qpen.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.h | 3 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qregion.h | 1 |
23 files changed, 149 insertions, 46 deletions
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index 91622f3..9d90b3f 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -227,6 +227,14 @@ QBitmap::~QBitmap() } /*! + \fn void QBitmap::swap(QBitmap &other) + \since 4.8 + + Swaps bitmap \a other with this bitmap. This operation is very + fast and never fails. +*/ + +/*! Returns the bitmap as a QVariant. */ QBitmap::operator QVariant() const diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index 1bbe1cf..93be951 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -63,6 +63,7 @@ public: ~QBitmap(); QBitmap &operator=(const QPixmap &); + inline void swap(QBitmap &other) { QPixmap::swap(other); } // prevent QBitmap<->QPixmap swaps operator QVariant() const; inline void clear() { fill(Qt::color0); } diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index a2f429a..e54bb5f 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -613,6 +613,14 @@ QIcon &QIcon::operator=(const QIcon &other) } /*! + \fn void QIcon::swap(QIcon &other) + \since 4.8 + + Swaps icon \a other with this icon. This operation is very + fast and never fails. +*/ + +/*! Returns the icon as a QVariant. */ QIcon::operator QVariant() const diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index fd591e6..5091d03 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -75,6 +75,8 @@ public: inline QIcon &operator=(QIcon &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QIcon &other) { qSwap(d, other.d); } + operator QVariant() const; QPixmap pixmap(const QSize &size, Mode mode = Normal, State state = Off) const; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 5829fe8..d86021cb9 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1329,6 +1329,14 @@ QImage &QImage::operator=(const QImage &image) } /*! + \fn void QImage::swap(QImage &other) + \since 4.8 + + Swaps image \a other with this image. This operation is very + fast and never fails. +*/ + +/*! \internal */ int QImage::devType() const diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 003daea..c6a947e 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -144,6 +144,7 @@ public: inline QImage &operator=(QImage &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QImage &other) { qSwap(d, other.d); } bool isNull() const; diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 48d2de3..fc81d23 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1030,6 +1030,14 @@ QPicture& QPicture::operator=(const QPicture &p) } /*! + \fn void QPicture::swap(QPicture &other) + \since 4.8 + + Swaps picture \a other with this picture. This operation is very + fast and never fails. +*/ + +/*! \internal Constructs a QPicturePrivate diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index 49b0fd6..d24f23a 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -85,6 +85,7 @@ public: inline QPicture &operator=(QPicture &&other) { qSwap(d_ptr, other.d_ptr); return *this; } #endif + inline void swap(QPicture &other) { d_ptr.swap(other.d_ptr); } void detach(); bool isDetached() const; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 5383b7c..1b370c0 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -440,6 +440,14 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap) } /*! + \fn void QPixmap::swap(QPixmap &other) + \since 4.8 + + Swaps pixmap \a other with this pixmap. This operation is very + fast and never fails. +*/ + +/*! Returns the pixmap as a QVariant. */ QPixmap::operator QVariant() const diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index e9f9365..15fe5fa 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -87,6 +87,8 @@ public: inline QPixmap &operator=(QPixmap &&other) { qSwap(data, other.data); return *this; } #endif + inline void swap(QPixmap &other) { qSwap(data, other.data); } + operator QVariant() const; bool isNull() const; // ### Qt 5: make inline diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 935aba0..ea62cf8 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -331,6 +331,7 @@ public: float gamma; int quality; QString description; + QStringList readTexts; png_struct *png_ptr; png_info *info_ptr; @@ -389,25 +390,20 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() while (num_text--) { QString key, value; -#if defined(PNG_iTXt_SUPPORTED) && !defined(QT_NO_TEXTCODEC) - if (text_ptr->lang) { - QTextCodec *codec = QTextCodec::codecForName(text_ptr->lang); - if (codec) { - key = codec->toUnicode(text_ptr->lang_key); - value = codec->toUnicode(QByteArray(text_ptr->text, text_ptr->itxt_length)); - } else { - key = QString::fromLatin1(text_ptr->key); - value = QString::fromLatin1(QByteArray(text_ptr->text, int(text_ptr->text_length))); - } + key = QString::fromLatin1(text_ptr->key); +#if defined(PNG_iTXt_SUPPORTED) + if (text_ptr->itxt_length) { + value = QString::fromUtf8(text_ptr->text, int(text_ptr->itxt_length)); } else #endif { - key = QString::fromLatin1(text_ptr->key); value = QString::fromLatin1(QByteArray(text_ptr->text, int(text_ptr->text_length))); } if (!description.isEmpty()) description += QLatin1String("\n\n"); description += key + QLatin1String(": ") + value.simplified(); + readTexts.append(key); + readTexts.append(value); text_ptr++; } #endif @@ -485,25 +481,8 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr)); outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr)); -#ifndef QT_NO_IMAGE_TEXT - png_textp text_ptr; - int num_text=0; - png_get_text(png_ptr,info_ptr,&text_ptr,&num_text); - while (num_text--) { - outImage->setText(text_ptr->key,0,QString::fromAscii(text_ptr->text)); - text_ptr++; - } - - foreach (const QString &pair, description.split(QLatin1String("\n\n"))) { - int index = pair.indexOf(QLatin1Char(':')); - if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) { - outImage->setText(QLatin1String("Description"), pair.simplified()); - } else { - QString key = pair.left(index); - outImage->setText(key, pair.mid(index + 2).simplified()); - } - } -#endif + for (int i = 0; i < readTexts.size()-1; i+=2) + outImage->setText(readTexts.at(i), readTexts.at(i+1)); png_read_end(png_ptr, end_info); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); @@ -634,29 +613,40 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt return; png_textp text_ptr = new png_text[text.size()]; + qMemSet(text_ptr, 0, text.size() * sizeof(png_text)); QMap<QString, QString>::ConstIterator it = text.constBegin(); int i = 0; while (it != text.constEnd()) { - QString t = it.value(); - if (t.length() < 40) - text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE; - else - text_ptr[i].compression = PNG_TEXT_COMPRESSION_zTXt; text_ptr[i].key = qstrdup(it.key().left(79).toLatin1().constData()); + bool noCompress = (it.value().length() < 40); -#ifndef PNG_iTXt_SUPPORTED - QByteArray value = it.value().toLatin1(); - text_ptr[i].text = qstrdup(value.constData()); - text_ptr[i].text_length = value.size(); -#else - QByteArray value = it.value().toUtf8(); - text_ptr[i].text = qstrdup(value.constData()); - text_ptr[i].text_length = 0; - text_ptr[i].itxt_length = value.size(); - text_ptr[i].lang = const_cast<char*>("UTF-8"); - text_ptr[i].lang_key = qstrdup(it.key().toUtf8().constData()); +#ifdef PNG_iTXt_SUPPORTED + bool needsItxt = false; + foreach(const QChar c, it.value()) { + uchar ch = c.cell(); + if (c.row() || (ch < 0x20 && ch != '\n') || (ch > 0x7e && ch < 0xa0)) { + needsItxt = true; + break; + } + } + + if (needsItxt) { + text_ptr[i].compression = noCompress ? PNG_ITXT_COMPRESSION_NONE : PNG_ITXT_COMPRESSION_zTXt; + QByteArray value = it.value().toUtf8(); + text_ptr[i].text = qstrdup(value.constData()); + text_ptr[i].itxt_length = value.size(); + text_ptr[i].lang = const_cast<char*>("UTF-8"); + text_ptr[i].lang_key = qstrdup(it.key().toUtf8().constData()); + } + else #endif + { + text_ptr[i].compression = noCompress ? PNG_TEXT_COMPRESSION_NONE : PNG_TEXT_COMPRESSION_zTXt; + QByteArray value = it.value().toLatin1(); + text_ptr[i].text = qstrdup(value.constData()); + text_ptr[i].text_length = value.size(); + } ++i; ++it; } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e14a9198..b4a360a 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1521,6 +1521,14 @@ QKeySequence &QKeySequence::operator=(const QKeySequence &other) } /*! + \fn void QKeySequence::swap(QKeySequence &other) + \since 4.8 + + Swaps key sequence \a other with this key sequence. This operation is very + fast and never fails. +*/ + +/*! \fn bool QKeySequence::operator!=(const QKeySequence &other) const Returns true if this key sequence is not equal to the \a other diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index b47873d..a2352eb 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -183,6 +183,7 @@ public: inline QKeySequence &operator=(QKeySequence &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QKeySequence &other) { qSwap(d, other.d); } bool operator==(const QKeySequence &other) const; inline bool operator!= (const QKeySequence &other) const { return !(*this == other); } diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d0788c7..5b35fc5 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -635,6 +635,15 @@ QBrush &QBrush::operator=(const QBrush &b) return *this; } + +/*! + \fn void QBrush::swap(QBrush &other) + \since 4.8 + + Swaps brush \a other with this brush. This operation is very + fast and never fails. +*/ + /*! Returns the brush as a QVariant */ diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index efc720b..f9acded 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -96,6 +96,8 @@ public: inline QBrush &operator=(QBrush &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QBrush &other) { qSwap(d, other.d); } + operator QVariant() const; inline Qt::BrushStyle style() const; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ffd0d5c..7d6ea12 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -576,6 +576,14 @@ QPainterPath &QPainterPath::operator=(const QPainterPath &other) } /*! + \fn void QPainterPath::swap(QPainterPath &other) + \since 4.8 + + Swaps painter path \a other with this painter path. This operation is very + fast and never fails. +*/ + +/*! Destroys this QPainterPath object. */ QPainterPath::~QPainterPath() diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 9a7b60a..82facf8 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -100,6 +100,7 @@ public: { qSwap(d_ptr, other.d_ptr); return *this; } #endif ~QPainterPath(); + inline void swap(QPainterPath &other) { d_ptr.swap(other.d_ptr); } void closeSubpath(); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 2e43984..0137763 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -383,6 +383,14 @@ QPen &QPen::operator=(const QPen &p) } /*! + \fn void QPen::swap(QPen &other) + \since 4.8 + + Swaps pen \a other with this pen. This operation is very + fast and never fails. +*/ + +/*! Returns the pen as a QVariant. */ QPen::operator QVariant() const diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index 4006112..a7b946c 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -78,6 +78,7 @@ public: inline QPen &operator=(QPen &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QPen &other) { qSwap(d, other.d); } Qt::PenStyle style() const; void setStyle(Qt::PenStyle); diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 2fb52b5..83323d0 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -700,6 +700,22 @@ QPolygon QPolygonF::toPolygon() const } /*! + \fn void QPolygon::swap(QPolygon &other) + \since 4.8 + + Swaps polygon \a other with this polygon. This operation is very + fast and never fails. +*/ + +/*! + \fn void QPolygonF::swap(QPolygonF &other) + \since 4.8 + + Swaps polygon \a other with this polygon. This operation is very + fast and never fails. +*/ + +/*! Returns the polygon as a QVariant */ QPolygon::operator QVariant() const diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 7a49e29..5baffc8 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -67,6 +67,8 @@ public: inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {} QPolygon(const QRect &r, bool closed=false); QPolygon(int nPoints, const int *points); + inline void swap(QPolygon &other) { QVector<QPoint>::swap(other); } // prevent QVector<QPoint><->QPolygon swaps + operator QVariant() const; void translate(int dx, int dy); @@ -139,6 +141,7 @@ public: inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {} QPolygonF(const QRectF &r); QPolygonF(const QPolygon &a); + inline void swap(QPolygonF &other) { QVector<QPointF>::swap(other); } // prevent QVector<QPointF><->QPolygonF swaps inline void translate(qreal dx, qreal dy); void translate(const QPointF &offset); diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index c5d5dc9..cd997f4 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -391,6 +391,14 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt */ /*! + \fn void QRegion::swap(QRegion &other) + \since 4.8 + + Swaps region \a other with this region. This operation is very + fast and never fails. +*/ + +/*! \relates QRegion Writes the region \a r to the stream \a s and returns a reference diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 91d82e0..50052b3 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -85,6 +85,7 @@ public: inline QRegion &operator=(QRegion &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QRegion &other) { qSwap(d, other.d); } #ifdef QT3_SUPPORT inline QT3_SUPPORT bool isNull() const { return isEmpty(); } #endif |