mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Fix the conversion from Perspective into ComputedMatrix.
We convert a perspective function into a ComputedMatrix, but we apply the perspective length to a wrong matrix item. We should put it into m34, instead of m43. m43 is for translate parameter Z.
This commit is contained in:
parent
0eabba3c6f
commit
02277ce4a1
1 changed files with 9 additions and 3 deletions
|
@ -1474,11 +1474,17 @@ fn add_weighted_transform_lists(from_list: &[TransformOperation],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(&TransformOperation::Perspective(fd),
|
(&TransformOperation::Perspective(fd),
|
||||||
&TransformOperation::Perspective(_td)) => {
|
&TransformOperation::Perspective(td)) => {
|
||||||
let mut fd_matrix = ComputedMatrix::identity();
|
let mut fd_matrix = ComputedMatrix::identity();
|
||||||
let mut td_matrix = ComputedMatrix::identity();
|
let mut td_matrix = ComputedMatrix::identity();
|
||||||
fd_matrix.m43 = -1. / fd.to_f32_px();
|
if fd.0 > 0 {
|
||||||
td_matrix.m43 = -1. / _td.to_f32_px();
|
fd_matrix.m34 = -1. / fd.to_f32_px();
|
||||||
|
}
|
||||||
|
|
||||||
|
if td.0 > 0 {
|
||||||
|
td_matrix.m34 = -1. / td.to_f32_px();
|
||||||
|
}
|
||||||
|
|
||||||
let sum = fd_matrix.add_weighted(&td_matrix, self_portion, other_portion)
|
let sum = fd_matrix.add_weighted(&td_matrix, self_portion, other_portion)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
result.push(TransformOperation::Matrix(sum));
|
result.push(TransformOperation::Matrix(sum));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue