Changeset 267581 in webkit
- Timestamp:
- Sep 25, 2020, 11:20:53 AM (6 years ago)
- Location:
- branches/safari-610-branch/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/transforms/RotateTransformOperation.h (modified) (1 diff)
-
platform/graphics/transforms/TransformationMatrix.cpp (modified) (1 diff)
-
platform/graphics/transforms/TransformationMatrix.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/Source/WebCore/ChangeLog
r267580 r267581 1 2020-09-22 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r266353. rdar://problem/69382920 4 5 Optimize the implementation of TransformationMatrix::rotate(double) 6 https://bugs.webkit.org/show_bug.cgi?id=215994 7 8 Reviewed by Tim Horton. 9 10 TransformationMatrix::rotate(angle) currently just calls TransformationMatrix::rotate3d(0, 0, 1, angle), which 11 has a fast path for the case where we're rotating about the z-axis. However, we can make this *slightly* faster 12 by omitting the hypotenuse computation, several floating point comparisons, and several assignments in this case 13 because we already know that we're just rotating about the z-axis. 14 15 This is a small (but measurable) improvement on the Multiply subtest of MotionMark, which applies a little over 16 3 million rotation transformations over the course of 30 seconds. 17 18 * platform/graphics/transforms/RotateTransformOperation.h: 19 20 Instead of calling `rotate3d`, just have `rotate` directly call `multiply` with the following 21 `TransformationMatrix`: 22 ``` 23 [[ cos(z) sin(z) 0 0 ] 24 [ -sin(z) cos(z) 0 0 ] 25 [ 0 0 1 0 ] 26 [ 0 0 0 1 ]] 27 ``` 28 ...where `z` is the angle of rotation, in radians. 29 30 * platform/graphics/transforms/TransformationMatrix.cpp: 31 (WebCore::TransformationMatrix::rotate): 32 * platform/graphics/transforms/TransformationMatrix.h: 33 (WebCore::TransformationMatrix::rotate): Deleted. 34 35 36 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266353 268f45cc-cd09-0410-ab3c-d52691b4dbfc 37 38 2020-08-31 Wenson Hsieh <wenson_hsieh@apple.com> 39 40 Optimize the implementation of TransformationMatrix::rotate(double) 41 https://bugs.webkit.org/show_bug.cgi?id=215994 42 43 Reviewed by Tim Horton. 44 45 TransformationMatrix::rotate(angle) currently just calls TransformationMatrix::rotate3d(0, 0, 1, angle), which 46 has a fast path for the case where we're rotating about the z-axis. However, we can make this *slightly* faster 47 by omitting the hypotenuse computation, several floating point comparisons, and several assignments in this case 48 because we already know that we're just rotating about the z-axis. 49 50 This is a small (but measurable) improvement on the Multiply subtest of MotionMark, which applies a little over 51 3 million rotation transformations over the course of 30 seconds. 52 53 * platform/graphics/transforms/RotateTransformOperation.h: 54 55 Instead of calling `rotate3d`, just have `rotate` directly call `multiply` with the following 56 `TransformationMatrix`: 57 ``` 58 [[ cos(z) sin(z) 0 0 ] 59 [ -sin(z) cos(z) 0 0 ] 60 [ 0 0 1 0 ] 61 [ 0 0 0 1 ]] 62 ``` 63 ...where `z` is the angle of rotation, in radians. 64 65 * platform/graphics/transforms/TransformationMatrix.cpp: 66 (WebCore::TransformationMatrix::rotate): 67 * platform/graphics/transforms/TransformationMatrix.h: 68 (WebCore::TransformationMatrix::rotate): Deleted. 69 1 70 2020-09-22 Alan Coon <alancoon@apple.com> 2 71 -
branches/safari-610-branch/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h
r234330 r267581 61 61 bool apply(TransformationMatrix& transform, const FloatSize& /*borderBoxSize*/) const override 62 62 { 63 transform.rotate3d(m_x, m_y, m_z, m_angle); 63 if (type() == TransformOperation::ROTATE) 64 transform.rotate(m_angle); 65 else 66 transform.rotate3d(m_x, m_y, m_z, m_angle); 64 67 return false; 65 68 } -
branches/safari-610-branch/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
r267276 r267581 948 948 } 949 949 950 TransformationMatrix& TransformationMatrix::rotate(double angle) 951 { 952 angle = deg2rad(angle); 953 double sinZ = sin(angle); 954 double cosZ = cos(angle); 955 multiply({ cosZ, sinZ, -sinZ, cosZ, 0, 0 }); 956 return *this; 957 } 958 950 959 TransformationMatrix& TransformationMatrix::rotate3d(double rx, double ry, double rz) 951 960 { -
branches/safari-610-branch/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
r267275 r267581 254 254 255 255 // Angle is in degrees. 256 TransformationMatrix& rotate(double d) { return rotate3d(0, 0, d); }256 WEBCORE_EXPORT TransformationMatrix& rotate(double); 257 257 TransformationMatrix& rotateFromVector(double x, double y); 258 258 WEBCORE_EXPORT TransformationMatrix& rotate3d(double rx, double ry, double rz);
Note:
See TracChangeset
for help on using the changeset viewer.