summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Fix division by zeroAllan Sandfeld Jensen2021-01-271-0/+4
| | | | | | | | | | Consider a zero we need to divide with illegal input. Fixes oss-fuzz 29347 Pick-to: 5.15 6.0 Change-Id: I2aae1d765d2dd81c95d423038ef5cb878d4f8026 Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Add qHypot() to qmath.h, exposing and extending std::hypot()Edward Welbourne2021-01-271-13/+5
| | | | | | | | | | | | | | | | | | | | We have plenty of places where we add some squares and take a square root; this may be done more accurately and faster by hypot(). Introduce QHypotHelper to handle hypot with more than 3 parameters, and with 3 when the C++17 version is missing (which it never should be). Include an overload taking arbitrarily many valus and ensure that we can use qHypot() with qfloat16. Illustrate with some example uses, add some tests. [ChangeLog][QtCore][QMath] Header <QMath> now provides qHypot(), an implementation of std::hypot() taking arbitrarily many numeric values, including support for qfloat16, while avoiding the overflow and underflow problems that arise when naively taking the square root of a sum of squares. Change-Id: Ia4e3913fe83fc27d17d8e7f1a52f03ad445c1fed Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Protect against sign-change of size on 32bitAllan Sandfeld Jensen2021-01-271-1/+1
| | | | | | | | | | | | Since qsizetype is signed and the profileSize unsigned, it can turn negative circumventing the test here. Fixes oss-fuzz issue 29278. Pick-to: 6.0 5.15 Change-Id: I1e211c78db6f4ff150613f52d8fc29807f0088ff Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Implement vertical subpixel positioning where availableEskil Abrahamsen Blomfeldt2021-01-257-24/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some use cases, vertical subpixel positioning may be useful, as it allows you to vertically align text with other painting primitives. This does impose an overhead, so we make it opt-int with a render hint on the painter. Note that this is only supported on Freetype currently. It might be possible to support on older macOS versions, prior to Mojave (which has disabled subpixel positioning entirely), but since it would have limited usefulness and Freetype is cross-platform anyway, I skipped that. Note: This drive-by-fixes an issue with subpixel positioning where glyphs would always be offset by 1/64, because we added the aliasing offset *after* we had determined the closest subpixel position. The idea of this, as far as I can understand, is rather to snap to nearest subpixel position upwards, not to add an offset to all glyphs, so it should be added before finding the correct position. It had a subtle visual effect when animating the position. It might be that we could get rid of it entirely, as I haven't been able to reproduce any issues with that, but I have moved it instead, to match what I believe the intention was. [ChangeLog][QtGui][Text] Added render hint flag QPainter::VerticalSubpixelPositioning which will position text at subpixel positions vertically whenever supported. In absence of this, text position will be rounded vertically as before. Fixes: QTBUG-35682 Change-Id: I8ce7a72a64e5a0924dac7c244e3e07c2938bfd09 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Rasterizer: compute intersection factors only when neededEirik Aavitsland2021-01-201-7/+12
| | | | | | | | | Fixes oss-fuzz issue 29285 Pick-to: 6.0 Change-Id: I8f7e0bc898b119d153a36cef5a74371249ed7686 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* Get rid of blend_color_rgb16Allan Sandfeld Jensen2021-01-151-82/+1
| | | | | | | | | The generic functions are better optimized anyway, and it this old method appears to have old bugs. Fixes: QTBUG-20681 Change-Id: I60e4cc5f6cd90c851e90106ac9badfc6c249cd9f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix convertToRGBA64PM for Grayscale16Allan Sandfeld Jensen2021-01-151-2/+1
| | | | | | | | | | The input has been fetch into a set of uint32s, so no longer a string of ushorts. Pick-to: 6.0 5.15 Fixes: QTBUG-90246 Change-Id: Id52a6824317b0744310008cc2ce2f726539b4c8c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add API for creating QColorSpace with multiple color-transfer tablesAllan Sandfeld Jensen2021-01-143-15/+157
| | | | | | | One table per color channel, as is possible from many inputs. Change-Id: I9fc723c68f222a228dd2b1458207b028422913bf Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use design metrics when adding text to QPainterPathEskil Abrahamsen Blomfeldt2021-01-121-0/+5
| | | | | | | | | | | | | | | | | | | | | When we add text to QPainterPath, we will add the design metrics (unhinted glyphs) and scale these down to match the target font size. But the glyph positions we pass in are based on the hinted metrics, samples at the target font size. Thus, on fonts/systems with hinting, these do not match the scaled design metrics outlines. To fix this issue, we make sure the text layout uses design metrics when determining the glyph positions. [ChangeLog][QtGui][Text] Fixed an issue where QPainterPath::addText() would get inconsistent kerning for smaller font sizes when hinting is enabled. Fixes: QTBUG-20900 Pick-to: 5.15 Pick-to: 6.0 Change-Id: I651997d1a6a86e6271557438afa2cdad078a83ca Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-176/+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>
* QPicture: Improve the documentation of Picture::play()Christian Ehrlicher2020-12-221-1/+3
| | | | | | | | | | QPicture::play() does not save/restore the painting state when called directly but this was not correctly stated in the documentation. Therefore add a small note about this. Fixes: QTBUG-83198 Change-Id: Ia820d32ccb4689d1e696fecffa9d6b5522e246b3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix qdoc warning, reference parameter correctlyVolker Hilsheimer2020-12-211-1/+1
| | | | | Change-Id: Icb3d0aa005752f291f81a47a15f7157009fd09f2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add colorspace transfer functions based on tables of inputsAllan Sandfeld Jensen2020-12-104-23/+144
| | | | | | | | This is the most basic way to represent custom transfer functions. Change-Id: I529fb647ece82c03e85ef77b056d9daf13fe5a61 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>