зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1458927: Fix perspective squared distance computation. r=hiro
MozReview-Commit-ID: YwjTheRonB --HG-- extra : rebase_source : d3734aad5d37dda1ccaf24f1f84e2f0972e45f5d
This commit is contained in:
Родитель
18ca834662
Коммит
da45aa5fed
|
@ -192,7 +192,7 @@ test(function(t) {
|
||||||
var dist = getDistance(target, 'transform',
|
var dist = getDistance(target, 'transform',
|
||||||
'perspective(128px)',
|
'perspective(128px)',
|
||||||
'none');
|
'none');
|
||||||
assert_equals(dist, 1/128, 'distance of perspective');
|
assert_equals(dist, 128, 'distance of perspective');
|
||||||
}, 'Test distance of perspective function and none');
|
}, 'Test distance of perspective function and none');
|
||||||
|
|
||||||
test(function(t) {
|
test(function(t) {
|
||||||
|
@ -202,7 +202,7 @@ test(function(t) {
|
||||||
var dist = getDistance(target, 'transform',
|
var dist = getDistance(target, 'transform',
|
||||||
'perspective(128px)',
|
'perspective(128px)',
|
||||||
'perspective(0)');
|
'perspective(0)');
|
||||||
assert_equals(dist, 1/128, 'distance of perspective');
|
assert_equals(dist, 128, 'distance of perspective');
|
||||||
}, 'Test distance of perspective function and an invalid perspective');
|
}, 'Test distance of perspective function and an invalid perspective');
|
||||||
|
|
||||||
test(function(t) {
|
test(function(t) {
|
||||||
|
@ -210,7 +210,7 @@ test(function(t) {
|
||||||
var dist = getDistance(target, 'transform',
|
var dist = getDistance(target, 'transform',
|
||||||
'perspective(128px)',
|
'perspective(128px)',
|
||||||
'perspective(1024px)');
|
'perspective(1024px)');
|
||||||
assert_equals(dist, 1/128 - 1/1024, 'distance of perspective');
|
assert_equals(dist, 1024 - 128, 'distance of perspective');
|
||||||
}, 'Test distance of perspective functions');
|
}, 'Test distance of perspective functions');
|
||||||
|
|
||||||
test(function(t) {
|
test(function(t) {
|
||||||
|
|
|
@ -2632,16 +2632,7 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
|
||||||
&TransformOperation::Perspective(ref fd),
|
&TransformOperation::Perspective(ref fd),
|
||||||
&TransformOperation::Perspective(ref td),
|
&TransformOperation::Perspective(ref td),
|
||||||
) => {
|
) => {
|
||||||
let mut fd_matrix = Matrix3D::identity();
|
fd.compute_squared_distance(td)
|
||||||
let mut td_matrix = Matrix3D::identity();
|
|
||||||
if fd.px() > 0. {
|
|
||||||
fd_matrix.m34 = -1. / fd.px();
|
|
||||||
}
|
|
||||||
|
|
||||||
if td.px() > 0. {
|
|
||||||
td_matrix.m34 = -1. / td.px();
|
|
||||||
}
|
|
||||||
fd_matrix.compute_squared_distance(&td_matrix)
|
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
&TransformOperation::Perspective(ref p),
|
&TransformOperation::Perspective(ref p),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче