summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Remove QT_MEMFILL_xxx macrosThiago Macieira2018-11-081-2/+2
| | | | | | | | | | | | | | | | 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-1/+1
|/ | | | | | | It expands to the same thing in all three branches. Change-Id: I343f2beed55440a7ac0bfffd15636a8bfd8fd21c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add NEON optimized ARGB32 unpremultiply routinesAllan Sandfeld Jensen2018-10-091-0/+9
| | | | | | | | Mirroring similar routines recently added for SSE4.1 Change-Id: Ibb9d10cc34655ce1dc0e97fdff4e4f6a81d47d05 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-09-271-0/+2
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/global/qconfig-bootstrapped.h src/widgets/util/qcompleter.cpp Change-Id: I4f44f0f074982530f2f2e750ce696230b2754cf3
| * Disable RGB64 backend for ARGB32 when it will be very slowAllan Sandfeld Jensen2018-09-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | Fixes a speed regression on ARGB32 painting on low end hardware introduced when it was switched to using the RGB64 raster routines. It turns out several of our embedded QPA targets use ARGB32 as native format. Task-number: QTBUG-69724 Change-Id: I6d7993c12da46a85b8354eb905930dae9602b5e6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add optimized fetch ARGB32 routines for NEONAllan Sandfeld Jensen2018-09-121-0/+6
| | | | | | | | | | | | | | | | After convert and fetch were split, only convert was still NEON vectorized, while fetch is the more commonly used version. Change-Id: Iea2af7ccee6589b3d6e9908afeaae2d1ad2753be Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-071-9/+49
|\| | | | | | | Change-Id: I66c7f18a2abd13601da0947919436f7da3549ae9
| * Avoid conversion over RGBA64 for RGB32 LCD text blendingAllan Sandfeld Jensen2018-08-301-9/+49
| | | | | | | | | | | | | | | | Short-cuts the case where there is no gamma correction to avoid a conversion over RGBA64 and back. Change-Id: I100697a9f7a4b94283557b2c0eaa45e0eff81785 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | clangcl: Fix QtGui link error (missing fetchPixelsBPP24_ssse3)Friedemann Kleint2018-08-231-3/+3
| | | | | | | | | | | | | | | | | | Do not try using SSSE3 if the compiler do not support it. (see 648ee7aa020d04b160ec56187f49f761ffab93cc). Task-number: QTBUG-50804 Change-Id: I489b0bbacfde0c647c9d5b71ca3de992d7dc8878 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Smooth image scaling for 64bit imagesAllan Sandfeld Jensen2018-08-221-37/+0
| | | | | | | | | | | | | | | | Adds support for smooth scaling 64bit images. Task-number: QTBUG-45858 Change-Id: If46030fb8e7d684159f852a3b8266a74e5e6700c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Fix big-endian buildAllan Sandfeld Jensen2018-08-211-0/+13
| | | | | | | | | | | | | | | | | | Declare rbSwap<QImage::Format_RGBA8888>, so we don't end up in a fallback definition not used by little-endian. Task-number: QTBUG-69951 Change-Id: I8512bba76da7d59a27593d37c70283d881c3e8fc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Implement support for 16bpc image formatsAllan Sandfeld Jensen2018-08-111-328/+907
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-0/+61
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| * Add missing optimization for loading RGB32 to RGBA64 using NEONAllan Sandfeld Jensen2018-08-031-0/+61
| | | | | | | | | | | | | | | | | | | | The rest of the RGB64 routines were optimized, but the loading of RGB32 was not as it was originally not used much, but with ARGB32 using the RGB64 backend, it is essential for decent performance. Task-number: QTBUG-69724 Change-Id: I1c02411ed29d3d993427afde44dfa83689d117e0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | SIMD: Add a haswell sub-architecture selection to our supportThiago Macieira2018-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the comment says, Haswell is a nice divider and is a good optimization target. I'm using -march=core-avx2 instead of -march=haswell because the latter form was only added to GCC 4.9 but we still support 4.7 and that has support for AVX2. This commit changes the AVX2-optimized code in QtGui to Haswell- optimized instead. That means, for example, that qdrawhelper_avx2.cpp can now use the FMA instructions. Change-Id: If025d476890745368955fffd153129c1716ba006 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-06-081-2/+2
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
| | * Reduce recent performance regressionAllan Sandfeld Jensen2018-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change to fix 16-bit integer overflow used two floor operations when only one is necessary. With floor being rather expensive on x86 without SSE4.1 this caused a performance regression in ARGB32 smooth perspective transforms. This eliminates one of the floor operations which is unnecessary as the number is always positive in this case and thus truncation will yield the same result faster. Change-Id: Iaae76820d4bc2f368e49ed143130b5075fc760a2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | | Optimize fetchTransformed and removed specialized versionsAllan Sandfeld Jensen2018-06-071-662/+124
|/ / | | | | | | | | | | | | | | Optimize the general transformed fetcher and use it to replace several specialized copies of it that are now slower than the general one. Change-Id: Ife79ec99227f0df4f127303c7a340b2f7d174dff Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>