Changeset 266353 in webkit
- Timestamp:
- Aug 31, 2020, 8:14:57 AM (6 years ago)
- Location:
- trunk/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
-
trunk/Source/WebCore/ChangeLog
r266351 r266353 1 2020-08-31 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Optimize the implementation of TransformationMatrix::rotate(double) 4 https://bugs.webkit.org/show_bug.cgi?id=215994 5 6 Reviewed by Tim Horton. 7 8 TransformationMatrix::rotate(angle) currently just calls TransformationMatrix::rotate3d(0, 0, 1, angle), which 9 has a fast path for the case where we're rotating about the z-axis. However, we can make this *slightly* faster 10 by omitting the hypotenuse computation, several floating point comparisons, and several assignments in this case 11 because we already know that we're just rotating about the z-axis. 12 13 This is a small (but measurable) improvement on the Multiply subtest of MotionMark, which applies a little over 14 3 million rotation transformations over the course of 30 seconds. 15 16 * platform/graphics/transforms/RotateTransformOperation.h: 17 18 Instead of calling `rotate3d`, just have `rotate` directly call `multiply` with the following 19 `TransformationMatrix`: 20 ``` 21 [[ cos(z) sin(z) 0 0 ] 22 [ -sin(z) cos(z) 0 0 ] 23 [ 0 0 1 0 ] 24 [ 0 0 0 1 ]] 25 ``` 26 ...where `z` is the angle of rotation, in radians. 27 28 * platform/graphics/transforms/TransformationMatrix.cpp: 29 (WebCore::TransformationMatrix::rotate): 30 * platform/graphics/transforms/TransformationMatrix.h: 31 (WebCore::TransformationMatrix::rotate): Deleted. 32 1 33 2020-08-31 Aditya Keerthi <akeerthi@apple.com> 2 34 -
trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h
r234330 r266353 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 } -
trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
r255559 r266353 898 898 } 899 899 900 TransformationMatrix& TransformationMatrix::rotate(double angle) 901 { 902 angle = deg2rad(angle); 903 double sinZ = sin(angle); 904 double cosZ = cos(angle); 905 multiply({ cosZ, sinZ, -sinZ, cosZ, 0, 0 }); 906 return *this; 907 } 908 900 909 TransformationMatrix& TransformationMatrix::rotate3d(double rx, double ry, double rz) 901 910 { -
trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
r264031 r266353 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.