summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
Commit message (Collapse)AuthorAgeFilesLines
...
* Doc: Fix QDoc warnings for overloadsPaul Wicking2024-02-141-0/+2
| | | | | Change-Id: I9a77b6ea0026748c7f97f73b327118f7a9212d52 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add QPlatformIntegration::BackingStoreStaticContents capabilityTor Arne Vestbø2024-02-131-0/+7
| | | | | | | | | | | | | | This was a feature in Qt 4, but the only platform that carried it over to Qt 5 was Windows, in ab76593f18396e693f24066592244ca95e135ea2, and that's still the situation. As a first step in possibly implementing this on more platforms, lets replace the hard-coded check in QWidgetRepaintManager::hasStaticContents with a proper QPlatformIntegration capability check in the only call site. Pick-to: 6.7 Change-Id: I2067109f45116cd8c62facf7224cd748f19e845b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QBackingStore: Take DPR into account when resizing with static contentsTor Arne Vestbø2024-02-131-1/+2
| | | | | | | | | | The plumbing from QBackingStore::resize to the platform backing store was missing a high-DPI conversion for the backing store's static contents, which is also expressed in the QtGui coordinate system. Pick-to: 6.7 6.6 6.5 6.2 Change-Id: Ifaac916cbf184b9386aa5feca1577a53bf2906ed Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QPixelLayout: remove explicit array sizesGiuseppe D'Angelo2024-02-102-10/+19
| | | | | | | | | | | | | | | | | | | For qPixelLayouts, there's a static_assert right below it that checks that the array has a specific size, as a guard for extending QImage::NImageFormats without also extending the array. Giving an explicit size to qPixelLayouts defeats the entire purpose. For the other arrays of function pointers, drop the sizing and add the missing static_asserts. Use std::size as a drive-by. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Ic791a706a8ae964e3aee482f23b7eeeedf97bdc6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPdfWriter: doc fixGiuseppe D'Angelo2024-02-101-1/+1
| | | | | | | | When switching the default to Auto, forgot to also fix the corresponding method documentation. Change-Id: I4169680b6833a2ea381d950a3a7fad005c14bc71 Reviewed-by: Albert Astals Cid <aacid@kde.org>
* Remove extra semi-colonsTasuku Suzuki2024-02-062-2/+2
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* core/gui: fix odr violationTim Blechmann2024-02-061-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | When linking Qt statically, QtCore and QtGui are not separated into different DSOs. when both statically linked versions of QtCore and QtGui are linked into the same binary with LTO, gcc emits: ``` /usr/src/debug/qtbase/6.3.0-r0/git/src/gui/painting/qicc.cpp:105: warning: type ‘Tag’ violates the C++ One Definition Rule [-Wodr] /usr/src/debug/qtbase/6.3.0-r0/git/src/corelib/kernel/qtranslator.cpp:78: note: an enum with different value name is defined in another translation unit /usr/src/debug/qtbase/6.3.0-r0/git/src/gui/painting/qicc.cpp:106: note: name ‘acsp’ differs from name ‘Tag_End’ defined in another translation unit /usr/src/debug/qtbase/6.3.0-r0/git/src/corelib/kernel/qtranslator.cpp:78: note: mismatching definition ``` we therefore define the `struct Tag` in an anonymous namespace or the QIcc namespace Change-Id: Ib4edeede35c51322ab1959d70fb87359b196e59b Pick-to: 6.5 6.6 6.7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPdfWriter: use DeviceGray when in Grayscale modeGiuseppe D'Angelo2024-02-031-6/+17
| | | | | | | | | | | | | QPdfWriter has "always" supported a grayscale mode in order to support grayscale printing from QPrinter. When in this mode, colors were still emitted as RGB, just with equal quantities for each channel. But the PDF format itself supports grayscale colors, so avoid the conversions and emit colors directly in that. Change-Id: Id5ec3bc42b710909f32986c59d8fbd6f748e02f9 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* QPdfWriter: switch the default color model to AutoGiuseppe D'Angelo2024-02-032-2/+3
| | | | | | | | | | | | | If a user specifies a color in CMYK, save it in CMYK by default (instead of converting it to RGB). [ChangeLog][QtGui][QPdfWriter] QPdfWriter by default will now save CMYK colors in CMYK, instead of converting them to RGB. You can use the setColorModel() function to restore the previous behavior. Change-Id: I2a699f99d44c106d59bf0e32c11f9cf9999d16e8 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Add CMYK support for pens/fills in the PDF engineGiuseppe D'Angelo2024-02-024-46/+290
| | | | | | | | | | | | | | | | | | | | | | | Insofar, painting with a CMYK color (pen/brush) was completely ignored by QPdfWriter, although the PDF format can faithfully represent CMYK colors. This commit adds support for CMYK colors in the PDF engine. The support is opt-in, in the name of backwards compatibility; an enumeration on QPdfWriter controls the output. QPrinter was using a hidden hook in QPdfEngine in order to do grayscale printing; this hook can now be made public API through the same enumeration. This work has been kindly sponsored by the QGIS project (https://qgis.org/). [ChangeLog][QtGui][QPdfWriter] QPdfWriter can now use CMYK colors directly, without converting them into RGB colors. Change-Id: Ia27c19ec81a58ab68ddc8b9c89c4e57d7d637301 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Doc: Fix argument names in QRgbaFloat::fromRgba64() \fn signatureTopi Reinio2024-02-011-1/+1
| | | | | | | | | | | | | Fixes the following documentation warnings: (qdoc) warning: Undocumented parameter 'r' in QRgbaFloat::fromRgba64() (qdoc) warning: No such parameter 'red' in QRgbaFloat::fromRgba64() (Which repeat for green, blue, and alpha.) Pick-to: 6.7 Change-Id: I22d281b716865eec649b9fb63f2113f982fdf8ea Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QPainterPath: Fix boundingRect and controlPointRect ignoring start pointNoah Davis2024-01-302-3/+16
| | | | | | | | | | | | | | | | | | | | | | The boundingRect and controlPointRect did not use the start point from the `QPainterPath(const QPointF &startPoint)` constructor until the `dirtyBounds` or `dirtyControlBounds` member variables were set to true. Those two are false on construction. This bug was fixed by adding a new constructor for QPainterPathPrivate that initializes the `elements`, `bounds` and `controlBounds` member variables with the start point from the constructor. There is also an autotest to verify that the top left of the boundingRect and controlPointRect are at the same position as elementAt(0) when the start point constructor is used. [ChangeLog][QtGui][QPainterPath] boundingRect() and controlPointRect() now use the start point from QPainterPath(const QPointF &startPoint). Pick-to: 6.7 6.6 6.5 Change-Id: I7bf30364406c14ed60f75d24b78a9a5535f75d93 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Make sure the sqrt value in qdrawhelper is non-negativeJacek Poplawski2024-01-231-1/+10
| | | | | | | | | | It's possible for the "det" variable to exceed 0 and be negative. This scenario is already handled in one case, this change will fix second case. Pick-to: 6.7 Fixes: QTBUG-120907 Change-Id: Ib30213b3455b5c6f3b8b8384e78e7b43158f93b5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix FP rasterization on Win-x86Allan Sandfeld Jensen2024-01-182-30/+30
| | | | | | | | We can not guarantee 128bit alignment on 32bit windows Pick-to: 6.7 Change-Id: I16bd3bded16bd29f4cb84b0cdf2671e4d9a19601 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRhiBackingStore: Support flushing child windows with same surface typeTor Arne Vestbø2024-01-161-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | As long as the surface type of the child window is the same as the one owning the backingstore we can flush it through the same code path as for the top level window. This code path was already exercised by QWidgetRepaintManager::flush(), by calling rhiFlush() directly, but we now support it in those (rare) cases of non-Widgets windows using a single QBackingStore for a full window hierarchy. A future improvement would be to decouple the RHI configuration from the backingstore, so that we can flush child windows with different surface types through the same backingstore. This is relevant for platforms that rely on QRhiBackingStore exclusively (iOS and Android), as in widgets we currently only switch the top level widget surface type when enabling RHI based flushing, leaving all child windows with QWindow::RasterSurface. This could potentially be solved by teaching widgets to re-configure all QWidgetWindows, including children. Task-number: QTBUG-119309 Change-Id: Ifa3fe6125493ac1becd2538ba84f3b4a5e3a5d71 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Simplify QTransform mappingAllan Sandfeld Jensen2024-01-111-49/+4
| | | | | | | | | | The generic map can handle projective including the clip, so remove the unneeded specialized paths. The only remaining projective codepath is for painter paths which can include curves. Change-Id: I78fb86c9fe8ce8f126861ccad08c5b29f98c6b05 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix premultiply of RGB64 formatsAllan Sandfeld Jensen2024-01-112-0/+5
| | | | | | | | | | Alpha was also multiplied, leading to wrong alpha values. Change-Id: Ic452b21f5f02898074552afd68440193b60799c1 Pick-to: 6.7 6.6 6.5 6.2 Fixes: QTBUG-120614 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Remove dead links to Concentric Circle ExampleKai Köhne2024-01-091-1/+1
| | | | | | | | Amends 33254fb41f29b510d Pick-to: 6.6 6.7 Change-Id: I81fee9ba277fdc6f3609440ddcf69cf7c3924c70 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* [docs] Remove references to C++11 feature availabilityMarc Mutz2024-01-091-1/+1
| | | | | | | | | | | | | QVersionNumber, e.g., was added for Qt 5.6, the last Qt version that didn't require C++11. So it made sense that the original documentation stated that certain functions were only available in C++11 mode. But already Qt 5.7 required C++11, so these historical anecdotes are no longer pertient to today's Qt users, so remove them from the docs. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I5c732d3b9b33e1fb6947eff4fac546476c8379f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRadialGradient: Fix undefined behaviorHatem ElKharashy2024-01-082-6/+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>
* Deduplicate mapping code in QTransformAllan Sandfeld Jensen2023-12-271-118/+10
| | | | | | | | | Also means these mapping can now also handle overflowing perspective better. Pick-to: 6.7 Change-Id: Id506634c445521f1b041ec2e9051aa499c24671b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Turn the "concentriccircles" example into snippets, update screenshotVolker Hilsheimer2023-12-141-13/+11
| | | | | | | | | | | | | The example has a lot of code and documentation, but in essence shows how to use float-based QPainter APIs and how to set a render hint. That is two lines of code, which we can show as snippets. Update the screenshot of the example with a higher-resolution version. Pick-to: 6.7 6.6 Fixes: QTBUG-119983 Change-Id: Iafcb813dff6ab8c269176f7994c95947ebf5e559 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* pagelayout: Fix inaccuracy in marginsPixels and paintRectPixelsJarkko Koivikko2023-12-091-6/+6
| | | | | | | | | | | | | | | | | | | Do not use rounded value for conversion, which gives inaccurate result. Example case: typical margin for A4 paper size is 8.4 pt. At 600 dpi, the old code was using rounded point value of 8, which produces an incorrect result: 8 / (72.0 / 600) = 67 pixels The correct margin is of course: 8.4 / (72.0 / 600) = 70 pixels Pick-to: 6.6 Change-Id: I44b2eeabb82fd3bf8e2dcfcba66ae96cde763875 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* pagesize: Fix pixel overflow in QPageSize::sizePixels and rectPixelsJarkko Koivikko2023-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | This update addresses an issue in converting page size from points to device pixels. Previously, rounding the result could lead to an overflow beyond the physical pixel capacity. Example case: A4 paper size at 600 dpi: - points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667 However, the physical pixel height for an HP printer: - GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016 This fix prevents pixel size from exceeding the physical print area, avoiding unprinted pixels. Pick-to: 6.6 Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com>
* print: QPageLayout: Fix pt unit conversionJarkko Koivikko2023-12-091-28/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corrects the miscalculation in point unit conversion, ensuring correct margin updates. Previously, non-pt units were rounded to two decimal places. When converting back to pt, rounding was to zero decimals, making the result always less than the original. This could result in margins falling below the minimum allowed. Example: original_points = 8.4 multiplier = 2.83464566929 mm: qRound(8.4 / multiplier * 100) / 100 = 2.96 new_points: qRound(2.96 * multiplier) = 8 // wrong! The fix rounds back-converted values up to two decimals, ensuring they are never less than the original and thus stay above minimum margins. new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4 Also, remove unused function qt_convertPoint. Pick-to: 6.6 Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8 Reviewed-by: David Faure <david.faure@kdab.com>
* Use linear filtering with downscaling also with QOpenGLWidgetLaszlo Agocs2023-12-061-10/+9
| | | | | | | | | | Amends 9505305c403423f58e70471aaf55994bb734a0bd Fixes: QTBUG-119444 Pick-to: 6.6 6.5 Change-Id: I88c31bcdf42ac4ffef122e49f088cc764db8c384 Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Raster painting: Correct the coordinate rounding in drawPoints()Eirik Aavitsland2023-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When using the cosmetic stroker (i.e. plain pens with effective line width of 1), drawing points with fractional coordinates >= 0.5 would fill the wrong pixel. This is a long-standing bug where the drawPoints() code in the cosmetic stroker code was missed during the painting coordinate system shift for Qt 5.0. Prior to that, coordinates were interpreted as the upper left corner of a pixel, so rounding fractional coordinates to the closest integer would be the correct way to determine the pixel to be filled. From Qt 5 onwards however, coordinates instead designate the center point of the primitive to be stroked. In order to determine which pixel is most covered by the unit square centered in the given coordinates, fractional coordinates must be rounded downwards (floored). This fix makes the behavior consistent between the cosmetic and non-cosmetic stroker, so that drawPoints() with e.g. penwidths 1 and 1.01 in practice fills the same pixels. Pick-to: 6.6 Fixes: QTBUG-119306 Change-Id: I39cb7ad55229553dda098e6fbc9ee449b1fd9664 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QPainter: support painting at DPR < 1Morten Sørvig2023-11-231-2/+2
| | | | | | | | | | | | | | | | QPainter was clamping the DPR at 1, which makes Qt paint a blank window when the DPR is less than 1. Fix by not clamping and treating only DPR == 1 as a special case. This is particularly relevant on Qt for WebAssembly where the user can set the page scale to a value less than 100%. Fixes: QTBUG-111787 Change-Id: Iaa1f7a9b7837dd933c28380b5049422dc1ce9657 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add initial implementation of macOS and iOS icon theme implementationsVolker Hilsheimer2023-11-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | From macOS 13 on, AppKit provides an API to get a scalable system image from a symbolic icon name. We can map those icon names to the XDG-based icon names we support in Qt, and render the NSImage with palette-based coloring when needed, in an appropriate scale. On iOS, we can use the equivalent UIKit APIs. Coloring functionality is only available from iOS 15 on. Implement a QAppleIconEngine that does that in its scaledPixmap implementation. Use basic caching to store a single QPixmap version of the native vector image. We regenerate the pixmap whenever a different size, mode, or state is requested. Add a manual test for browsing all icons we can get from the various Qt APIs that: standard icons and pixmaps from QStyle, QPlatformTheme, and QIcon::fromTheme, in addition to showing all icon variations for a single QIcon. Task-number: QTBUG-102346 Change-Id: If5ab683ec18d140bd8700ac99b0edada980de9b4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QCssUtil: use std::array instead QPolygonFChristian Ehrlicher2023-11-201-10/+10
| | | | | | | | Use std::array<QPointF, 4> instead a dynamic QPolygonF since there is no dynamic allocation needed here. Change-Id: I45e124de7db7263c9291e169165bf74174f032a6 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* iOS: add helper to convert UIImage to QImageVolker Hilsheimer2023-11-172-3/+30
| | | | | | | Going through the UIImage.CGImage flattens the image to monochrome. Change-Id: If74c33badb4e94253b3bf21b6d69bb9f521d6bff Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make all QPainter operations warn if there's no engineSergio Martins2023-11-111-10/+30
| | | | | | | | | | | | | Otherwise, for example fillRect() will fail silently. Most operations already had the warning, but some were missing it. Pick-to: 6.6 Change-Id: I1ef6bf880d5b0722baadcf0ced68a968f0b1a070 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Fix findNearestColor for semitransparent colorsAllan Sandfeld Jensen2023-11-091-3/+2
| | | | | | | | | The two destcolors and the buffer are all already premultiplied. This would double premultiply them. Pick-to: 6.6 6.5 6.2 Change-Id: I235bee616d8e0033b87c6f96464f0926af7bd29a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix multiple threads accessing same byteAllan Sandfeld Jensen2023-11-091-1/+2
| | | | | | | | | We can not thread mono image formats as the bit access isn't atomic. Pick-to: 6.6 6.5 Fixes: QTBUG-117494 Change-Id: Ica8e08fc3da73983f6b4da2a133f5e715fd0d787 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix alpha channel logic in QRhiBackingStoreLaszlo Agocs2023-10-312-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mirror what other platforms such as Windows or xcb do. Those all unconditionally upgrade a non-alpha format such as RGB32 to something like ARGB32_Premultiplied (or whatever qt_maybeAlphaVersionWithSameDepth returns). Without this, there is a discrepancy between macOS and the other platforms when using QOpenGLWidget or QQuickWidget (which trigger the usage of QRhiBackingStore). For example, attempting to have semi-transparent raster widget content over the RHI-based widgets will render incorrectly. This is visible in 6.7 (dev) with the cuberhiwidget example as well: the red semi-transparent overlay is rendered incorrectly on macOS since QRhiBackingStore sticking with a QImage of RGB32 has far-reaching consequences. Upgrading to an alpha format is also required by the "hole punching" mechanism the texture-based widget system relies on, although there is a suspicion that that just happens to look correct with RGB32 as well since there is an alpha channel technically with that format, and alpha writes may not be masked out, depending on painting internals, ending up with RGBA content in practice. But in other cases, like in the report and the one mentioned above this clearly breaks down. Fixes: QTBUG-118553 Pick-to: 6.6 6.5 Change-Id: I4b5b7a4f720377d64903e948b866f8d1c443a2d2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QRasterBackingStore: check format alpha presence in a more generic wayLaszlo Agocs2023-10-311-1/+1
| | | | | | | | | | | | | ...instead of hardcoding a format such as ARGB32_Pre. A subclass may override format() after all. A few lines below there is the same check in fact, but this time with hasAlphaChannel(). To be consistent, switch over to hasAlphaChannel() in the first case as well. Pick-to: 6.6 6.5 Change-Id: I7a5653863a72f8a0df98da66290f6d17e548b0a8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Modify copyright format in qt_attribution.jsonLucie Gérard2023-10-231-5/+5
| | | | | | | | | Multiline copyright entries are entered via string array. Task-number: QTBUG-111873 Pick-to: 6.5 6.6 Change-Id: Ib8203163db8d5d579117f402b7a89b59ae1a5169 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Sync also the profile env.var between Quick and RHI backingstoresLaszlo Agocs2023-10-161-2/+5
| | | | | | | | | Amends ffb857e9d0745fdd31bca091333f1120c5857d7b. Pick-to: 6.6 6.5 Task-number: QTBUG-118116 Change-Id: Ifb55130fd66b8ea1446363ae22f11cfe4f4d48bb Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Doc: Add missing return type to QRgbaFloat::fromRgba*Luca Di Sera2023-10-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QDoc reads an `\fn` command it saves it to a file to parse it with Clang, with the objective of using the produced AST to perform certain sanity checks on the documented element. Generally, `\fn` commands that do not represent correct C++ code are accepted as long as Clang is still able to build an AST Node that QDoc can work with, not resulting in any issue in the output documentation. For example, an `\fn` that doesn't state a return type might be able to be parsed correctly enough by Clang to produce a sensible Node for the function that QDoc is interested into. The documentation for the various `QRgbaFloat::fromRgba*` make use of this possibility by not stating a return type. Up to Clang 15 this was not an issue, and a correct-enough AST was produced when the `\fn` commands for those methods were parsed. On Clang 16, Clang chokes on the missing return type, being unable to recognize the function definition and produce an AST that QDoc can work with. This has the effect of losing those documented element in the output documentation. To avoid the issue, a return type is now added to the relevant `\fn` commands. Task-number: QTBUG-111580 Change-Id: Id9d8a713caf7d6cbb4d2de1040ce5ea5092f7b14 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Avoid generating corrupt pdf output for out of range coordinatesEirik Aavitsland2023-10-101-3/+3
| | | | | | | | | | | | | | | | | | | | | The local qreal to string conversion would fail and produce unsyntactic output if the integer part exceeded the range of an unsigned int. Introduce check for that, and fall back to just output a 0 value instead in such cases. Testing indicates that there is no point in supporting values beyond 4G, as pdf readers do not seem to accept higher values anyway. As a driveby, also extend the check to catch all non-finite real values, not only nan. As a second driveby, simplify the splitting of a qreal into integer and fraction parts by just using the std library function for that. Fixes: QTBUG-117740 Pick-to: 6.6 6.5 Change-Id: I247b0612bd565fb2e6f47a182e74f19b8bb0d683 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Fix QRgbaFloat function signaturesTopi Reinio2023-09-291-4/+4
| | | | | | | | | Commit baac34de modified the set[Red|Green|Blue|Alpha] function signatures. Amend the \fn commands to reflect those changes. Pick-to: 6.6 Change-Id: I947995fc5c80baac111a04272cd848961c22eb73 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPen: port to QESDPGiuseppe D'Angelo2023-09-263-89/+64
| | | | | | | | | | | | | | Move from a manually managed d-pointer to QESDP. This is a long overdue change (QPen is one of the few classes still with manual management). At the same time: it's also one of the central classes, and in order to keep the impact minimal (and binary compatible), I'm not switching to something more sophisticated. As a drive-by: drop QPenData, a remnant only used by QPen itself, which nowadays is simply a typedef for QPenPrivate. Change-Id: I38834116d7d383f29bb69ff20b0a46dfe951bb53 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Switch QRgbaFloat api to hardcoded float parameter and return valuesAllan Sandfeld Jensen2023-09-201-13/+13
| | | | | | | | | | This makes it source compatible with Qt 6.5 by allowing us to change FastType to something other than float, which we have done for Qt 6.6 on systems with AVX float16 instructions. Pick-to: 6.6 6.6.0 Change-Id: I7ebf0c178ba0ff7f04f6788d182a1a000fe31c0c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Backing store compositor: Use smart pointers for some QRhi resourcesLaszlo Agocs2023-09-192-46/+39
| | | | | | Pick-to: 6.6 6.5 Change-Id: I005b2efe23c7dda0b15d2156708055f3b96681fc Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Sync rhi backingstore d3d12 behavior with QuickLaszlo Agocs2023-09-191-1/+7
| | | | | | | | | | | | When adding the D3D12 code path in widgets it seems it was ignored that the retry-with-WARP logic was present both for D3D11 and 12 in Qt Quick. For consistency, the same logic must be used. Right now widgets only has the retry logic for D3D11. Pick-to: 6.6 Change-Id: I08d5728acfb9a68db7e0a4b0477050f08546ffac Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Sync rhi backingstore prefer-software env.var with QuickLaszlo Agocs2023-09-181-0/+5
| | | | | | | | | | | | | Behaving differently in QQuickWindow vs. a QRhi-based widget window is not great for WebEngine. The env.var naming is not the best (QSG prefix) but we already have some precedent for this (recognizing QSG_INFO in QRhi), and there is no other choice anyway. Pick-to: 6.6 6.5 6.6.0 6.5.3 Task-number: QTBUG-116445 Change-Id: Ibfd495cbd1d42502441d6629325bdeb033e813f3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Round the image scaling when not antialiasedKaj Grönholm2023-09-131-1/+8
| | | | | | | | | | | When painting an image with antialiasing not turned on, round the target area to closest integers (pixels). Task-number: QTBUG-116297 Pick-to: 6.6 Change-Id: I64e78a9087ee042aef0ea297c48b5ead36697d10 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* QPolygon(F): streamline the QDebug streaming operatorGiuseppe D'Angelo2023-09-111-12/+2
| | | | | | | | | | | | | | | | | | | Just re-use the private functionality present elsewhere. As a drive-by fix this will also properly separate the individual points with commas, making the output readable again. Before: > QPolygonF(QPointF(0,0)QPointF(93.75,0)QPointF(93.75,62.5)QPointF(0,62.5)) After: > QPolygonF(QPointF(0,0), QPointF(93.75,0), QPointF(93.75,62.5), QPointF(0,62.5)) Change-Id: I0cf0408bfb2fe72974e4dbd5d2958c5a2aa56b5f Pick-to: 6.6 6.5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* gui: use const methods moreAnton Kudryavtsev2023-09-092-3/+3
| | | | | | | to avoid implicit detach Change-Id: I2c7ae56e0866941e0f0b040129bfc40a9a961f3c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove redundant QPair includesAhmad Samir2023-09-061-1/+0
| | | | | | | | Nothing in those files uses QPair; and a local build finished fine without them. Task-number: QTBUG-115841 Change-Id: I669cfecaa9129bce6b31e464826287f138b159db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>