Closed Bug 1069378 Opened 11 years ago Closed 11 years ago

Matrix4x4::TransformBounds should take a RectTyped rather than a Rect

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kats, Unassigned)

Details

gfx::Rect is a typedef for gfx::RectTyped<UnknownUnits> which is something we should be trying to phase out, or use as little as possible. Matrix4x4::TransformBounds should accept any gfx::RectTyped<T> instead, to encourage use of typed units. I would have suggested it take a gfx::BaseRect except that can be derived with integer-based rects (e.g. gfx::IntRect) which presumably we don't want to allow transformation of without rounding considerations.
Would the return type be a rect of the same type as the input? Matrices often transform rectangles from one coordinate space into another. A related change I've been meaning to propose is to make a strongly-typed version of Matrix4x4, such as Matrix4x4Typed<SourceUnits, TargetUnits>. The TransformBounds method of this type could then take a RectTyped<SourceUnits> as input, and return a RectTyped<TargetUnits>.
Also note that there is a non-member TransformTo function in UnitTransforms.h that's very convenient to use in such scenarios [1]. [1] http://mxr.mozilla.org/mozilla-central/source/layout/base/UnitTransforms.h?rev=4df5daa7ca34#80
(In reply to Botond Ballo [:botond] from comment #1) > Would the return type be a rect of the same type as the input? Matrices > often transform rectangles from one coordinate space into another. That's a good point, maybe we shouldn't fix this and ensure the callers are doing their type conversions properly. A strongly-typed TransformBounds would be nice though.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
(In reply to Botond Ballo [:botond] from comment #1) > A related change I've been meaning to propose is to make a strongly-typed > version of Matrix4x4, such as Matrix4x4Typed<SourceUnits, TargetUnits>. The > TransformBounds method of this type could then take a RectTyped<SourceUnits> > as input, and return a RectTyped<TargetUnits>. Filed bug 1069417 for this.
Resolution: WONTFIX → FIXED
Didn't mean to make that resolution change.
Resolution: FIXED → WONTFIX
You need to log in before you can comment on or make changes to this bug.