summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
Commit message (Collapse)AuthorAgeFilesLines
* Stop using mixed enum arithmeticGiuseppe D'Angelo2021-06-131-4/+2
| | | | | | | | | | | It's deprecated. Port some unnamed enumerations (used only to declare constants) to constexpr integers instead. Apply qToUnderlying as needed. Task-number: QTBUG-94059 Change-Id: Ifaa64ece966ce08df40dc71ffcfa7ac038110e0b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Disable text gamma-correction when painting on linear color spaceAllan Sandfeld Jensen2021-06-101-0/+2
| | | | | | | | | We currently only support full gamma corrected painting by using linear color space images, the text logic however did its own gamma correction on top of that. Change-Id: I4ef41745f4bc1c3a5815426abbcee6968987e70d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix QColorTransform on RGBA64_PremultipliedAllan Sandfeld Jensen2021-06-101-6/+15
| | | | | | | | | The lack of an unsigned pack 32bit->16bit without SSE4, meant the premultiplied path would saturate color values over 32735. Pick-to: 6.2 Change-Id: Ia76e0369fd11a6767e8db78bf9a10eea30d91d2c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIcc: Update test for invalid valuesRobert Löhning2021-06-081-1/+1
| | | | | | | | | | | This should have happened when changing the code in f493d41722fc76a04f699ea26128fdf3d215d913 Fixes oss-fuzz issue 31633. Pick-to: 5.15 6.1 Change-Id: I7945c3f90651f8fa04df20fbaf0b0c7f68619407 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Doc: Fix QRgbaF documentationTopi Reinio2021-06-071-28/+28
| | | | | | | | Template parameters were missing from the \fn statements. Task-number: QTBUG-93995 Change-Id: I742f49c6f9686d3ed3a9d330dda32506d76ba287 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Fix warnings about qsizetype used as int in qpainter.hEirik Aavitsland2021-06-021-14/+14
| | | | | | Fixes: QTBUG-89273 Change-Id: Ibf3aff3bdb42fe5260cac528355f412c6ae0218f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* qpixellayout.cpp: mark some specializations of fetchPixel as unusedAndrei Golubev2021-06-011-0/+3
| | | | | | | | | | | | | | | | Triggers -Wunused-function warning (a.k.a. error) when building this part of the code: qpixellayout.cpp:292:25: error: unused function 'fetchPixel' [-Werror,-Wunused-function] inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP64>(const uchar *src, int index) ^ qpixellayout.cpp:300:25: error: unused function 'fetchPixel' [-Werror,-Wunused-function] inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16FPx4>(const uchar *src, int index) ^ qpixellayout.cpp:308:25: error: unused function 'fetchPixel' [-Werror,-Wunused-function] inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32FPx4>(const uchar *src, int index) Change-Id: I8ff40e3cf02f8a7ad7534f58ac23eeb8eb716d3a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Avoid possible division by zeroRobert Löhning2021-05-271-4/+5
| | | | | | | | | | | "width / line.length()" didn't crash because it's a qreal but that's still undefined behavior. Fixes oss-fuzz issue 32984 Change-Id: Ia9c35b9eb5d86c4ce3c7f030b68e95ae83350c44 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add SIMD optimizations for color-transform writesAllan Sandfeld Jensen2021-05-271-48/+190
| | | | | | | | | | Add NEON for RGB32 and RGBA64 writeback, and SSE2 for RGBA64 writeback. Change-Id: Id9ee803267a78f5bdff5beaa719e7a59c1dbb9fb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add NEON optimizations to QColorTransformAllan Sandfeld Jensen2021-05-271-8/+125
| | | | | | | | | And avoid some needless shuffling. Change-Id: I5101eb0582c17f5e3cb6db8e20d315ef38bd1863 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Introduce float QImage formats and renderingAllan Sandfeld Jensen2021-05-2612-254/+4465
| | | | | | | | | Useful for some HDR representations and HDR rendering. Change-Id: If6e8a661faa3d2afdf17b6ed4d8ff5c5b2aeb30e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Correct RGB to Grayscale conversionAllan Sandfeld Jensen2021-05-218-4/+181
| | | | | | | | | | | The existing conversions weren't handling gamma correctly and used an ad-hoc definition of gray instead of based on true luminance. [ChangeLog][QtGui] RGB conversions to grayscale formats are now gamma-corrected and produce color-space luminance values Change-Id: I88ab870c8f5e502ddb053e6a14a75102239a26f2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPageSize: make PageSizeId ctor non-explicitMarc Mutz2021-05-131-1/+1
| | | | | | | | | | | | | A QPageSize::PageSizeId is a faithful representation of a QPageSize, so the corresponding QPageSize ctor shouldn't be explicit. [ChangeLog][QtGui][QPageSize] Conversion from a QPageSize::PageSizeId is now implicit. Pick-to: 5.15 6.0 6.1 Change-Id: I2d32da370c032949686757400cb7c28583d9d8ac Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Tell code-checker drawPolygon can't be called with negative countAllan Sandfeld Jensen2021-05-111-0/+2
| | | | | Change-Id: I082ab823ca039d1d611bfdab6b69e3650d724844 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Initialize FirstPtBlock.next to make static analysis happyAllan Sandfeld Jensen2021-05-111-0/+1
| | | | | | | | Could in theory be triggered with a 0 line spanning elipsis. Pick-to: 6.1 Change-Id: I2166ee354d2f7488e1fcddfcb8c949c8ca2452fe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid potential read of uninitialized clip dataAllan Sandfeld Jensen2021-05-111-2/+1
| | | | | | | | | Set clip->count to 0 unconditional not just when hasRegionClip or hasRectClip is true. Pick-to: 6.1 Change-Id: Ib3d1c4dc24373df3d4dbc393241226a8730bb9fc Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix antialiasing of rotated non-smooth scaled imagesAllan Sandfeld Jensen2021-05-101-1/+2
| | | | | | | | | The fast-path can't antialias edges, and shouldn't be used when that is requested. Pick-to: 6.1 5.15 Change-Id: I3a0ce120ab96a6f95d11c165d1f5b356dae009fe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid coverage overflowAllan Sandfeld Jensen2021-05-101-0/+4
| | | | | | | | | | | We end up excluding more than 65536 from 65536 of rowHeight. Perhaps better fixed earlier, but I can't figure this logic out right now. Pick-to: 6.1 5.15 Change-Id: I5721c469441f15ac112180f971c857cd67edbf96 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid fast transform paint path on values it can't handleAllan Sandfeld Jensen2021-05-101-2/+6
| | | | | | | | | | It has a problem with very small targets, and coordinates can't exceed the same bounds we have on dimensions. Pick-to: 6.1 5.15 Fixes: QTBUG-93475 Change-Id: If5b3af324f4e525cee3dc448ba41fdd8a91cc880 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Support CSS text-decoration-color in underlines, overlines, strikethroughShawn Rutledge2021-05-071-0/+6
| | | | | | | | | | | | Also add a feature to the textedit example to set this value. [ChangeLog][QtGui][CSS] The CSS text-decoration-color attribute is now supported in rich text spans with underlines, overlines and strikethrough. Fixes: QTBUG-82114 Task-number: QTBUG-39617 Change-Id: I0065cb5431833da55b0f503ce7ff2b83b74b718a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix “unused variable” warningMorten Sørvig2021-04-301-0/+2
| | | | | | Change-Id: I2b151d7a0cda8774c236de1a024acbb3a1875c7e Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Don't use qreal as a loop counterEirik Aavitsland2021-04-211-5/+7
| | | | | | | Fix static analyzer warning Change-Id: I5c1a0c63e66b7c2511b4801bbe399681de998850 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Avoid combining enum values from different enum typesEirik Aavitsland2021-04-211-2/+2
| | | | | | | | Fixes static analyzer warnings. Task-number: QTBUG-91911 Change-Id: I55599d53bb98ada74ceb73d5668fcc18813c3ec4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge integration refs/builds/qtci/dev/1618405176Qt CI Bot2021-04-141-1/+1
|\
| * Fix partial pixel coverage calculationAllan Sandfeld Jensen2021-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | We want right - left, but the numbers we have are (1 - left) and right, so we need right - (1 - left) = right + left - 1. Pick-to: 6.1 6.0 Fixes: QTBUG-91957 Fixes: QTBUG-92485 Change-Id: I238cbbe1eebddff1ce56da38127899cdbd21db0e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Avoid processing-intensive painting of high number of tiny dashesEirik Aavitsland2021-04-141-9/+35
|/ | | | | | | | | | | | When stroking a dashed path, an unnecessary amount of processing would be spent if there is a huge number of dashes visible, e.g. because of scaling. Since the dashes are too small to be indivdually visible anyway, just replace with a semi-transparent solid line for such cases. Pick-to: 6.1 6.0 5.15 Change-Id: I9e9f7861257ad5bce46a0cf113d1a9d7824911e6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Assert that pointer is not nullptr before dereferencingVolker Hilsheimer2021-04-061-0/+1
| | | | | | | Fix static analyzer warning 0dc0b2a764417025a335a3a60b814335. Change-Id: I9891194b74dda51032c887b9351fe7314174fcd6 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QPainterPath: fix handling of fill rulesGiuseppe D'Angelo2021-03-262-2/+1
| | | | | | | | | | | | | | | | | | | | | | | fillRule() contained a major blunder: instead of checking if the d-pointer was allocated, and return a default value if it wasn't, it checked whether the path contained any points. This means that QPainterPath p; p.setFillRule(x); Q_ASSERT(p.fillRule() == x); was failing. As a drive-by to test this change, fix another mistake in clear(): clear is documented to clear the elements in a path, but instead it also changed the fill rule. This commit partially reverses 697910e5fbd382e78bc1bcbac3f5824aded059b4. Change-Id: Ieb8145694b672439c3380d9ccb87d1206a2dd115 Pick-to: 5.12 5.15 6.0 6.1 Done-with: Milian Wolff Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix alpha handling of QImage::setPixelAllan Sandfeld Jensen2021-03-221-5/+17
| | | | | | | | | | It was treated differently depending on format, made it consistently behave the same for all formats (following the behavior of the primary formats). Pick-to: 6.1 6.0 5.15 Change-Id: Ie24e19957d076fdf3ebd333074e26ede187489eb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* paintengine: improve error handlingEirik Aavitsland2021-03-191-2/+2
| | | | | | | | | Just check for null image/oom initially, no need to do it for every scanline. Reported by static analysis. Change-Id: I86c3f09556b99b889e720901a3691bb0f730ac02 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Triangulator: Ensure all members are initializedEirik Aavitsland2021-03-181-5/+8
| | | | | | | Increases robustness and fixes a number of static analysis reports. Change-Id: I2062e3fbb69a78831ef8c937e36cb318abf3529e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPainterPath: plug memory leakGiuseppe D'Angelo2021-03-171-12/+3
| | | | | | | | | | The copy operations didn't take into account the recent upgrade to QESDP, just reimplement them idiomatically and thus avoid a leak. Change-Id: I796c02b7d7835cfecd8e097c9979a6d431ee3f07 Fixes: QTBUG-91916 Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* make qmljsDebugargumentsstring() and forceOpen() constPeng Wenhao2021-03-131-1/+1
| | | | | | | | Guessing the const specifier was accidentally forgotten Signed-off-by: Peng Wenhao <pengwenhao@uniontech.com> Change-Id: I611acc8d67d3eb101df9c8d816dd5779241a79f8 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Remove “scaling” logging from QBackingStoreMorten Johan Sørvig2021-03-121-4/+0
| | | | | | | Prepare for renaming the logging category. Change-Id: I1fefefa510032ca70754fde9d80f9ac35ffa977b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QColorSpace::descriptionAllan Sandfeld Jensen2021-03-044-1/+34
| | | | | | | | | A way to read the description of the profile from ICC, or set one yourself. Change-Id: I68622e30ee209cac99c41f3df934712c3548c0de Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Port some value classes away from QScopedPointerGiuseppe D'Angelo2021-03-035-70/+55
| | | | | | | | | | | | | | | | | In preparation for deprecation of QScopedPointer::swap, port to other established solutions: * QPainterPath was basically a QExplicitlySharedDataPointer re-engineered around a QScopedPointer. Just use the right class for the job... * QBrush is in a similar situation, although its deleter is more complex; port to unique_ptr for that one to minimize the code impact. Change-Id: I7f7c1dd8702f84f5146043347af64dda3c7e6f09 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Handle para tags the same way for OOB checks as the other tagsAllan Sandfeld Jensen2021-03-021-21/+16
| | | | | | | | | Do not include the first parameter in the main tag anymore. That is a left over from before unaligned access was added. Pick-to: 6.1 Change-Id: I2caf027c6b9930d3e23fe5ec8bdcd45db34835a9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Handle desc tags the same way for OOB checks as the other tagsAllan Sandfeld Jensen2021-03-011-7/+3
| | | | | | | | | | Including one entry of the value in the header is pointless after the unaligned access rewrite, and a potentially dangerous pattern, though safe here due to overchecking. Pick-to: 6.1 Change-Id: I4c0380040f89920467c309503408f1df6f88423f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QBrush: get rid of an unused private functionGiuseppe D'Angelo2021-02-282-6/+0
| | | | | | | No idea why it's there, it's unused. Change-Id: Icf7b48e1e4ab37158a81e15ffa5a7125bfd10822 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix out-of-buffer in ICC curv parsingAllan Sandfeld Jensen2021-02-281-5/+6
| | | | | | | | | | After the unaligned ICC profile fix, we could read 2 bytes past the end of the buffer for curv elements with 0 parameters, though we wouldn't use or return the data. Pick-to: 6.1 6.0 5.15 Change-Id: Ibea9fa2840c01d690716d8f48e301fbfa67aa163 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Reduce warnings from ICC parsingAllan Sandfeld Jensen2021-02-251-7/+9
| | | | | | | | | | Messages about Qt deficiencies reduced to info, and info set as the default message level. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-91401 Change-Id: Ia97438f08de5e0383e77631dca9b253b47ef8167 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix logic problems with table based grayscale ICC profilesAllan Sandfeld Jensen2021-02-252-6/+6
| | | | | | | | | White-point was calculated wrongly and some tables could cause bad behavior in the tables. Pick-to: 6.1 6.0 5.15 Change-Id: I24e8f5f3cc1306f5f898a4acbf7b008e26bd04e2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid int overflow in QImage rotate90/180/270Eirik Aavitsland2021-02-241-21/+21
| | | | | | | Pick-to: 6.1 6.0 5.15 5.12 Fixes: QTBUG-91223 Change-Id: Ice53c80d695a5ffdf9162df84e7c9b1e43106bae Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Extend colorspace testing and fix bug it uncoveredAllan Sandfeld Jensen2021-02-132-1/+3
| | | | | | | | | | When changing transferfunction the look-up-tables needs to be regenerated. Pick-to: 6.1 6.0 5.15 Change-Id: I83ca5fe570f85d478a374f52c0a82db84e70c3b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Filter cosmetic lines using transformed, not world coordinatesEirik Aavitsland2021-02-101-4/+4
| | | | | | | | | Lines smaller than 1e-12 would not be drawn even when scaled up. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-75630 Change-Id: I8f261876c325b60f61e95ca2e5fde2cb227d4cba Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Canonical pointer usageHou Lei2021-02-091-6/+6
| | | | | | | | Other affected rows have also been fixed. Change-Id: Ie0a32f724bd2e40e7bfacfaa43a78190b58e4a21 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Avoid C-style casts when possibleHou Lei2021-02-071-16/+16
| | | | | | | Other affected rows have also been fixed. Change-Id: I1d2c28eb37a9d259d3132156163d4135894c18c3 Reviewed-by: David Faure <david.faure@kdab.com>
* Optimize RGBA64PM->RGBA64 for SSE4Allan Sandfeld Jensen2021-02-032-0/+102
| | | | | | | | And remove direct conversion to take advantage of both the SIMD, but also threading on all platforms. Change-Id: I782ae7c80e82b694e23abee28d69cecd0d28c32f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Optimize RGBA64->RGBA64PM for SSE2/AVX2Allan Sandfeld Jensen2021-02-033-4/+45
| | | | | | | | And remove the direct conversion so we can get both the SIMD optimization and threading applied. Change-Id: Id032ea91cc40c1cbf1c8a1da0386de35aa36cfb5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid int overflow in gradient drawingEirik Aavitsland2021-02-011-3/+6
| | | | | | | | | Fixes oss-fuzz 29348 Pick-to: 6.0 5.15 Change-Id: I3568a0a7a7e8d87881f5b052c6c00831b53b3842 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io>