mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
style: Update euclid in stylo
Differential Revision: https://phabricator.services.mozilla.com/D85762
This commit is contained in:
parent
db1ada85dc
commit
ce45f68d9c
1 changed files with 8 additions and 9 deletions
|
@ -443,32 +443,31 @@ where
|
||||||
use self::TransformOperation::*;
|
use self::TransformOperation::*;
|
||||||
use std::f64;
|
use std::f64;
|
||||||
|
|
||||||
const TWO_PI: f64 = 2.0f64 * f64::consts::PI;
|
|
||||||
let reference_width = reference_box.map(|v| v.size.width);
|
let reference_width = reference_box.map(|v| v.size.width);
|
||||||
let reference_height = reference_box.map(|v| v.size.height);
|
let reference_height = reference_box.map(|v| v.size.height);
|
||||||
let matrix = match *self {
|
let matrix = match *self {
|
||||||
Rotate3D(ax, ay, az, theta) => {
|
Rotate3D(ax, ay, az, theta) => {
|
||||||
let theta = TWO_PI - theta.radians64();
|
let theta = theta.radians64();
|
||||||
let (ax, ay, az, theta) =
|
let (ax, ay, az, theta) =
|
||||||
get_normalized_vector_and_angle(ax.into(), ay.into(), az.into(), theta);
|
get_normalized_vector_and_angle(ax.into(), ay.into(), az.into(), theta);
|
||||||
Transform3D::rotation(
|
Transform3D::rotation(
|
||||||
ax as f64,
|
ax as f64,
|
||||||
ay as f64,
|
ay as f64,
|
||||||
az as f64,
|
az as f64,
|
||||||
-euclid::Angle::radians(theta),
|
euclid::Angle::radians(theta),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
RotateX(theta) => {
|
RotateX(theta) => {
|
||||||
let theta = euclid::Angle::radians(TWO_PI - theta.radians64());
|
let theta = euclid::Angle::radians(theta.radians64());
|
||||||
Transform3D::rotation(1., 0., 0., -theta)
|
Transform3D::rotation(1., 0., 0., theta)
|
||||||
},
|
},
|
||||||
RotateY(theta) => {
|
RotateY(theta) => {
|
||||||
let theta = euclid::Angle::radians(TWO_PI - theta.radians64());
|
let theta = euclid::Angle::radians(theta.radians64());
|
||||||
Transform3D::rotation(0., 1., 0., -theta)
|
Transform3D::rotation(0., 1., 0., theta)
|
||||||
},
|
},
|
||||||
RotateZ(theta) | Rotate(theta) => {
|
RotateZ(theta) | Rotate(theta) => {
|
||||||
let theta = euclid::Angle::radians(TWO_PI - theta.radians64());
|
let theta = euclid::Angle::radians(theta.radians64());
|
||||||
Transform3D::rotation(0., 0., 1., -theta)
|
Transform3D::rotation(0., 0., 1., theta)
|
||||||
},
|
},
|
||||||
Perspective(ref d) => {
|
Perspective(ref d) => {
|
||||||
let m = create_perspective_matrix(d.to_pixel_length(None)?);
|
let m = create_perspective_matrix(d.to_pixel_length(None)?);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue