summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Get rid of QPenPrivate::defaultWidthAllan Sandfeld Jensen2020-12-082-16/+8
| | | | | | | It is no longer used. Change-Id: I834e0cbd6ef4fefb52d0864053e95e7dea19b389 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add generic rb swap for RGB64 formatsAllan Sandfeld Jensen2020-12-041-3/+24
| | | | | | | Will also be needed by half-float formats. Change-Id: Ia735b29b65287c63da5f1b5ec25428562d743800 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve documented function argument namesAllan Sandfeld Jensen2020-12-043-14/+14
| | | | | | | | Make them less \a fun. Pick-to: 5.15 6.0 Change-Id: Ief9a572dcbeb029b18b352c89551963bade90198 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Cosmetic stroker: avoid overflows for non-finite coordinatesEirik Aavitsland2020-12-011-0/+2
| | | | | | | | | | | | | | int overflows are usually avoided by clipping the qreal coordinates to the device rect. However the clip function did not handle inf or nan coordinates, so such values would be passed on. Fix by treating any line with such coordinates a fully clipped away, i.e. rejecting it, since it cannot be meaningfully stroked anyway. Fixes oss-fuzz issue 25330. Pick-to: 6.0 5.15 5.12 Change-Id: I4646172fc7a7e0a3a5f5cf03ce10ff0fb56b0d03 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-305-5/+5
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Limit pen width to maximal 32767Allan Sandfeld Jensen2020-11-271-4/+7
| | | | | | | | Fixes oss-fuzz 25195 Pick-to: 5.12 5.15 6.0 Change-Id: I8c68cf71f6702d8b1b1a2ddda3284c14f02d7972 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid integer overflow and division by zeroAllan Sandfeld Jensen2020-11-231-3/+3
| | | | | | | | | | | | Restrain patterns to sensible lengths and values. [ChangeLog][QCosmeticStroker] Pen patterns are restrained to a maximum length and values of 1024, fixing oss-fuzz issue 25310. Pick-to: 5.12 5.15 6.0 6.0.0 Change-Id: If062f8336ff5ad113258391b0d70b8ac6f42c4b3 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix safe conversionAllan Sandfeld Jensen2020-11-201-4/+11
| | | | | | | | | | | Ensure the resulting QScFixed values are no larger than can be safely returned to int after shifting the fixed factor away. Pick-to: 6.0 6.0.0 Fixes: QTBUG-88683 Change-Id: Id0754b021e5fa9a3cf0d15e37ac643cfc1509993 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-201-1/+1
| | | | | | | | | | | | | | | | By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Get rid of Q_COMPILER_CONSTEXPR checksAllan Sandfeld Jensen2020-11-171-2/+0
| | | | | | | Is required now. Change-Id: I62e95929d1649ea1390392230b619bd56d2a0349 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make QPageRanges::detach public, add data stream operatorsVolker Hilsheimer2020-11-172-1/+43
| | | | | | | | | | | As per QUIP-19 discussion, value types should have streaming operators, and detach should be public. detach() is still documented as \internal, like other public detach methods in value types. Change-Id: I30451909ad5226088fb05206f83983dda5b0c6b5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix typoJarek Kobus2020-11-171-1/+1
| | | | | Change-Id: Ief75f63a732cede0e892f74670d5323e0c838756 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-168-14/+14
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Remove unused variable to fix build with clang-10Andreas Buhr2020-11-131-2/+0
| | | | | Change-Id: I800df8184b3a713b27c71b6303b98b760a4dfc83 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* remove unused variables and parameters to fix compilation with g++-10.2Andreas Buhr2020-11-133-5/+3
| | | | | | | | | | | The changes in 94dd2cebdcb9446626cd32a00086431eb11ab2a4, "Remove Qt4Compatible painting" left some unused variables and parameters. This leads to warnings which are treted as errors and thus inhibit a successful build with g++-10.2. This patch removes them and thus enables building with g++-10.2 again. Change-Id: I5f83aa8ec8706c3e783540f5116f455ea8fe44c2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix scaling of basic patterns under HiDPIAllan Sandfeld Jensen2020-11-133-5/+8
| | | | | | | | | The dense patterns should not be non-smoothly scaled, just repeated more. Change-Id: I869556039ea1c91773bf2bc83d236b4592bcfc66 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Avoid false positives in Clang static analyzerDimitrios Apostolou2020-11-131-2/+6
| | | | | | | | | | This assert should avoid three null-pointer dereference warnings, that get flagged later in the same function, assuming that worker is null. Change-Id: I1bf521fa335ee14b8ac98e872f31ef704f386efe CodeChecker-report-hash: 38b39301a55fdb09bb0ec7cd43aa4f5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove Qt4Compatible paintingAllan Sandfeld Jensen2020-11-1213-117/+37
| | | | | Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix misidentification of some shearing QTransforms as only rotatingEirik Aavitsland2020-11-111-1/+1
| | | | | | | | | The dot product used rows instead of columns. Pick-to: 5.15 5.12 Fixes: QTBUG-87984 Change-Id: I922f67ed0fa9a4f88aa4e9fc6d3c09f8dda21688 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Allow painting above INT16_MAX on 64-bit architecturesAllan Sandfeld Jensen2020-11-096-182/+204
| | | | | | | | | | | The logic in qgrayraster was ready for it except for an intermediate format. qrasterizer.cpp and qcosmeticstroker.cpp uses a dot-16 fixed point format, and had to be changed to handle higher coordinates on 64-bit architectures. Fixes: QTBUG-84428 Change-Id: I85ab7a04e38bd0dbcefa9f16c16ccc84785a33cf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename QRangeCollection to QPageRanges, make it a proper value typeVolker Hilsheimer2020-11-088-324/+459
| | | | | | | | | | | | | | | | | | | | | | | The type is specific about printing, so give it a name in line with QPageLayout and QPageSize. As per API review comment, it's not clear why this type should not be a regular, copyable and movable value type. It stores a list of intervals. Give it value-type semantics, as an implicitly shared class. Convert the parse method into a static factory function. Add a Range type and use it instead of the semantic-free QPair. Move QPrinter getter into QPagedPainteDevice, make it return a copy rather than a pointer, and add a setter. Extend test case to cover all members and more merge cases. Fix bugs found that way. Fixes: QTBUG-88113 Change-Id: If17ea4d410d49f16b097e88b7979db5d72add820 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove left-over and unnecessarily exported operator==Volker Hilsheimer2020-11-031-1/+0
| | | | | | | Amends a45a3b1ece490bcae5cccd858dbe11408a19bee0 Change-Id: If481ec1818ec4cb263f271f0099f7452fbdce1a0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make RGB_MASK inline constexprVolker Hilsheimer2020-11-021-1/+1
| | | | | | | As per comment on API review. Change-Id: If4bd234372ebad0e3bfac41642981a612fd165bd Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Minor improvements in qrgba64_p.hAllan Sandfeld Jensen2020-10-311-31/+104
| | | | | | | | | | Adds SIMD acceleration for the blend_pixel, and raw interpolate methods, and cleans up other SIMD code. Gives minor speedups in text rendering and various fallbacks. Change-Id: Ib0ad8b408450e4e73f3c1d50e9caaed0098acb94 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QPolygonClipper to XCB native paintingAllan Sandfeld Jensen2020-10-293-318/+0
| | | | | | | It is the only code using it. Change-Id: I30060a63b6621ea94ae487ec93cd857117e12a46 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Make comparison operators in gui/painting classes hidden friendsVolker Hilsheimer2020-10-286-58/+74
| | | | | | | | Reduce ADL noise from QColorSpace, QPageSize, and QPageLayout with the help of a private equals method. Change-Id: I0082597dd216b982e8d8eb5a4bd7dd29a5d3263b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix documentation warningsVolker Hilsheimer2020-10-241-2/+2
| | | | | | | | | Declare hidden friends like qdoc expects them, and other signature fixes Document function parameters Remove documentation for removed APIs. Change-Id: I44c1caeed0d40be04612129d074acc30b75f5259 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPaintDevice: Remove reserved without reservationsFabian Kosmale2020-10-232-4/+0
| | | | | | | | | | | | It was not during all of Qt 5, and nobody found a use for it when transitioning to Qt 6. It's probably safe to assume that we will not need it during Qt 6's lifetime either. This changes shrinks QPaintDevice to 16 bytes (on 64bit systems), and its child classes like QImage to 24 bytes, meaning that they fit into QVariant's SSO buffer. Change-Id: Ic3b020ad43afe45c76ca0c4056a440345a4e139e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix to make g++-10.2 happyAndreas Buhr2020-10-221-0/+2
| | | | | | | | | | | | | | g++-10.2 fails to compile qregion.cpp in RelWithDebInfo configuration, with error message: qregion.cpp:3617:12: error: ‘ET.EdgeTable::ymax’ may be used uninitialized in this function [-Werror=maybe-uninitialized] g++ is right here, for Count==1, 'ET' is not initialized but used. This patch fixes this by Q_ASSUMEing Count > 1. Pick-to: 5.15 Change-Id: I3b9f1f58de9f3811c60640a08334487e3f8f2b23 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPdf: consolidate usage of uintGiuseppe D'Angelo2020-10-192-3/+4
| | | | | | | | | Objects in QPdf are indexed by uint. In a couple of places (incl. QFontSubset) int were used instead, causing sign conversion warnings (turned into errors by -Werror). Use uint instead. Change-Id: Ie0436c8aff3b67d8ef95a5f26fc16403e7e02bd1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QColorSpace: port to QESDPGiuseppe D'Angelo2020-10-184-60/+41
| | | | | | | | | | Replace the hand-rolled refcount management with QESDP. Since the class has a default-constructed / moved-from state where the d-pointer can be nullptr, add a in-class detach() that ensures a private object. Change-Id: Id81431fa60132dbc0eed45bb60b38d4f7d73833f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QColorConstants: code tidiesGiuseppe D'Angelo2020-10-171-172/+167
| | | | | Change-Id: Ib4131a583529d2cd6a6d7d27513cca387cb1d722 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix compilation with optimization with g++-10.2Andreas Buhr2020-10-161-0/+3
| | | | | | | | | | | | | | When compiling in RelWithDebInfo configuration with g++-10.2, it complains: qtbase/src/gui/painting/qdatabuffer_p.h:71:36: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] This patch disables this warning in this place. Pick-to: 5.15 Change-Id: Id3154ce80a1921671031828aaa7144214adad5dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port QColorTransform to QESDPGiuseppe D'Angelo2020-10-163-17/+8
| | | | | | | | Remove the hand-rolled refcount management code, and cleanup the existing constructors. Change-Id: I1b91dbf888feff25d67310637d42dcdc3acaac13 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port some more /*implicit*/-like comments to Q_IMPLICITGiuseppe D'Angelo2020-10-161-7/+7
| | | | | Change-Id: Ib70ad3f29365153af647deea54fc45467c413cb9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Link to qAlpha in qRgb() and qRgba() docsMitch Curtis2020-10-121-2/+2
| | | | | | Pick-to: 5.15 5.12 Change-Id: I5a3b8573123e82f4c8c92fa7a2e1af06e2e84eb2 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Improve QRgb documentationMitch Curtis2020-10-121-1/+5
| | | | | | | | | - Add examples of how to create QRgb values - Link to qRgba() Pick-to: 5.15 5.12 Change-Id: I2a86b1c8e00137ba868426b8157a3aa0d924d7a6 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Protect QImage work on shutdownAllan Sandfeld Jensen2020-10-123-3/+3
| | | | | | | | | | If the thread pool was not created, or already deleted, make sure the QImage routines can still run as they could before. Fixes: QTBUG-87320 Pick-to: 5.15 Change-Id: I4105a68b6ae0637faf82cdda5f5ae44298759396 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid heap-buffer-overflowRobert Loehning2020-10-121-1/+1
| | | | | | | | | [ChangeLog][QCosmeticStroker] Avoid a heap-buffer-overflow found by oss- fuzz as issue 25243. Pick-to: 5.12 5.15 Change-Id: I36112f183241679e172ad1ee531e1b929d6f3815 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Make the named QColorSpace constructor thread-safeAllan Sandfeld Jensen2020-10-101-5/+24
| | | | | | | | | | Avoid accessing the shared pointer table without using atomic. Cleans up the shared table on exit for leak tracking utilities. Pick-to: 5.15 Change-Id: Ia2d6d79dea1c8be02bae2d8111e290f49eedf409 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix a compile error on Android in debug buildsLars Knoll2020-10-091-2/+2
| | | | | | | Android uses -Werror,-Wsign-compare. Change-Id: I4e861ebd6ea00914223358629f8e898c2aa67cd0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QColorSpace: tidiesGiuseppe D'Angelo2020-10-061-1/+1
| | | | | | | | It doesn't actually need Q_DECLARE_PRIVATE (it never uses Q_D), it just needs to give friendship to the private class. Change-Id: I32ac128118a0c319a374e510a18ccf0edf323da7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QColorSpace: remove a redundant declarationGiuseppe D'Angelo2020-10-061-1/+0
| | | | | | | The same function was declared, as friend, a few lines above. Change-Id: I28368202c68242f2d30d25bd38f2f0e530a60082 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>