Skip to content
Verified Commit 8a18babc authored by ivan tkachenko's avatar ivan tkachenko 🗯
Browse files

Add scaling and rotation support to a blur behind desktop plasmoids

This patch implements the math behind offset+rotate+scale transformation
to replicate geometry of applet container and apply it to cut a
sufficient subrect of wallpaper, and to adjust mask's positioning.

Original patch contained true affine transformation matrix, performed
dot-product with a packed matrix of augmented vectors that represent 4
corners of an original rect {x,y,x+width,y+height}, and then picked 4
min/max, x/y values.

This new alternative approach is about 3 times faster, as measured by a
benchmark[1], and represents an optimized by hands variant of rotation
and scaling operations with manual offset adjustment. Not as flexible,
but tailored to a specific use-case, faster and shorter.

Though none of these clever tricks would be needed if QMatrix::mapRect
method exposed to QML lands[2] some time in Qt 6.

PS Special thanks to linear algebra courses from university. This is
probably the first time I got to apply such knowledge since graduation.

[1]: $2379
[2]: https://codereview.qt-project.org/c/qt/qtdeclarative/+/438080

See also: cede2681


Co-Authored-By: default avatarNiccolò Venerandi <niccolo@venerandi.com>

(cherry picked from commit 06ee4dee)
parent 707762ed
Pipeline #247682 passed with stage
in 10 minutes and 49 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment