Skip to content

gsk: Fix angle normalization

Alexander Larsson requested to merge alexl/gtk:fix-angle-normalization into master

I was getting assertions that normalize_angle() failed the result < 260 check. Doing some research on this it turns out to be a precision issue. If the incomming angle is very slightly below zero, then adding 360 to it may end up with exactly 360.

I simplified the code a bit to avoid division and rounding, because in practice most angles will be "just outside" the 0-360 degree anyway. And i also added a workaround for the "result is 360" case by just setting it to 0.

Merge request reports