[webkit-changes] [WebKit/WebKit] 3f6444: Introduce 'rotateRadians' helper function and use ...

Ahmad Saleem noreply at github.com
Thu Oct 5 20:51:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3f64447f2aa9d256ae17bd271e186aac0257f2f9
      https://github.com/WebKit/WebKit/commit/3f64447f2aa9d256ae17bd271e186aac0257f2f9
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M Source/WebCore/html/canvas/CanvasPath.cpp
    M Source/WebCore/platform/graphics/cg/PathCG.cpp
    M Source/WebCore/platform/graphics/transforms/AffineTransform.cpp
    M Source/WebCore/platform/graphics/transforms/AffineTransform.h
    M Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
    M Source/WebCore/platform/graphics/transforms/TransformationMatrix.h

  Log Message:
  -----------
  Introduce 'rotateRadians' helper function and use across WebKit

https://bugs.webkit.org/show_bug.cgi?id=262718

Reviewed by Chris Dumez.

Merge: https://src.chromium.org/viewvc/blink?view=revision&revision=167603 &
https://src.chromium.org/viewvc/blink?revision=168929&view=revision

Currently, rotate function takes an argument in only degrees.
In many cases, rotate function is often required radian value instead of degree value.
If we add new rotateRadians function, we will be able to reduce unnecessary operations.

 Before : rad -> rad2deg -> deg2rad -> calc sinNcos
 After  : rad                       -> calc sinNcos

As a result, we can reduce two multiplication and two division.

Additionally, we can use it across WebCore source instead of 'rotate(rad2deg)'.

* Source/WebCore/platform/graphics/transforms/AffineTransform.cpp:
(AffineTransform::rotate):
(AffineTransform::rotateRadians):
(AffineTransform::rotateFromVector):
(AffineTransform::decompose):
* Source/WebCore/platform/graphics/transforms/AffineTransform.h: new 'rotateRadians' function
* Source/WebCore/platform/graphics/cg/PathCG.cpp:
(PathCG::addEllipse):
* Source/WebCore/html/canvas/CanvasPath.cpp:
(CanvasPath::addEllipse):
* Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp:
(TransformationMatrix::rotateFromVector):
(TransformationMatrix::rotate):
(TransformationMatrix::rotateRadians):
* Source/WebCore/platform/graphics/transforms/TransformationMatrix.h: new 'rotateRadians' function

Canonical link: https://commits.webkit.org/268964@main




More information about the webkit-changes mailing list