summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Replace Q_DECL_UNUSED with [[maybe_unused]]Allan Sandfeld Jensen2020-10-032-168/+168
| | | | | | | Use C++17 attribute directly Change-Id: Id853e7a5117065e4adb549f81303c1820fe198ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-038-23/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Do not assert on invalid ICC curv tableAllan Sandfeld Jensen2020-10-012-17/+35
| | | | | | | | Reject invalid table data, do not assert it. Pick-to: 5.15 Change-Id: I1fdda4c735bb97bb93ac8f8654ac4cc5fada5389 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Revert "Reimplement non-antialiased cosmetic pen"Allan Sandfeld Jensen2020-10-011-98/+193
| | | | | | | | | This reverts commit 81008ef4b91eac3f8ddcdad0aaf48b51135c4010. Reason for revert: Doesn't handle line-caps correctly. Change-Id: I0c77dbef6671fec326ec27f492ea3214054829ab Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Get rid of some #ifdef qt6Allan Sandfeld Jensen2020-09-302-15/+1
| | | | | | | | | 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>
* Reimplement non-antialiased cosmetic penAllan Sandfeld Jensen2020-09-291-193/+98
| | | | | | | | | Simplify rounding to get rid of hacks to make lines meet up again. This also results in better looking drawing results in general. Task-number: QTBUG-25896 Change-Id: I48f08f0e7bd7ff869d6767f7bac2a18c2d280615 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Fix qdoc warnings: remove docs for inherited/implicit membersVolker Hilsheimer2020-09-281-23/+0
| | | | | Change-Id: I8654dbc3c0d1b86690f805cc1282e581dbcc5c55 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Avoid heap-buffer-overflowRobert Loehning2020-09-251-0/+2
| | | | | | | | | [ChangeLog][QOutlineMapper] Avoid heap-buffer-overflow Fixes: oss-fuzz-24615 Pick-to: 5.12 5.15 Change-Id: Ia67e1fb830850d04f068d8b5c009687f3deff156 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Replace Q_REQUIRED_RESULT with [[nodiscard]]Allan Sandfeld Jensen2020-09-255-31/+31
| | | | | | | It was already used many places directly making the code inconsistent. Change-Id: I3b14bc6c333640fb3ba33c71eba97e78c973e44b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix some qdoc warnings: printer API cleanupVolker Hilsheimer2020-09-221-107/+0
| | | | | | | | | | | | Puge references from removed QPrinter methods. QPdfWriter's setter API documentation only added the word "PDF" to the QPagedPaintDevice documentation. This was not useful - when the latter talks about "page", it's obvious what is meant in the context of PDF, so remove the duplication. Change-Id: I7b16cbc82de8d35b5224288c9e36deff4e01fb44 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Define inverted QRects consistentlyAllan Sandfeld Jensen2020-09-211-35/+3
| | | | | | | | | | | | | | | | Changes the definition of invalid QRects to be more consistent. This simplifies the logic, and makes it possible for us to fix normalized() so dimensions don't change. The actual API is not changed except for inverted rects. Only one use-case for the old normalized() function existed, and has been reimplemented as QRect::span(). Fixes: QTBUG-22934 Change-Id: I29dad2952dc6c8e84a6d931898dc7e43d66780f3 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix deprecation documentation about margin and orientation in QPrinterÖmer Fadıl USTA2020-09-172-4/+4
| | | | | | | | There were a small typos about those methods and fixed with correct ones. Fixes: QTBUG-86635 Change-Id: Ib853e502fdcdafdf3ddf7ef6d25d368ebc2a631f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIcc: fix alignment concerns in ICC profile parsingAndrei Golubev2020-09-152-86/+103
| | | | | | | | | | | Updated QIcc::fromIccProfile() and friends to not rely on QByteArray pointer alignment. Used qFromUnaligned() instead Task-number: QTBUG-84267 Pick-to: 5.15 Change-Id: I69ef7e011707bec27cd84693e7f0e92d79a577d1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix uninitialized variableLars Knoll2020-09-121-0/+3
| | | | | | | Amends defc8414fde0ea9f52fe554e00fe2f04947b7578 Change-Id: I0a62f08cb9428e94b30f659d810c767c2bc1b4b2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix documentations string in QPagedPaintDeviceNicolas Fella2020-09-121-1/+1
| | | | | | | | pageLayout().pageOrientation() does not exist, but pageLayout().orientation() does. Pick-to: 5.15 Change-Id: I17a667b18aba284b91972422e604568e2fdbda05 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace qreal with float in QColorAllan Sandfeld Jensen2020-09-112-224/+224
| | | | | | | | There is no reason to use double precision for colors. We at most have 16 significant bits anyway. Change-Id: I8b402cd978675b8ba7248176976d934363212ff1 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Minimal ABI necessary for future optimized QPixmapAllan Sandfeld Jensen2020-09-112-1/+44
| | | | | | | | Add virtual hooks that can make it possible in Qt6 to implement paint device specific pixmaps. Change-Id: Ib1d1d7b5e32d9430203f718534344b25c0ead744 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Cleanup QGradientLars Knoll2020-09-113-51/+25
| | | | | | | Tackle some cleanups scheduled for Qt 6. Change-Id: I46e6e49e3d74f49ce953a36c5611d635232d43b1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Cleanup PageSize enum for Qt6Allan Sandfeld Jensen2020-09-103-157/+8
| | | | | | | Fixes B5/B6 order and removes abandoned documentation for a removed duplicate. Change-Id: I7647ee31a4ef4aa754058c8a6f68b4d4304e0043 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clean-up of old VC6 work-aroundAllan Sandfeld Jensen2020-09-101-54/+43
| | | | | Change-Id: Ic518f48b62055a4fa229751a80362f9426e0ac42 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Port from devicePixelRatioF() to devicePixelRatio()Morten Johan Sørvig2020-09-104-8/+8
| | | | | | | This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>