summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2025-08-28 12:21:26 +0200
committerMarc Mutz <marc.mutz@qt.io>2025-08-28 19:33:58 +0200
commiteb4e880142dc49dbb429540c1cd0a972cef2967c (patch)
tree293bee857342f19006960cf479c206a05e9a7415 /src/widgets/doc/snippets
parentead796639334415ef87fed2dbf103b6fad8ec337 (diff)
QLine: de-pessimize dx()/dy()
Because of the use of checked integers in the implementation of QPoint, (pt1-pt2).x() will calculate the y value, too (using checked arithmetic, so we can't expect the optimizer to remove this as dead code). Ditto .y() and x value. This is unnecessary and introduces a failure state where there wasn't one before (e.g. if, while calling x(), pt1.xp - pt2.xp doesn't overflow, but pt1.yp - pt2.yp does). Fix by calculating the difference only for the dimension at hand, which, to keep using checked ints, requires QLine to have access to QPoint::{xp,yp}, so add friendship. Amends 1145e1709d1072f7dd45683e9c25a14615603854. Found in API-review. Pick-to: 6.10 Change-Id: I163beb65da5fc50e5c12e7a140bcfbc1d07a69a6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/doc/snippets')
0 files changed, 0 insertions, 0 deletions