summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats
Commit message (Collapse)AuthorAgeFilesLines
* Port QImage::Format_CMYK32 to CMYK8888Giuseppe D'Angelo2024-04-041-4/+4
| | | | | | | | | | | | Follow the established convention that byte-oriented image formats have the "8888" suffix, not "32". The old enum name is temporarily left to help port other submodules. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I4b6f10cb22312b614cb9cf4b0ac439907276c538 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* JPEG plugin: CMYK code tidiesGiuseppe D'Angelo2024-04-031-11/+0
| | | | | | | | | | Remove unused code. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I3db7705b3963d7a7669f8c9b284d3d35a2a7da92 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add support for CMYK file I/O in JPEGGiuseppe D'Angelo2024-04-031-10/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JPEG part 6 defines CMYK support. This commit adds such support to the JPEG plugin. A *very* interesting discovery is the fact that Photoshop inverts the meaning of the CMYK color channels when saving into JPEG: 0 means "full ink", and 255 means "no ink". Most other image viewers/editors follow the same interpretation, I imagine for compatibility. But others, like Adobe Reader, don't (???) -- a PDF expects a DCT encoding with 0 meaning "no ink". I am adding a SubType to the image I/O handler to let the user choose what they want, defaulting to Photoshop behavior. Also, turns out that Qt was already loading CMYK files and converting them to RGB. I don't think we should do automatic, lossy conversions (we were not taking into account an eventual colorspace...), so I'm changing that loading to yield a CMYK QImage. Finally: save the colorspace, even if it's a CMYK image. QColorSpace doesn't support anything but RGB matrix-based colorspaces. Yet, it can load an arbitrary ICC profile, and will store it even if it's unable to use it. We can use this fact to preserve the colorspace embedded in CMYK images, or let users set an arbitrary ICC profile on them through Qt APIs, and then saving the result in JPEG. [ChangeLog][QtGui][JPEG] Added support for loading and saving of JPEG files in 8-bit CMYK format. When loading a CMYK JPEG file, Qt used to convert it automatically to a RGB image; now instead it's kept as-is. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Ibdbfa16aa35814f5dba28c2df89577175162b731 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtIcoHandler::canRead(): avoid checking more than onceShawn Rutledge2024-02-092-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtIcoHandler::canRead() calls ICOReader::canRead(), which assumes that QIODevice::pos() is at the position where the .ico data starts (i.e. pos() == 0 if this is a separate .ico file). But if an AnimatedImage in Qt Quick opens an .ico file, canRead() gets called multiple times: the first is when QQuickAnimatedImage::frameCount() eventually results in QImageReaderPrivate::initHandler(); then ICOReader::readHeader() is called, which moves the file position. The second time is when QQuickAnimatedImage calls QMovie::isValid(). At that time, QIODevice::pos() == 6: we need to avoid calling ICOReader::canRead() because it's no longer at the start of the data. Without this change, AnimatedImage reports "Error Reading Animated Image File" and doesn't show anything. The fix is to store the known-good state, the same way that QTiffHandler::canRead() returns true if its d->tiff already exists (TIFFClientOpen() succeeded). The test checks that it's ok to call QMovie::frameCount() first and then QMovie::isValid(). Calling frameCount() has the effect of moving QIODevice::pos(). Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-117429 Change-Id: Ie3a5225f2cea9a0d76d685e83ce4d4a10cbe9188 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix transparency in 16 bit and 24 bit ico filesJohn Chadwick2023-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | As a result of the fix for QTBUG-75214, Qt inadvertently no longer reads the AND mask that specifies transparency for 16-bit and 24-bit ico files. This is because it tries to detect 32-bit icons by checking icoAttrib.depth == 32, but icoAttrib.depth is set to the depth of the QImage, not the depth of the icon, and 32-bit QImage is used for all of the non-indexed cases (16-bit, 24-bit and 32-bit.) This commit instead uses icoAttrib.nbits, which should reliably determine whether or not the icon is 32-bit. This makes the behavior consistent with other ico reading software, including Windows. Also, adds a unit test that verifies correct behavior of icon masks, checking for both QTBUG-75214 and QTBUG-113319. Amends 1d128ed1dfbcf49453ada922e54381c37264fde5. Fixes: QTBUG-113319 Change-Id: I89ac86ff16054c8925fff6afc8c530fa737f8385 Pick-to: 6.6 6.5 6.2 5.15 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Utilize NO_UNITY_BUILD arguments instead of manual exclusionAmir Masoud Abdol2023-03-141-2/+1
| | | | | | | | | | | Unity build is disabled by default for all 3rdparty libraries, so we don't need to set the manually anymore; and for the plugins we can use NO_UNITY_BUILD instead. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ia2f83ae083924d31adf07e7647b34ae6571ed01f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add some exclusions for CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-161-0/+2
| | | | | | | | | | | | | Add exclusions for issues that are likely not fixable (3rd party code, X11 define clashes, etc) in 3rd party, tools and plugins. Pick-to: 6.5 Task-number: QTBUG-109394 Done-with: Amir Masoud Abdol <amir.abdol@qt.io> Change-Id: I698c004201a76a48389271c130e44fba20f5adf7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* src: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-104-17/+3
| | | | | | Pick-to: 6.5 Change-Id: Id644d322a602038403bb7f46c532744575fbf6d3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* jpeg handler: log error message on fatal errorIlya Fedin2023-01-311-0/+1
| | | | | | | | | | | Original libjpeg's handler has output_message call. As Qt doesn't have it, it logs non-fatal error, but skips the fatal ones which are likely more important to be logged than the non-fatal ones. Pick-to: 6.5 Change-Id: Iebb94db4d56705322e7569445d240ca4a7ed8f4a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* jpeg handler: store Grayscale16 format images as grayscale, not rgbEirik Aavitsland2022-10-221-0/+7
| | | | | | | | | | No point in storing multiple channels when we have single channel data. And as jpeg anyway has only 8 bpc, information loss is unavoidable, so just convert to Grayscale8 and store as that. Fixes: QTBUG-107810 Change-Id: Ib62038acf07d4b875b8416825fb0095510c14b5b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-043-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-234-4/+4
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-034-0/+12
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-169-352/+18
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* plugins: image formats - fix odr violationTim Blechmann2022-05-061-0/+4
| | | | | | | | | | | | | | | | | | | | When linking Qt statically, the image fomats are not separated into different DSOs. when linking them into the same target, gcc warns about an ODR violation between icohandler and bmphandler: ``` /usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:69:8: warning: type ‘struct BMP_INFOHDR’ violates the C++ One Definition Rule [-Wodr] /usr/src/debug/qtbase/6.3.0-r0/git/src/plugins/imageformats/ico/qicohandler.cpp:98: note: a different type is defined in another translation unit /usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:70:13: note: the first difference of corresponding definitions is field ‘biSize’ /usr/src/debug/qtbase/6.3.0-r0/git/src/plugins/imageformats/ico/qicohandler.cpp:87: note: a field of same name but different type is defined in another translation unit /usr/src/debug/qtbase/6.3.0-r0/build/include/QtGui/6.3.0/QtGui/private/../../../../../../git/src/gui/image/qbmphandler_p.h:69:8: note: type ‘qint32’ should match type ‘struct quint32_le’ ``` we therefore wrap the `BMP_INFOHDR` into an anonymous namespace Change-Id: I0e6ee66dd09ebda0c3e399738b5c172a57beb8f4 Pick-to: 5.15 6.2 6.3 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Image Plugins: includemocs(-ish)Marc Mutz2022-04-289-186/+47
| | | | | | | | | | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. The result of the automated script is no good here, because these plugins all use the same anti-pattern of defining the plugin class in a header, main.h, which doesn't have include guards. Included moc files therefore lead to redefiniton errors. Fix by inlining the main.h's into the respective main.cpp's and including main.moc's instead. Task-number: QTBUG-102886 Pick-to: 6.3 6.2 5.15 Change-Id: I6d3ec5590d13d9b7a4cedd5f1b4d3331e6916655 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Jpeg handler: Detangle error reporting from the abort handlingEirik Aavitsland2022-03-221-7/+7
| | | | | | | | | | | | | | If libjpeg has detected a fatal error, wait until after the longjmp to report the error using qCWarning(), as some compilers don't like that happening before the stack has been restored. Also avoids code duplication. Fixes: QTBUG-100821 Pick-to: 6.3 6.2 Change-Id: I8d0e6e1bcc4f2a85dae06b3879453ee9077288c0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
* png/ico decoder: Don't try reading beyond the fileRobert Löhning2022-03-021-2/+4
| | | | | | | | | This fixes oss-fuzz issue 44955. Pick-to: 6.2 6.3 Change-Id: Ie74ae037630f83e64fd0678ff2eac579f35d02b8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Install 3rdparty headers for static buildsMichal Klocek2022-02-191-84/+2
| | | | | | | | | | | | | | | | | | | | | | | | | For static builds we need 3rdparty headers to be installed. Leaf modules like qtwebengine needs 3rdparty libs and header for zlib, freetype, harfbuzz, png, jpeg. Without those the Chromium bundled versions are used, however it might end up badly if qt has already bundled one. Introduce new header only modules with additional arguments for qt_internal_add_module: * EXTERNAL_HEADERS to pick exactly which headers are public * EXTERNAL_HEADERS_DIR to include whole directory preserving the files directory structure Fix qtsync so it keep directory structure for all non-qt modules when syncing headers and do not generate warnings for headers files. Task-number: QTBUG-87154 Task-number: QTBUG-88614 Change-Id: If1c27bf8608791cd4e0a21839d6316a445a96e9f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtGui & its plugins: remove set-but-unused variablesThiago Macieira2021-10-191-2/+0
| | | | | | | | | Found by clang 13: qfontsubset.cpp:1211:10: warning: variable 'sumAdvances' set but not used [-Wunused-but-set-variable] Change-Id: Iea05060bc2c046928536fffd16adf500fb9bc8e5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-063-3/+3
| | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't give plugins PUBLIC usage requirements part 2Alexandru Croitor2021-07-151-1/+1
| | | | | | | | | | | | | Plugins shouldn't have public usage requirements. Amends 434ada8dcb6132b3a597ea56b57a66c627f51728 Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: Iffb3def07ea428b1c3c5b9873e259a4d5168b7a1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Simplify bundled libjpeg buildEirik Aavitsland2021-05-051-1/+0
| | | | | | | | | | | | Move the config headers of the bundled libjpeg back into its source directory, where they originally live, to avoid having to trick with the include path to find them. The goal is unification across maintained Qt branches, making version updates simpler. Pick-to: 6.1 6.0 5.15 5.12 Change-Id: I5b574446bbd264b0a1cb3efceb4c1cb7203cac7d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Fix build of QJpegPlugin in static Windows build with PCHAlexandru Croitor2021-04-211-0/+7
| | | | | | | | | | | | | | | | | | | Fails with C:\Dev\qt\src\qtbase\src\3rdparty\libjpeg\src\jmorecfg.h(242): error C2371: 'boolean': redefinition; different basic types C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\rpcndr.h(193): note: see declaration of 'boolean' Don't use the precompiled header for the plugin source file. Amends f641a0dbcfd52e78e068357d9c66236798e043e8 Pick-to: 6.1 Task-number: QTBUG-88093 Change-Id: I6a57f791139d866622f7406fec45c11be6b86418 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix build of jpeg plugin against recent jpeg-turbo on MinGWJoerg Bornemann2021-04-161-7/+0
| | | | | | | | | | | | Remove the MinGW-related hack that was introduced in ec31953007126a6e0f9f3ca16b64bdfdcdf3d7b6. It doesn't seem to be needed anymore with recent MinGW versions and prevents using a system jpeglib that disagrees in its jboolean declaration with our bundled jpeglib. Fixes: QTBUG-88093 Change-Id: Ic6eb03b4b395fe3e8dcedf52489e8642289fc98e Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* cmake: Don't give plugins PUBLIC usage requirementsCraig Scott2021-02-243-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Pick-to: 6.1 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove .prev_CMakeLists.txt filesJoerg Bornemann2021-01-123-133/+0
| | | | | | | | | | Those serve no purpose anymore, now that the .pro files are gone. Task-number: QTBUG-88742 Change-Id: I39943327b8c9871785b58e9973e4e7602371793e Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-074-44/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-7/+7
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Add logging categories to image handlersAllan Sandfeld Jensen2020-09-303-7/+17
| | | | | Change-Id: Ia0c47826d08b3f641c17d8a585f62d008a8b095b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-232-6/+6
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate projectsAlexandru Croitor2020-09-222-0/+10
| | | | | | | | | Clean up the state of the projects, before changing the internal CMake API function names. Task-number: QTBUG-86815 Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Gif decoder: fix read error caused by ub checkEirik Aavitsland2020-09-181-5/+7
| | | | | | | | | | | The recently added check to avoid negative-bitshift ub ignored that the algorithm will sometimes use a negative bitcount value as a flag. This caused reading failure for some frames. Pick-to: 5.15 5.12 Fixes: QTBUG-86702 Change-Id: I4c247a7eb6102f9b51cc8ac708c60db80d609e38 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change QByteArray to handle large arraysLars Knoll2020-08-271-1/+1
| | | | | | | | | | Use qsizetype throughout. Change-Id: I787af7fcfa17e1be87decb64c41c609cc24be117 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* cmake: Slience bening warnings in 3rdparty codeTor Arne Vestbø2020-07-201-0/+8
| | | | | Change-Id: I1a47695abd6d6ea1527e2803dde0ed29aca014cc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix gif parsing error for large imagesTang HaiXiang2020-07-141-2/+2
| | | | | | | | | | | | | | A very large GIF image resulted in cropping of image updates, due to the handler trying to protect against very large values. Increase that size from 200 to 16384, which is also the value used in the withinSizeLimit method. Fixes: QTBUG-85340 Pick-to: 5.15 Change-Id: I70888d76b378ee4f49694e90d7d753fae817ff2a Reviewed-by: Lu YaNing <luyaning@uniontech.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVector in pluginsJarek Kobus2020-07-064-15/+15
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QImageIO: use the new allocation checker in the format handlersEirik Aavitsland2020-06-263-11/+11
| | | | | | Change-Id: I604d99ce476d4758a1e20b78257082911f1f1546 Task-number: QTBUG-85037 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make it possible to avoid loading comments from JPEG and PNG filesElvis Lee2020-06-111-0/+2
| | | | | | | | | | | | Skip reading JPEG and PNG comments information from the header to save the memory. This can now be configured through the feature system. Change-Id: I3744312f69aa3201d5188776cbd99fe690b75d32 Task-number: QTBUG-83123 Pick-to: 5.15 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Gif decoder: Harden handling of corrupt filesEirik Aavitsland2020-06-091-2/+5
| | | | | | | | Fix potential UB for corrupt files. Pick-to: 5.15 5.12 Change-Id: If5d1b859a03b09e3479a6a7adaaf3432958126b4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove winrtOliver Wolff2020-06-062-12/+2
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* gif image handler: check for out of range image sizeEirik Aavitsland2020-05-301-0/+13
| | | | | | | | | Make the decoder fail early to avoid spending time and memory on attempting to decode a corrupt image file. Pick-to: 5.15 5.12 5.9 Change-Id: Ic556d4fbcb6b542fc110d10e48dac1a880e60697 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* bmp/ico decoder: fail early for unsupported bit depthsEirik Aavitsland2020-05-301-1/+5
| | | | | | | | | | All the normal bit depths are supported, so no point in trying to go through the decoding code path for others. Avoids wide bitshift warning for claimed depths > 32. Pick-to: 5.15 5.12 Change-Id: I61b72dbbf9558ca28db46f8168339f8174e56997 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Gif decoder: avoid undefined values in enumEirik Aavitsland2020-05-301-1/+2
| | | | | | | | | The gif standard allocates 3 bits for the disposal method, but values 4-7 are unused. Pick-to: 5.15 5.12 Change-Id: I0f70b3f87b4cd8e98140c3da476702a22ebe93a9 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* CMake: Regenerate projects to match updated plugin APILeander Beernaert2020-04-276-8/+7
| | | | | Change-Id: Iafe0a953e74d7f36ec48fa075b3725dd6466c5e3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-046-37/+0
|\ | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * Remove overrides of QImageIOHandler::name()Shawn Rutledge2020-03-036-37/+0
| | | | | | | | | | | | | | | | | | We will remove the virtual base class function in Qt 6. For now, name() returns format(). Change-Id: I1597e823b859e4db148b3e5ac0f1c15350a582eb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | CMake: Allow building bundled 3rd party libraries in qtbaseAlexandru Croitor2020-02-252-2/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few things are needed to accomplish that: - the python scripts do not ignore certain system_foo features anymore (it is a hardcoded list for now just to be safe) - configurejson2cmake now outputs qt_find_package(WrapSystemFoo) calls for bundled libraries (see below) - the harfbuzz .pro file is modified to accommodate pro2cmake not being able to correctly parse some conditional scopes - the freetype .pro file is modified to make sure linking of the library succeeds without duplicate symbol errors, which qmake doesn't encounter due to magical exclusion of cpp files that are included in other cpp files (presumably for include moc_foo.cpp support) - feature evaluation for Core, Gui, Network now happens in the qtbase/src directory, so that bundled libraries can be conditionally built - for each bundled library there are now two FindWrap scripts: - FindWrapSystemFoo which finds an installed library in the system - FindWrapFoo which either uses the system installed library or the built bundled one depending on a condition - projects that intend to use bundled libraries need to link against WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets (this is handled by pro2cmake). Unfortunately manually added qt_find_package(WrapFoo) calls might still be needed as is the case for WrapFreetype and others. - a new cmake/QtFindWrapHelper.cmake file is added that provides a macro to simplify creation of WrapFoo targets that link against a bundled or system library. The implementation is fairly ugly due to CMake macro constraints, but it was deemed better than copy-pasting a bunch of almost identical code across all FindWrapFoo.cmake files. - a qtzlib header-only module is now created when using bundled zlib, to provide public syncqt created headers for consumers that need them. These are projects that have 'QT_PRIVATE += zlib-private' in their .pro files (e.g. qtimageformats, qtlocation, qt3d, etc.) This is unfortunately needed due to QtNetwork using zlib types in its private C++ API. The change includes support for building the following bundled libraries: - zlib - libpng - libjpeg - Freetype - Harfbuzz-ng - PCRE2 The following 3rd party libraries are still using an old implementation within the CMake build system, and should be migrated to the new one in the near future: - double-conversion - Old harfbuzz The are a few libraries that are not yet ported: - system-sqlite - systemxcb - maybe others Among other things, this change allows building qtbase on Windows without requiring vcpkg. Task-number: QTBUG-82167 Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* | Make bytes-per-line safe for int overflowAllan Sandfeld Jensen2020-02-202-5/+5
| | | | | | | | | | | | | | | | Goes through the Qt code and make sure bytes-per-line calculations are safe when they are too big for 32bit integers. Change-Id: I88b2d74b3da82e91407d316aa932a4a37587c0cf Reviewed-by: Lars Knoll <lars.knoll@qt.io>