summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix alpha handling of QImage::setPixelv6.0.3Allan Sandfeld Jensen2021-03-231-2/+9
| | | | | | | | | | It was treated differently depending on format, made it consistently behave the same for all formats (following the behavior of the primary formats). Change-Id: Ie24e19957d076fdf3ebd333074e26ede187489eb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c32cd44d34910cfd42e32537578e4a573138a282)
* And fix handling and test of QImage::fill(uint) as wellAllan Sandfeld Jensen2021-02-251-0/+4
| | | | | | | | | | Only RGB444 and RGB666 were treated slighlty different from the rest, but the test had a few additional mistakes. Change-Id: I4728b4036affedfffce8bca5c1e7be3869344fbe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c2bec047e281d949015ecd27daf2ba2d51b21526) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QImage::fill with semi-transparent QColorAllan Sandfeld Jensen2021-02-121-11/+10
| | | | | | | | | | A few formats were not treating the input QColor correctly. Fixed and added more exhaustive test. Change-Id: I872aeeb45e518f9a34b4ac35642264821f9927f2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 95712c5e5438e4eb5cd205ab4659febf3192137a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Shortcut QImage::convertTo when no conversion is necessaryAllan Sandfeld Jensen2020-12-081-2/+2
| | | | | | | | | Avoids a detach when converting to existing format. Change-Id: I9a4801878ddec295a02f2c88f4a40ec13d513a94 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit cc81aae4b312da40945ddfecb806f4abe6b74048) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QImage::setPixelColor on RGBA64_PremultipliedAllan Sandfeld Jensen2020-12-041-4/+1
| | | | | | | | | QColors were not premultiplied before being set. Change-Id: Id3765b6932a72374ddfd788fae4bb628a4edf0b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 0c19e3f703a7c3fd59e6db8a9d4ac7091674b552) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Protect QImage colorspace transform on shutdownAllan Sandfeld Jensen2020-11-071-1/+1
| | | | | | | | Adding a check here similar to fixups in other threaded qimage routines. Pick-to: 5.15 Change-Id: If7bf7aa0ef78cda15171c9038f41b281fb267dae Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add _MSC_VER check to MSVC ARM compiler workaroundMartin Storsjö2020-11-051-2/+2
| | | | | | | | | | | | | | | | While _M_ARM is a MSVC specific builtin define, mingw headers do also define it (in code, as opposed to a compiler built in define), just as the same headers do for e.g. _M_IX86 and _M_X64. This avoids warnings about unrecognized pragmas, when compiling for armv7 mingw. The original compiler bug (from QTBUG-42038) probably already is fixed and/or no longer in scope. Change-Id: I98722e2a7ee1de4f1937a866555ec460f5d898d1 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add an example to the documentation of QImage::scanLine()Mitch Curtis2020-10-121-0/+4
| | | | | | | | | I couldn't find any examples in Qt's documentation of this when I was trying to use it in a project. Pick-to: 5.15 5.12 Change-Id: Ic7b7b71f219b2c1012829980866940b9a77bd11f Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Get rid of some #ifdef qt6Allan Sandfeld Jensen2020-09-301-8/+0
| | | | | | | | | None of this code is even compiled in qt6. Change-Id: I5891cc9459320083ad3908fcbf646f3ba75b8a4d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Preserve formats in QImage::scaled()Allan Sandfeld Jensen2020-09-261-12/+48
| | | | | | | | | Do not always use the smoothScaled routine, the normal routines are also optimized, and do not convert to alpha formats when not necessary. Task-number: QTBUG-49719 Change-Id: I6ee9b620cc259472c419e7363357f41ce29b594a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Create consistent sets of QImage methodsAllan Sandfeld Jensen2020-09-091-4/+37
| | | | | | | Adds consistently named inplace and imperative methods. Change-Id: I8739c1c4585d2ba4aa181bb9a681255d76c120d7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add rgb64 inplace generic conversionAllan Sandfeld Jensen2020-08-281-4/+8
| | | | | | | Can avoid having direct conversions between all high precision formats. Change-Id: I36dd223d028cfda1b6f4116b38ca79cdb7bc5243 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-08-281-2/+2
| | | | | | | | | | | | * Drop deprecation warnings for now-dropped items * Use the 'qt6' define and a new \nothing doc macro to conditionally document items on Qt 6 * Add a custom module header for docs that pulls in also Vulkan headers * Add \internal command for internal classes/functions * Move QtGUI-related code snippets from widgets to gui docs Change-Id: Ieb386b96631a49568d09059906d307c45c01d93a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix a number of qdoc warningsFriedemann Kleint2020-08-201-9/+0
| | | | | | | | | | | - Remove obsolete functions and enumeration values - Remove QObject * parameter from QMetaProperty accessors - Fix renamed enumerations in QSsl - Fix list items to be \li - Fix function signatures and variable names Change-Id: I37c7e6bf2c8ff92bc7b82620bae0a27796f866ab Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove QVariant(int type, void *data, ...) constructorLars Knoll2020-08-151-1/+1
| | | | | | | | It was marked internal anyway. Use the constructor taking a QMetaType instead. Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-1/+1
| | | | | | | | Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-11/+11
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-1/+1
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add more LTTNG tracing pointsJosé Dapena Paz2020-06-111-0/+15
| | | | | | | | | | | | * QImage and QPixmap copy and transform operations. * OpenGL paint engine texture cache texture upload * OpenGL paint engine draw texture Task-number: QTBUG-83347 Pick-to: 5.15 Change-Id: I03150d6ff80cbbcd787133d75854715cb81b5571 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Port QtGui from QStringRef to QStringViewLars Knoll2020-06-111-3/+3
| | | | | | Task-number: QTBUG-84319 Change-Id: I1761096fbcc9421a013cf73f831a2a2ba0c18006 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Do not multithread if already in a global threadpool threadAllan Sandfeld Jensen2020-06-031-3/+4
| | | | | | | | | | This can lead to a deadlock if we block all the worker threads, waiting for the worker threads to finish. Pick-to: 5.15 Fixes: QTBUG-84619 Change-Id: I92b7f96007897d86ece0c34223bab0df4ccbed9a Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Split PixelLayout to separate source fileAllan Sandfeld Jensen2020-05-111-1/+1
| | | | | Change-Id: I0beafa39d92550ea78e78a07b25ce1253cc6668d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove deprecated members from QtGui/image classesVolker Hilsheimer2020-04-291-93/+0
| | | | | | | | Cleaning up those that are trivial to remove because they have direct replacements. Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-271-6/+1
|\ | | | | | | | | | | | | Conflicts: src/corelib/text/qstringliteral.h Change-Id: I1665af3ce537471b249def5e080b39bd4105189e
| * QImage: optimize convertWithPalette()Marc Mutz2020-04-231-6/+1
| | | | | | | | | | | | | | | | | | | | The old code got a QMap serialized as a QString and parsed it to re-create the same map. Just copy the map. Change-Id: Ic71b9fa9d822eab53fe37dfb4d76223cd69ac057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-111-8/+38
|\| | | | | | | Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
| * Multithread some QImage routinesAllan Sandfeld Jensen2020-03-091-8/+38
| | | | | | | | | | | | | | | | Use QThreadPool to process QImage smooth-scaling, format conversions, and colorspace transforms multithreaded. Change-Id: Ic142b1fa899f56e7e5099d36ca713701a47b681b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-031-1/+1
|\| | | | | | | Change-Id: If36d96c0fef3de5ab6503977501c55c62a2ecc97
| * Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-02-281-1/+1
| | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I399b5ea56e9255e775ca1746632f7421519a6616 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Get rid of QMatrixJarek Kobus2020-02-281-60/+0
| | | | | | | | | | | | Task-number: QTBUG-81628 Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Make bytes-per-line safe for int overflowAllan Sandfeld Jensen2020-02-201-11/+19
| | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-02-131-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-041-1/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/widgets/widgets/imageviewer/imageviewer.cpp src/corelib/text/qchar.cpp src/corelib/time/qdatetime.cpp Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
| | * Doc: Update out dated QImage::constScanLine documentationJoni Poikelin2020-01-301-1/+3
| | | | | | | | | | | | | | | Change-Id: I0c09a9a6168422c7e41ded289a3e5ba39b84b0ee Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devSimon Hausmann2020-01-281-0/+12
|\| | | | | | | | | | | Change-Id: Ia5727ce68001bcaab467f5fae3a4933d1217015f
| * | Deprecate all methods that use QMatrixJarek Kobus2020-01-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use QMatrix in implementation classes anymore. Task-number: QTBUG-46653 Fixes: QTBUG-81627 Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-281-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
| * | Doc: Replace some usages of 0/zero/null with \nullptrSze Howe Koh2020-01-271-3/+3
| | | | | | | | | | | | | | | Change-Id: Ibe7de11fc6fc41477c35e7d653c6a911855deabb Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * | Doc/QtGui: replace some 0 with \nullptrChristian Ehrlicher2020-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is \nullptr' and 'are \nullptr' Change-Id: Ic18d0c8bcf64159b4c8fae8c9499839954a98884 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
| * | Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-01-071-66/+29
|\| | | | | | | | | | | Change-Id: Ia2ce994c42adc010c453edaeea57f672556958f6
| * | Modernize setAlphaChannel(), and deprecated alphaChannel()Allan Sandfeld Jensen2020-01-051-66/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two methods have been marked obsolete for a very long time, setAlphaChannel() is still convenient though, so this patch modernizes it and removes obsolete from the API, while marking QImage::alphaChannel() as deprecated. They don't work as getter and setter anyway, since setAlphaChannel() actually does an alpha composition. Change-Id: I634d6463f78c42bb9c5fa3df17500ec01bfcac33 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | | Basic QImage cleanupAllan Sandfeld Jensen2019-12-181-155/+0
|/ / | | | | | | | | | | | | Remove deprecated methods and do marked TODOs for Qt6. Change-Id: I905743cf909776c6433616b3a7c3b544d75f2afe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-23/+23
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-3/+3
|/ | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix accuracy of ARGB32->A2RGB30 conversionsAllan Sandfeld Jensen2019-11-071-22/+3
| | | | | | | | | | | | | It was converted over ARGB32PM, when it should have been directly converted to not lose accuracy, instead there was an unnecessary direct ARGB32->RGB30 conversion, which was converted to the necessary type. This also improves the selection of conversion over ARGB32PM or RGBA64PM for ARGB32 and RGBA8888 by using 32-bit conversion when alpha is not relevant. Change-Id: I5990d8a23b2909d3910d8c1213fa46477742b052 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix: confusion in QImage paintEngine creation on shared imagesEirik Aavitsland2019-10-241-3/+3
| | | | | | | | | | | | During the creation of a raster paint engine in QImage::paintEngine(), the QImage will be detached. At least old gcc versions would get confused so that the newly created paintengine would end up in the old QImage copy insteads of the newly detached one. Work around by dropping the temporary engine pointer. Fixes: QTBUG-79383 Change-Id: I27b1f24312269bc2bcc641dc4334397a92e3bfbb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Combine BGR30_to_RGB30 and BGR888_to_RGB888Allan Sandfeld Jensen2019-09-051-1/+1
| | | | | | | And let the meat of the function be shared with the rbSwap routine. Change-Id: I0ea18b30c26ff050c17dcb3ad4d654bfbb8c6221 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Simplify QColorSpace named presetsTor Arne Vestbø2019-09-031-1/+1
| | | | | | | | | | | | | | We don't need a getter for the 'preset' of a color-space, as color spaces can be compared to the presets directly. This allows us to remove the Undefined and Unknown values from the presets. Internally we still distinguish known presets from unknown or undefined presets via the magic 0-value. The validity of a QColorSpace is not based on this preset, but on its actual values. Fixes: QTBUG-77963 Change-Id: I1e0a2a4be83021b8c82b3c778019f680fd46455b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Introduce QImage::Format_BGR888Allan Sandfeld Jensen2019-08-231-0/+15
| | | | | | | | | Is pretty common on some architectures so we can avoid swizzling by supporting it. Fixes: QTBUG-45671 Change-Id: Ic7a21b5bfb374bf7496fd2b2b1252c2f1ed47705 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>