diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-22 11:08:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-22 21:19:57 +0200 |
commit | 28628a5d5e6c55512759ceafc644aa31e444b781 (patch) | |
tree | 221d1ab0995afe0d441f1ddb433aee985f6d41ea /src/gui | |
parent | cbb2ba23e203374132e4b134b1c8f1a3626d2378 (diff) | |
parent | 686c44a69b13f6e884dd2b6d9991f4cd94597c5a (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/plugins/platforms/eglfs/qeglfshooks.cpp
Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qclipboard.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qsurfaceformat.cpp | 12 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 13 | ||||
-rw-r--r-- | src/gui/painting/qpdf_p.h | 2 | ||||
-rw-r--r-- | src/gui/text/qcssparser.cpp | 9 |
6 files changed, 30 insertions, 15 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index bb0b76d55f..2c3a20870e 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -911,12 +911,12 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers const int dest_pad = (dst_bytes_per_line >> 1) - width; quint16 colorTableRGB16[256]; - if (data->colortable.isEmpty()) { + const int tableSize = data->colortable.size(); + if (tableSize == 0) { for (int i = 0; i < 256; ++i) colorTableRGB16[i] = qConvertRgb32To16(qRgb(i, i, i)); } else { // 1) convert the existing colors to RGB16 - const int tableSize = data->colortable.size(); for (int i = 0; i < tableSize; ++i) colorTableRGB16[i] = qConvertRgb32To16(data->colortable.at(i)); data->colortable = QVector<QRgb>(); diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index bb3895c2f5..cf98bba54c 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -425,8 +425,9 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode) /*! \fn QMimeData *QClipboard::mimeData(Mode mode) const - Returns a reference to a QMimeData representation of the current - clipboard data. + Returns a pointer to a QMimeData representation of the current + clipboard data (can be NULL if the given \a mode is not + supported by the platform). The \a mode argument is used to control which part of the system clipboard is used. If \a mode is QClipboard::Clipboard, the diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index dd742b6007..000d727380 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -42,6 +42,7 @@ #include <QtCore/qatomic.h> #include <QtCore/QDebug> #include <QOpenGLContext> +#include <QtGui/qguiapplication.h> #ifdef major #undef major @@ -763,10 +764,13 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format) void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format) { #ifndef QT_NO_OPENGL - QOpenGLContext *globalContext = QOpenGLContext::globalShareContext(); - if (globalContext && globalContext->isValid()) { - qWarning("Warning: Setting a new default format with a different version or profile after " - "the global shared context is created may cause issues with context sharing."); + if (qApp) { + QOpenGLContext *globalContext = QOpenGLContext::globalShareContext(); + if (globalContext && globalContext->isValid()) { + qWarning("Warning: Setting a new default format with a different version or profile " + "after the global shared context is created may cause issues with context " + "sharing."); + } } #endif *qt_default_surface_format() = format; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index d568dca6b9..13dc7f7dd9 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1925,7 +1925,7 @@ int QPdfEnginePrivate::writeCompressed(const char *src, int len) } int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth, - int maskObject, int softMaskObject, bool dct) + int maskObject, int softMaskObject, bool dct, bool isMono) { int image = addXrefEntry(-1); xprintf("<<\n" @@ -1935,8 +1935,13 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, "/Height %d\n", width, height); if (depth == 1) { - xprintf("/ImageMask true\n" - "/Decode [1 0]\n"); + if (!isMono) { + xprintf("/ImageMask true\n" + "/Decode [1 0]\n"); + } else { + xprintf("/BitsPerComponent 1\n" + "/ColorSpace /DeviceGray\n"); + } } else { xprintf("/BitsPerComponent 8\n" "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray"); @@ -2454,7 +2459,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n memcpy(rawdata, image.constScanLine(y), bytesPerLine); rawdata += bytesPerLine; } - object = writeImage(data, w, h, d, 0, 0); + object = writeImage(data, w, h, d, 0, 0, false, is_monochrome(img.colorTable())); } else { QByteArray softMaskData; bool dct = false; diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index ef41f1efc1..9f782b019c 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -295,7 +295,7 @@ private: int streampos; int writeImage(const QByteArray &data, int width, int height, int depth, - int maskObject, int softMaskObject, bool dct = false); + int maskObject, int softMaskObject, bool dct = false, bool isMono = false); void writePage(); int addXrefEntry(int object, bool printostr = true); diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 966ab3fcdb..a7a8918703 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -746,8 +746,9 @@ static ColorData parseColorValue(QCss::Value v) QVector<QCss::Value> colorDigits; if (!p.parseExpr(&colorDigits)) return ColorData(); + const int tokenCount = colorDigits.count(); - for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) { + for (int i = 0; i < qMin(tokenCount, 7); i += 2) { if (colorDigits.at(i).type == Value::Percentage) { colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); colorDigits[i].type = Value::Number; @@ -756,11 +757,15 @@ static ColorData parseColorValue(QCss::Value v) } } + + if (tokenCount < 5) + return ColorData(); + int v1 = colorDigits.at(0).variant.toInt(); int v2 = colorDigits.at(2).variant.toInt(); int v3 = colorDigits.at(4).variant.toInt(); int alpha = 255; - if (colorDigits.count() >= 7) { + if (tokenCount >= 7) { int alphaValue = colorDigits.at(6).variant.toInt(); if (rgba && alphaValue <= 1) alpha = colorDigits.at(6).variant.toReal() * 255.; |