commit 9efb0eb6c01d2ab9d68ac9ca17a3cabeae39992a
parent 50c5bd85257cf1f48a8e510ce2a5fc0174192652
Author: Timothy Nikkel <tnikkel@gmail.com>
Date: Tue, 21 Oct 2025 00:28:01 +0000
Bug 1995175. Don't use floats in Matrix4x4TypedFlagged for some intermdiate calculations when the underlying type is double. r=gfx-reviewers,lsalzman
The TargetPoint define will be float based, which leads to weird results when the value we store in it is stored as a different value in a float vs a double.
Differential Revision: https://phabricator.services.mozilla.com/D269154
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h
@@ -1956,7 +1956,6 @@ class Matrix4x4TypedFlagged
: protected Matrix4x4Typed<SourceUnits, TargetUnits> {
public:
using Parent = Matrix4x4Typed<SourceUnits, TargetUnits>;
- using TargetPoint = PointTyped<TargetUnits>;
using Parent::_11;
using Parent::_12;
using Parent::_13;
@@ -2099,8 +2098,9 @@ class Matrix4x4TypedFlagged
F min_y = std::min(std::min(std::min(p1.y, p2.y), p3.y), p4.y);
F max_y = std::max(std::max(std::max(p1.y, p2.y), p3.y), p4.y);
- TargetPoint topLeft(std::min(std::max(min_x, aClip.x), aClip.XMost()),
- std::min(std::max(min_y, aClip.y), aClip.YMost()));
+ PointTyped<TargetUnits, F> topLeft(
+ std::min(std::max(min_x, aClip.x), aClip.XMost()),
+ std::min(std::max(min_y, aClip.y), aClip.YMost()));
F width = std::min(std::max(max_x, aClip.x), aClip.XMost()) - topLeft.x;
F height = std::min(std::max(max_y, aClip.y), aClip.YMost()) - topLeft.y;
@@ -2184,7 +2184,7 @@ class Matrix4x4TypedFlagged
}
if (mType == MatrixType::Simple) {
- TargetPoint point = TransformPointSimple(aPoint);
+ PointTyped<TargetUnits, F> point = TransformPointSimple(aPoint);
return Point4DTyped<TargetUnits, F>(point.x, point.y, 0, 1);
}