-
ivan tkachenko authored
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]: plasma/plasma-workspace$2379 [2]: https://codereview.qt-project.org/c/qt/qtdeclarative/+/438080 See also: cede2681 Co-Authored-By: Niccolò Venerandi <niccolo@venerandi.com> (cherry picked from commit 06ee4dee)