summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qcolormatrix_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QColorVector: make the (QPointF) ctor a named oneMarc Mutz2024-04-181-7/+4
| | | | | | | | | | | | | | | | | | | | Instead of an explicit ctor, make conversion from QPointF an explicitly-named ctor. This prepares the class for being converted to a pure struct, alleviating its use in arrays without the additional QUninitialized kludge that Coverity doesn't seem to understand. Amends 78a7e54f8f5c4ca6ce1ee6b0ac82c42b21738ac5. As a drive-by, take the QPointF by value, fixing clazy-function-args-by-value. Coverity-Id: 444249 Coverity-Id: 425860 Change-Id: I925e94b21bf041a6fb03c56ef9a2da85d8285982 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add CMYK support to QColorSpaceAllan Sandfeld Jensen2024-04-121-11/+12
| | | | | | | | [ChangeLog][QtGui][QColorSpace] Support for CMYK color spaces has been added. Change-Id: I2c684dbeee8b97fc90ca4e2a892349a7fa465d06 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add color space model, making gray color spaces explicitAllan Sandfeld Jensen2024-04-051-0/+34
| | | | | | | | | This also adds image conversion of both format and color space, which will also be required later for conversions to CMYK formats and color spaces. Change-Id: I578c0a010ffcdb4df4cf9080c0621fac8bc342bf Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Use properly-aligned float[4] as _mm_store_ps() output bufferMarc Mutz2024-04-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... not a QColorVector. While cccda0e62d3d70f09654bbd6681a3e79c9814c8d, successfully worked around the problem that QColorVector does not fulfill the _mm_store_ps() function's alignment requirement (by using the unaligned version, _mm_storeu_ps()), it failed to address the problem that the code writes into a QColorVector object's member variable (float, a 32-bit storage location) when the function is asking for a 128-bit storage: /// Stores a 128-bit vector of [4 x float] into an aligned memory /// location. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction. /// /// \param __p /// A pointer to a 128-bit memory location. The address of the memory /// location has to be 16-byte aligned. /// \param __a /// A 128-bit vector of [4 x float] containing the values to be stored. The treatment of a struct { float x, y, z, w; } as a float[4] is not allowed by C++, and even if it was, we'd have to pass the address of the struct object, not that of its first member variable. It seems like Coverity has recently learned about this kind of thing, at least there are tons of such new issues listed in the March scan and while I can't find a report about this particular instance in the current build, that probably just means that the Coverity build simply doesn't see this code path due to the #ifdef'ery. To fix, replace the QColorVector with an over-aligned float[4]. Because we're over-aligning the float[4], we can go back to the original _mm_store_ps(), which is, presumably, faster then the -u variant. We don't lose any expressiveness here, either, because the old code never used any of the member functions of the QColorVector object used as a store target. Amends f944651e3db01a73b10212926a7b1c7aad5eb83e. Amends cccda0e62d3d70f09654bbd6681a3e79c9814c8d. Change-Id: Ia0f8202bf4266b8b19b3de897a897de58b7a6d94 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix potentially unaligned 128-bit store/loadsAllan Sandfeld Jensen2024-03-271-1/+1
| | | | | | | QColorVector is not forced to 128-bit alignment. Change-Id: Ifacc171296ddddda742d49745372b47585e40802 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Optimize Newton-Raphson cuberoot with SSE2/SSE4.1Allan Sandfeld Jensen2024-03-151-0/+36
| | | | | | | Do all colors in parallel using SIMD. Change-Id: I36cb47888d92c4244b5ea7a91c8d84ac3656c56a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Strength reduction: div -> mulAllan Sandfeld Jensen2024-03-141-13/+13
| | | | | | | Replace all divisions by constant with multiplications of its inverse Change-Id: I05aa0631e8117e7d42da0eaa30077cd230caa919 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Optimize cuberoot using Newton-Raphson approximationAllan Sandfeld Jensen2024-03-141-3/+16
| | | | | Change-Id: I23a2515b42ef6592df0a18f04420670dc2b4ac1a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add A2B tables, and PCSLab support to QIccAllan Sandfeld Jensen2024-03-071-43/+106
| | | | | | | | | | | | | This finishes off ICC color space support in Qt (short of the optional multi process elements), and includes necessary parts for potential CMYK support (PCSLab and A2B support) [ChangeLog][QColorSpace] ICC profiles that are not three-component matrix based are now supported. Task-number: QTBUG-108175 Change-Id: Ie29b17a366d9ba0ea8135e1752530d6bb19e7520 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Expand QColorTransformAllan Sandfeld Jensen2022-05-261-0/+4
| | | | | | | | | | Add comparison operators and an isIdentity() method to detect (1-1) transforms. [ChangeLog][QtGui] Added QColorTransform::isIdentity() method. Added QImage::colorTransformed() transitive method. Change-Id: I5fbcd14e75f2179e43e94e8c5f42cd0a5600790b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | 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>
* Make sure all qtbase private headers include at least one otherThiago Macieira2022-02-241-1/+2
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-6/+6
| | | | | | | | 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>
* Get rid of QMatrixJarek Kobus2020-02-281-1/+1
| | | | | | Task-number: QTBUG-81628 Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Simplify QColorSpacePrivate initializationTor Arne Vestbø2019-09-121-11/+5
| | | | | | | | | | | QColorVector and QColorMatrix are default-constructed following the Qt philosophy of types always being well-defined. The corner-case where we need uninitialized versions of these types for performance reasons is handled explicitly. Change-Id: I629334d1ffc63563ec9fd1298c623946e0799d1d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove BT.2020 support from QColorSpaceAllan Sandfeld Jensen2019-09-081-6/+0
| | | | | | | | | | | | BT.2020 is an HDR color space and its luminance range doesn't match that of the rest of the currently available color spaces. Without support for white-point luminance in 5.14, there would be a behavior change when luminance support is later introduced, so it is better to remove it now, and reintroduce it when the necessary handling of different luminance levels is available. Change-Id: Ie29e4dd757faae3ac91d4252e1206acce42801dc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Custom color-space based on chromaticitiesAllan Sandfeld Jensen2019-05-021-5/+40
| | | | | Change-Id: I7fa6efa8993aa2b79ea60b6a21bf57c4f67a120f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Long live QColorSpace and friendsAllan Sandfeld Jensen2019-02-081-0/+214
Adds QColorSpace and QColorTransform classes, and parsing of a common subset of ICC profiles found in images, and also parses the ICC profiles in PNG and JPEGs. For backwards compatibility no automatic color handling is done by this patch. [ChangeLog][QtGui] A QColorSpace class has been added, and color spaces are now parsed from PNG and JPEG images. No automatic color space conversion is done however, and applications must request it. Change-Id: Ic09935f84640a716467fa3a9ed1e73c02daf3675 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>