summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Optimize RGBA64PM->RGBA64 for SSE4Allan Sandfeld Jensen2021-02-031-0/+4
| | | | | | | | 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-031-4/+4
| | | | | | | | 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>
* 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 scaling of basic patterns under HiDPIAllan Sandfeld Jensen2020-11-131-3/+5
| | | | | | | | | 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-1/+1
| | | | | | | | 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>
* Fix one check for AVX2Allan Sandfeld Jensen2020-07-101-1/+1
| | | | | | | | | | | | We should check for the haswell set of features here as well, as we do in the main switch. Not that there are supposed to be any processors with AVX2 without the full set though. Pick-to: 5.15 Change-Id: Ifa648d605a50748cff21ae0a0c75ae47f620d9c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-36/+36
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-3/+3
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Split PixelLayout to separate source fileAllan Sandfeld Jensen2020-05-111-1575/+6
| | | | | Change-Id: I0beafa39d92550ea78e78a07b25ce1253cc6668d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Template fetching of pixels for perspective transformed bilinearAllan Sandfeld Jensen2020-05-061-121/+79
| | | | | | | | We already templated the affine fetch logic to de-doublicate code, this does the same with the perspective transform logic. Change-Id: Ief58b8cc36af8abcdd5cbd1c4ca614567c1c99b9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Compile fixes for clang10Lars Knoll2020-04-151-9/+9
| | | | | | | Fix some warnings that are flagged as errors on clang10. Change-Id: I906634c8b2bd94db42d74a7f3d10efb086e373cc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-081-10/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * Extend tiled optimization in 64-bit painting to 64-bit sourcesAllan Sandfeld Jensen2020-03-241-4/+10
| | | | | | | | | | Change-Id: I74b88781d631ee68822cd08f9cb0aca03f7b688e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * Add SSE2 optimized solid source compositionAllan Sandfeld Jensen2020-03-201-0/+6
| | | | | | | | | | | | | | Very similar to source-over, but have traditionally been inlined. Change-Id: I211f0b1c91c1a00c4769fbbfe2e3d0c7b22d7048 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * QDrawHelper cleanupsAllan Sandfeld Jensen2020-03-191-6/+4
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Make bytes-per-line safe for int overflowAllan Sandfeld Jensen2020-02-201-1/+1
|/ | | | | | | | Goes through the Qt code and make sure bytes-per-line calculations are safe when they are too big for 32bit integers. Change-Id: I88b2d74b3da82e91407d316aa932a4a37587c0cf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-061-1/+5
|\ | | | | | | | | | | | | Conflicts: src/corelib/kernel/qvariant.h Change-Id: I8f3873e74b9795ac889e7c7ec5de2619bca92160
| * Fix semi-transparent text on Linux with subpixel anti-aliasingAllan Sandfeld Jensen2020-01-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | The newly optimized rgbBlend function wasn't updated to handle SourceOver compositing when dealing with semi-transparent text color. The extra composition isn't SIMD optimized but short-cut for all opaque colors. Fixes: QTBUG-80982 Change-Id: I88c1e60fd5e80a8c7f9e6b0e7de8248c7c00ebc2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-46/+46
|/ | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix text-rendering regression on semi-transparent background on LinuxAllan Sandfeld Jensen2019-10-311-2/+2
| | | | | | | | | | The short-cut for semi-transparent backgrounds has to take precedence over the disabled gamma-correction short-cut. The order got inversed in one function during 5.14 refactoring. Change-Id: I0e54428839428068b602a13eddbf69897ed0797d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix crash with gamma-corrected text blending disabledAllan Sandfeld Jensen2019-09-231-4/+10
| | | | | Change-Id: I7e3ca78278bf8bf2dda44711eb57d64aa6f455ce Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Handle transparent pen color in fast text pathAllan Sandfeld Jensen2019-09-221-92/+95
| | | | | | | | | | 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>
* Combine BGR30_to_RGB30 and BGR888_to_RGB888Allan Sandfeld Jensen2019-09-051-2/+4
| | | | | | | And let the meat of the function be shared with the rbSwap routine. Change-Id: I0ea18b30c26ff050c17dcb3ad4d654bfbb8c6221 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Introduce QImage::Format_BGR888Allan Sandfeld Jensen2019-08-231-2/+26
| | | | | | | | | Is pretty common on some architectures so we can avoid swizzling by supporting it. Fixes: QTBUG-45671 Change-Id: Ic7a21b5bfb374bf7496fd2b2b1252c2f1ed47705 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-08-151-1/+1
|\ | | | | | | Change-Id: Icc80dacbca8613f2996be75553ff15d0ad242b7e
| * Fix crash in optimized solid fills on RGBA64PMAllan Sandfeld Jensen2019-08-141-1/+1
| | | | | | | | | | | | | | Was expecting destStore64 to be non-null. Change-Id: I4fc827256630a35e0669d405c04f9b5b7e71580e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-221-5/+22
|\| | | | | | | | | | | | | Conflicts: qmake/generators/makefile.cpp Change-Id: Ib3715e626f2fd32804c75c16ea9aa06a1216e76d
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-201-5/+22
| |\ | | | | | | | | | Change-Id: Ic34021fbb87d689ee23a5d1b3f50617ada9ec9b9
| | * Protect against integer overflow in painting transformed imagesAllan Sandfeld Jensen2019-07-191-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Makes it safe to sample pixel coordinates above 32767. Fixes: QTBUG-76829 Change-Id: I5965afef1bd65106fcfc130dd37572309eacbe42 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-06-201-11/+26
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/network/ssl/qsslsocket_openssl.cpp src/widgets/styles/qstylesheetstyle.cpp Change-Id: Ibe1cd40f46a823c9e5edbe0a3cd16be1e1686b17
* | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-06-251-11/+26
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/android/qandroidinputcontext.cpp src/widgets/styles/qstylesheetstyle.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
| * | Raster paint engine: optimize rect clippingLars Knoll2019-06-111-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More aggressively skip processing empty spans. Tested with the qpainter benchmark on armv7; yields small but measurable improvement. Change-Id: Ie0ed0f824a0be7bcc2de3a9aa98ebccb0e8accae Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | | Make the 64 bit raster backend an optional featureAllan Sandfeld Jensen2019-04-091-91/+331
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Long live QColorSpace and friendsAllan Sandfeld Jensen2019-02-081-11/+11
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds QColorSpace and QColorTransform classes, and parsing of a common subset of ICC profiles found in images, and also parses the ICC profiles in PNG and JPEGs. For backwards compatibility no automatic color handling is done by this patch. [ChangeLog][QtGui] A QColorSpace class has been added, and color spaces are now parsed from PNG and JPEG images. No automatic color space conversion is done however, and applications must request it. Change-Id: Ic09935f84640a716467fa3a9ed1e73c02daf3675 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Add AVX2 version of ARGB->ARGB32PMThiago Macieira2019-01-091-2/+15
| | | | | | | | | | | | | | | | Similar to the previous commit. This also removes the SSE4 implementations from Qt builds that use AVX2 throughout. Change-Id: I251f00d706d646ed87b4fffd1577f96ed52a4cf4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Add AVX2 version of the ARGB32->RGBA64PM codeThiago Macieira2019-01-091-0/+9
| | | | | | | | | | Change-Id: I251f00d706d646ed87b4fffd1577f84854e358a4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Optimize ARGB32->RGBA64PM betterAllan Sandfeld Jensen2019-01-081-20/+28
| | | | | | | | | | | | | | | | This conversion is critical for ARGB32 painting, and no compiler optimized the premultiplication efficiently. Change-Id: Iee137c2f7020246478d09e880a7a1bf2ed3c6fd4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add Grayscale16 Image FormatAllan Sandfeld Jensen2018-12-121-3/+86
| | | | | | | | | | | | | | | | | | | | [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 an SSSE3 implementation of qt_memfill24Thiago Macieira2018-12-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Brought to you by the PSHUFB instruction, introduced in SSSE3 (implementation also uses PALIGNR just because we can). The tail functionality makes use of the fact that the low half of "mval2" ends in the correct content, so we overwrite up to 8 bytes close to the end. Change-Id: Iba4b5c183776497d8ee1fffd15646a620829c335 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Add a qt_memfill24 implementationAllan Sandfeld Jensen2018-12-121-0/+37
| | | | | | | | | | | | | | | | | | | | 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/+10
| | | | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-12-041-32/+32
|\| | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
| * Fix alignment of temporary QRgba64 buffers on win32Allan Sandfeld Jensen2018-11-301-32/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The alignment of long long on 32-bit windows is only 32-bits, but we should be safe to assume it is aligned at 64-bit. Since QRgba64 is a public type, we can't fix the alignment there without breaking ABI, so instead fix it where temporary buffers are allocated. At the same time be consistent about using QRgba64 so we can switch to it enforcing alignment in Qt6. Change-Id: Ie15c305bc867c62a13df8eb2b1678e92174e1f97 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Generalize fill span optimizationAllan Sandfeld Jensen2018-11-161-16/+52
| | | | | | | | | | | | | | | | | | | | This was added to RGB64 rendering because pixel conversions could be expensive, but when painting to non-standard imageformats, the same can also be expensive in the generic 32-bit backend, and thus benefit from the optimization as well. Change-Id: I747a398670b1d4dbd844a772e7aafce3c8dbef20 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Cleanup gradient blendingAllan Sandfeld Jensen2018-11-161-132/+112
| | | | | | | | | | | | | | | | | | 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>
* | Move qt_memfill32-based implementation of qt_memfill16 to genericThiago Macieira2018-11-111-16/+9
| | | | | | | | | | | | | | | | | | | | The SSE2 implementation and the one in qdrawhelper.cpp are almost identical. And if we make it so qt_memfill16 can tail-call to qt_memfill32, there's no need for inlining, so there's no need to keep it in qdrawhelper_sse2.cpp Change-Id: I343f2beed55440a7ac0bfffd15637027771c2254 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Use qsizetype for qt_memfill functionsThiago Macieira2018-11-111-3/+3
| | | | | | | | | | | | | | 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-39/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>