RESOLVED FIXED 215994
Optimize the implementation of TransformationMatrix::rotate(double)
https://bugs.webkit.org/show_bug.cgi?id=215994
Summary Optimize the implementation of TransformationMatrix::rotate(double)
Wenson Hsieh
Reported 2020-08-30 16:26:02 PDT
TransformationMatrix::rotate(angle) currently just calls TransformationMatrix::rotate3d(0, 0, 1, angle), which has a fast path for the case where we're rotating about the z-axis. However, we should be able to make this *slightly* faster by omitting the hypotenuse computation, several floating point comparisons, and several assignments.
Attachments
For EWS (4.33 KB, patch)
2020-08-30 16:37 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2020-08-30 16:37:21 PDT
Tim Horton
Comment 2 2020-08-30 18:44:12 PDT
Comment on attachment 407580 [details] For EWS View in context: https://bugs.webkit.org/attachment.cgi?id=407580&action=review > Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp:905 > + multiply({ cosZ, sinZ, -sinZ, cosZ, 0, 0 }); I assume something extends this with the 1s in the diagonals to preserve the other columns?
Wenson Hsieh
Comment 3 2020-08-30 21:14:10 PDT
Comment on attachment 407580 [details] For EWS View in context: https://bugs.webkit.org/attachment.cgi?id=407580&action=review >> Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp:905 >> + multiply({ cosZ, sinZ, -sinZ, cosZ, 0, 0 }); > > I assume something extends this with the 1s in the diagonals to preserve the other columns? Indeed — this uses the a, b, c, d, e, f constructor for TransformationMatrix, which ensures that the last two values along the diagonal are 1: constexpr TransformationMatrix(double a, double b, double c, double d, double e, double f) : m_matrix { { a, b, 0, 0 }, { c, d, 0, 0 }, { 0, 0, 1, 0 }, { e, f, 0, 1 }, } { }
EWS
Comment 4 2020-08-31 08:15:04 PDT
Committed r266353: <https://trac.webkit.org/changeset/266353> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407580 [details].
Radar WebKit Bug Importer
Comment 5 2020-08-31 08:16:19 PDT
Note You need to log in before you can comment on or make changes to this bug.