summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QRadialGradient: Fix undefined behaviorHatem ElKharashy2024-01-081-5/+4
| | | | | | | | | | | | The UBSan raises a division by zero in getRadialGradientValues. This can be avoided by calculating the inverse in qt_fetch_radial_gradient_template as a checker is done to avoid division by zero there. (Credit to OSS-Fuzz) Pick-to: 6.7 Fixes: QTBUG-120332 Change-Id: I798d1efc87ee07df7ca6f401aa476013cdbffe42 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QPaintEngineRaster: port from QSharedPointer to std::shared_ptrMarc Mutz2023-02-021-6/+2
| | | | | | | | | | | | | | Compared to std::shared_ptr, QSharedPointer requires 2x the atomic operations per copy, and does not support QSharedPointer<void>. Port to std::shared_ptr, and drop the Pinnable kludge. Add an optimistic std::move() when we insert into QMultiHash. Pick-to: 6.5 Change-Id: I2ab004b7e8fa36d9e777cd787ffded4076d2880f Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Gui: Always declare qt_memfill{32|64} as function pointers on x86Ulf Hermann2023-01-121-1/+1
| | | | | | | | | | | | | | Having the declaration of a function depend on compiler flags is a fundamentally bad idea since you can compile different compilation units that all include the header with different flags. This leads to undefined symbols. Pick-to: 6.5 Fixes: QTBUG-109159 Change-Id: I0aede280988e4f10c42d5b1824ad9c96a1e10854 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QSpan typedefMarc Mutz2022-11-111-7/+0
| | | | | | | | | | It's in the way of the planned QtCore std::span reimplementation of the same name. Task-number: QTBUG-108124 Change-Id: I55d9391d72644c02e4e4143f4ad2f6756404dcc7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Expand QSpan typedef to underlying type QT_FT_SpanMarc Mutz2022-11-111-2/+2
| | | | | | | | | | | | | This frees up the QSpan name for the planned QtCore std::span reimplementation, also called QSpan. This is binary compatible because QSpan was just a typedef and because it's all private API. Task-number: QTBUG-108124 Change-Id: I3b5c1ea82673934e2d1eb490fddeae3f8e6a6ea3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add painter render hint for brush pattern transformationEirik Aavitsland2022-05-311-1/+1
| | | | | | | | | | | | | | [ChangeLog][QtGui][QPainter] In Qt 5, the predefined brush patterns would always be transformed along with the object being painted. In Qt 6.0 onwards, they would or would not, depending on the SmoothPixmapTransformation render hint. Instead of this somewhat surprising behavior, make the default be untransformed (i.e. cosmetic), which makes sense when it comes to dpr scaling. For the cases where one wants scaling, a new render hint is introduced to enable that: NonCosmeticPatternBrushes. Change-Id: I2208c7a28af9056d7ab97a529b66bf2d502c3c4f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@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>
* Remove remnants of the old Intel C++ compilerThiago Macieira2022-05-111-1/+1
| | | | | | | | | | | | | We don't support it any more. I don't think it has ever properly compiled Qt 6 (and it's no longer working for me against GCC 12's libstdc++ headers). If you report a bug against it, Intel support's first question is if you can try instead the new Clang/LLVM-based oneAPI C++ compiler. So we support only that one, which identifies itself as Q_CC_CLANG. Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57a092c8439e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Draw extended RGB solid colorsAllan Sandfeld Jensen2022-01-121-1/+1
| | | | | | | Pass extended RGB colors through the paint engine. Change-Id: I2e212cd4c76aaa65439746352c0da2b9db4a506d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Rename QRgbaF to QRgbaFloat and assert the compatible typesAllan Sandfeld Jensen2021-07-051-15/+15
| | | | | | | Pick-to: 6.2 Change-Id: I2404fdfd43d3b4553760ad2f605175121cd31446 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce float QImage formats and renderingAllan Sandfeld Jensen2021-05-261-66/+67
| | | | | | | | | 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>
* Fix scaling of basic patterns under HiDPIAllan Sandfeld Jensen2020-11-131-1/+2
| | | | | | | | | 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>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-5/+5
| | | | | | | | 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>
* Replace Q_ALWAYS_INLINE with static inlineAllan Sandfeld Jensen2020-07-281-15/+15
| | | | | | | | | Static inline on functions serves the same purpose of keeping non- inlined instances from different binaries from being mixed, and has the benefit of being available across compilers. Change-Id: I12467f6d887471d8fd70ff4623c473c2a5a45664 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid warnings regarding bit-field signednessDimitrios Apostolou2020-07-161-2/+2
| | | | | | | | | | | Up to (including) C++11, integral bitfields of unspecified signedness have implementation dependent signedness. Detected by LGTM.com static analyzer. Pick-to: 5.15 Change-Id: Ibaa0fdc6e443495a3cd40330c4573c9cc6ccdf5b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVector in guiJarek Kobus2020-06-291-1/+1
| | | | | | | | Applied to headers only. Source file to be changed separately. Task-number: QTBUG-84469 Change-Id: Ic08a899321eaffc46b8461aaee3dbaa4d2c727a9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Split PixelLayout to separate source fileAllan Sandfeld Jensen2020-05-111-288/+55
| | | | | Change-Id: I0beafa39d92550ea78e78a07b25ce1253cc6668d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QDrawHelper cleanupsAllan Sandfeld Jensen2020-03-191-1/+1
| | | | | | | | | | | We don't need to handle solid SourceOver logic directly, this was already handled by getOperator and changed composition to Source. Also removes some dead code and changes an assert in unreachable code to Q_UNREACHABLE. Change-Id: I66a6c1248bd34e31096023f1acb20385099932c9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Handle transparent pen color in fast text pathAllan Sandfeld Jensen2019-09-221-0/+2
| | | | | | | | | | Switches the text blending to be SourceOver as that is much more common than Source, and means we can now handle semi-transparent text colors there. Task-number: QTBUG-72165 Change-Id: I7b3aedb22412e6fb6f60197596b37f26c6008784 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make the 64 bit raster backend an optional featureAllan Sandfeld Jensen2019-04-091-0/+4
| | | | | | | | Can be used to make smaller binaries, and possibly speed up ARGB32 rendering on some platforms. Change-Id: I7647b197ba7a6582187cc9736b7e0d752bd5bee5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* More nullptr usage in headersKevin Funk2019-03-141-1/+1
| | | | | | | | | | | Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Grayscale16 Image FormatAllan Sandfeld Jensen2018-12-121-0/+2
| | | | | | | | | | [ChangeLog][QtGui][QImage] Added support for 16-bit grayscale format. Together-with: Aaron Linville<aaron@linville.org> Task-number: QTBUG-41176 Change-Id: I5fe4f54a55ebe1413aa71b882c19627fe22362ac Reviewed-by: Nick D'Ademo <nickdademo@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add a qt_memfill24 implementationAllan Sandfeld Jensen2018-12-121-19/+22
| | | | | | | | | | This function gets called from qt_rectfill_quint24, which is used by the RGB666, ARGB6666_Premultiplied, ARGB8555_Premultiplied, and RGB888 formats. Together-with: Thiago Macieira <thiago.macieira@intel.com> Change-Id: Iba4b5c183776497d8ee1fffd1564585fdee835c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add AVX2 versions of qt_memfill32 and qt_memfill64Thiago Macieira2018-12-111-0/+5
| | | | | | | | | | The implementation is almost the same 4-way-unrolled loop, but because of the wider registers, we fill 128 bytes per loop. Unlike the SSE2 implementation, the AVX2 version uses unaligned stores and won't try to align in the prologue, matching glibc's __memset_avx2 (also unaligned). Change-Id: Iba4b5c183776497d8ee1fffd15637ccb2a7b83bc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add SSE2 qt_memfill64Thiago Macieira2018-12-111-0/+7
| | | | | | | | Implemented by merging with the qt_memfill32 implementation in a non-inlining function. Change-Id: I343f2beed55440a7ac0bfffd15636f8ba995a2bd Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Cleanup gradient blendingAllan Sandfeld Jensen2018-11-161-7/+2
| | | | | | | | | Moving it to a separate routine like blendTexture, so DrawHelper only has solid color routines, and generalizing the vertical gradient optimization. Change-Id: I54bd59eba7e95247b9a365a3738d02c4f8cc2631 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use qsizetype for qt_memfill functionsThiago Macieira2018-11-111-10/+10
| | | | | | | Just in case the image is larger than 2 GB (512 megapixels). Change-Id: I343f2beed55440a7ac0bfffd15636cbc68dfa13d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge the qt_memfill{,_template} functionsThiago Macieira2018-11-111-23/+24
| | | | | | | | | | | | We had two copies of the Duff's Device implementation, one in the .cpp and one in the header. One of the two implementations had a protection against zero counts, the other didn't. So move the .cpp implementation to the header and use it in the functions that were declared there. Fixes: QTBUG-16104 Patch-By: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Iba4b5c183776497d8ee1fffd156456cc3502946e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove QT_MEMCPY_USHORT macro and just use memcpyThiago Macieira2018-11-081-20/+0
| | | | | | | | Compilers can optimize memcpy, so don't try to be too smart. Change-Id: Iba4b5c183776497d8ee1fffd156455b50de65182 Patch-By: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove unused QT_MEMCPY_REV_UINT macroThiago Macieira2018-11-081-20/+0
| | | | | | | | It's not used anywhere. Patch-By: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Iba4b5c183776497d8ee1fffd1564559d6502a6f5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove QT_MEMFILL_xxx macrosThiago Macieira2018-11-081-6/+0
| | | | | | | | They were just calling a function, may as well just call said function directly. Change-Id: I343f2beed55440a7ac0bfffd15636b183c1a420f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove unnecessary Q_STATIC_TEMPLATE_FUNCTION macroThiago Macieira2018-11-061-5/+2
| | | | | | | It expands to the same thing in all three branches. Change-Id: I343f2beed55440a7ac0bfffd15636a8bfd8fd21c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Smooth image scaling for 64bit imagesAllan Sandfeld Jensen2018-08-221-0/+71
| | | | | | | | Adds support for smooth scaling 64bit images. Task-number: QTBUG-45858 Change-Id: If46030fb8e7d684159f852a3b8266a74e5e6700c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Implement support for 16bpc image formatsAllan Sandfeld Jensen2018-08-111-4/+15
| | | | | | | | | | | | | | Adds support for 16bit per color image formats in QImage. This makes it possible to read and write 16bpc PNGs, and take full advantage of the 16bpc paint engine. [ChangeLog][QtGui][QImage] QImage now supports 64bit image formats with 16 bits per color channel, compatible with 16bpc PNG or RGBA16 OpenGL formats. Task-number: QTBUG-45858 Change-Id: Icd28bd5868a6efcf65cb5bd56031d42941e04099 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge drawhelper convert-from and storeAllan Sandfeld Jensen2018-05-021-10/+10
| | | | | | | Avoids using an intermediate buffer on store and simplifies the code. Change-Id: I2dc4e735eb770f90dc99fe0f513b4df3b35ee793 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-04-261-0/+5
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: Ideea96d1b43d47b1d9b34e11c9986a88e240aa71
| * Fix division by zero in radial gradiants with NEONAllan Sandfeld Jensen2018-04-241-0/+5
| | | | | | | | | | | | | | | | | | The NEON implementation uses rsqrt and thus can not be taken on 0, so replace the minimum with something close to zero instead of zero. Task-number: QTBUG-59961 Change-Id: Ia39e45be675b056c1e22900495ce9ba4e8b70e5f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLars Knoll2018-04-121-0/+9
|\| | | | | | | Change-Id: I9f802cb9b4d9ccba77ca39428a5cb1afd2d01642
| * Remove last uses of interpolate_4_pixels_16 on SSE2 and NEONAllan Sandfeld Jensen2018-04-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | With SSE2 or NEON interpolate_4_pixels is faster than interpolate_4_pixels_16, and using it saves a branch of duplicated code. Similar changes had already been done other places it was used, those have been updated to follow a similar logic. Change-Id: I040d96480f7f925f659602f66f931d28b59312a5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Remove bit details from QPixelLayoutAllan Sandfeld Jensen2018-04-031-9/+4
| | | | | | | | | | | | | | | | | | They were only used for rgb swap and checking for the presence of an alpha channel. Change-Id: I013aa9035ccf4362fa3d9ecda41723e4ec5a44cb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Add generic optimized rectfill methodsAllan Sandfeld Jensen2018-03-131-0/+1
| | | | | | | | | | | | | | Also makes the qt_rectfill_quint16 actually work with any uint16 format Change-Id: Ibb3deed54ee1a0a86b14d5349c95f106ced057f7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Use simple scaling for downscaling less than 2xAllan Sandfeld Jensen2018-03-071-0/+16
|/ | | | | | | | | | | | | | The simple scaling that only samples every input pixel once, can be used with downscaling < 2x as well if we just handle the case where the input can't be in the intermediate buffer. At the same time the handling of the intermediate buffer has been moved out of simple scale helper functions so the code can be shared and the AVX2 optimizations also used for non-argb32pm formats. Change-Id: I98d225ef8d4f2978480d09110c959b556c563b57 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Unalias some core drawhelper loopsAllan Sandfeld Jensen2018-02-061-5/+13
| | | | | | | | | | Some compilers will assume src and buffer are different and only vectorize the unaliased case and take a slow path when they are equal. In our case they are as often equal, so we need to manually unalias the variables to make sure both cases are fully optimized. Change-Id: I6ec86171dd179844facdf45376253c55980d9e36 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Improve readability of code that uses the Qt signed size typev5.10.0-rc2Simon Hausmann2017-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the container BoF session at the Qt Contributor Summit 2017 the name of the signed size type became a subject of discussion in the context of readability of code using this type and the intention of using it for all length, size and count properties throughout the entire framework in future versions of Qt. This change proposes qsizetype as new name for qssize_t to emphasize the readability of code over POSIX compatibility, the former being potentially more relevant than the latter to the majority of users of Qt. Change-Id: Idb99cb4a8782703c054fa463a9e5af23a918e7f3 Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: David Faure <david.faure@kdab.com>
* | Fix narrowing warning on MSVCAllan Sandfeld Jensen2017-11-071-2/+2
| | | | | | | | | | | | Task-number: QTBUG-64307 Change-Id: I26032b71dc8fe316dddb8ce2adf6fd0a75ecf226 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Cleanup of qcompositionfunctionsAllan Sandfeld Jensen2017-11-051-7/+7
|/ | | | | | | | | | | Remove long unused preload defines, make sign of alpha more consistent and use the RGB64 define structure more. This is preparing for trying to unify the declarations in case we need a third form with floating points for HDR. Change-Id: I47fc283aff1fe31a1eaba17e0413bc1e722f6a06 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devGabriel de Dietrich2017-07-131-2/+2
|\ | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
| * Fix modernize-use-bool-literals issuesKevin Funk2017-07-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | Reported by clang-tidy. Skipped fixes in implementation files, only changed headers. Change-Id: I5cfd266b3d4046f90baebc0c538b1b6ab03a02d2 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Allow QImage with more than 2GByte of image dataAllan Sandfeld Jensen2017-07-081-2/+2
|/ | | | | | | | | | | | Changes internal data-size and pointer calculations to qssize_t. Adds new sizeInBytes() accessor to read byte size, and marks the old one deprecated. Task-number: QTBUG-50912 Change-Id: Idf0c2010542b0ec1c9abef8afd02d6db07f43e6d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>