diff options
author | Liang Qi <liang.qi@qt.io> | 2017-07-06 13:52:42 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-07-06 13:54:25 +0200 |
commit | 7f269a5db8b88fbb14ee741f78e726b1a46c7d4d (patch) | |
tree | fa63387e6f70187e656dd9e6c4f1cd1b1f96c263 /src/gui | |
parent | 9ca3443a37284bedaf74475c26af173b00757178 (diff) | |
parent | 03b4838cb51513bd5d2edf76dccc4bc4a1181681 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
.qmake.conf
Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/configure.json | 4 | ||||
-rw-r--r-- | src/gui/image/qbmphandler.cpp | 61 | ||||
-rw-r--r-- | src/gui/image/qbmphandler_p.h | 15 |
3 files changed, 37 insertions, 43 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json index 5e85d341dd..62bf02bdbb 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -271,7 +271,7 @@ "label": "XCB Xlib", "test": "qpa/xcb-xlib", "sources": [ - { "type": "pkgConfig", "args": "X11-xcb x11 xcb" }, + { "type": "pkgConfig", "args": "x11-xcb x11 xcb" }, "-lxcb -lX11 -lX11-xcb" ] }, @@ -457,7 +457,7 @@ "features": { "accessibility-atspi-bridge": { "label": "ATSPI Bridge", - "condition": "features.accessibility && features.xcb && features.dbus && config.atspi", + "condition": "features.accessibility && features.xcb && features.dbus && libs.atspi", "output": [ "privateFeature", "feature" ] }, "angle": { diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 324fe01414..4350a5c192 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -114,6 +114,15 @@ static QDataStream &operator>>(QDataStream &s, BMP_INFOHDR &bi) s >> bi.biCompression >> bi.biSizeImage; s >> bi.biXPelsPerMeter >> bi.biYPelsPerMeter; s >> bi.biClrUsed >> bi.biClrImportant; + if (bi.biSize >= BMP_WIN4) { + s >> bi.biRedMask >> bi.biGreenMask >> bi.biBlueMask >> bi.biAlphaMask; + s >> bi.biCSType; + for (int i = 0; i < 9; ++i) + s >> bi.biEndpoints[i]; + s >> bi.biGammaRed >> bi.biGammaGreen >> bi.biGammaBlue; + if (bi.biSize == BMP_WIN5) + s >> bi.biIntent >> bi.biProfileData >> bi.biProfileSize >> bi.biReserved; + } } else { // probably old Windows format qint16 w, h; @@ -219,53 +228,20 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset, int alpha_scale = 0; if (!d->isSequential()) - d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4 ? BMP_WIN : bi.biSize)); // goto start of colormap or masks + d->seek(startpos + BMP_FILEHDR_SIZE + bi.biSize); // goto start of colormap or masks - if (bi.biSize >= BMP_WIN4 || (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32))) { + if (bi.biSize >= BMP_WIN4) { + red_mask = bi.biRedMask; + green_mask = bi.biGreenMask; + blue_mask = bi.biBlueMask; + alpha_mask = bi.biAlphaMask; + } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) return false; if (d->read((char *)&green_mask, sizeof(green_mask)) != sizeof(green_mask)) return false; if (d->read((char *)&blue_mask, sizeof(blue_mask)) != sizeof(blue_mask)) return false; - - // Read BMP v4+ header - if (bi.biSize >= BMP_WIN4) { - int CSType = 0; - int gamma_red = 0; - int gamma_green = 0; - int gamma_blue = 0; - int endpoints[9]; - - if (d->read((char *)&alpha_mask, sizeof(alpha_mask)) != sizeof(alpha_mask)) - return false; - if (d->read((char *)&CSType, sizeof(CSType)) != sizeof(CSType)) - return false; - if (d->read((char *)&endpoints, sizeof(endpoints)) != sizeof(endpoints)) - return false; - if (d->read((char *)&gamma_red, sizeof(gamma_red)) != sizeof(gamma_red)) - return false; - if (d->read((char *)&gamma_green, sizeof(gamma_green)) != sizeof(gamma_green)) - return false; - if (d->read((char *)&gamma_blue, sizeof(gamma_blue)) != sizeof(gamma_blue)) - return false; - - if (bi.biSize == BMP_WIN5) { - qint32 intent = 0; - qint32 profileData = 0; - qint32 profileSize = 0; - qint32 reserved = 0; - - if (d->read((char *)&intent, sizeof(intent)) != sizeof(intent)) - return false; - if (d->read((char *)&profileData, sizeof(profileData)) != sizeof(profileData)) - return false; - if (d->read((char *)&profileSize, sizeof(profileSize)) != sizeof(profileSize)) - return false; - if (d->read((char *)&reserved, sizeof(reserved)) != sizeof(reserved) || reserved != 0) - return false; - } - } } bool transp = (comp == BMP_BITFIELDS) && alpha_mask; @@ -876,7 +852,10 @@ QVariant QBmpHandler::option(ImageOption option) const case 32: case 24: case 16: - format = QImage::Format_RGB32; + if (infoHeader.biCompression == BMP_BITFIELDS && infoHeader.biSize >= BMP_WIN4 && infoHeader.biAlphaMask) + format = QImage::Format_ARGB32; + else + format = QImage::Format_RGB32; break; case 8: case 4: diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h index 3e1fc3d511..56b39dd0f0 100644 --- a/src/gui/image/qbmphandler_p.h +++ b/src/gui/image/qbmphandler_p.h @@ -78,6 +78,21 @@ struct BMP_INFOHDR { // BMP information header qint32 biYPelsPerMeter; // vertical resolution qint32 biClrUsed; // number of colors used qint32 biClrImportant; // number of important colors + // V4: + quint32 biRedMask; + quint32 biGreenMask; + quint32 biBlueMask; + quint32 biAlphaMask; + qint32 biCSType; + qint32 biEndpoints[9]; + qint32 biGammaRed; + qint32 biGammaGreen; + qint32 biGammaBlue; + // V5: + qint32 biIntent; + qint32 biProfileData; + qint32 biProfileSize; + qint32 biReserved; }; // BMP-Handler, which is also able to read and write the DIB |