Closed Bug 1297986 Opened 8 years ago Closed 8 years ago

4D matrix multiplication assumes w = 1.

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: nical, Assigned: nical)

Details

Attachments

(1 file)

but w is not necessarily equal to 1. It looks like a massive foot-gun. If you really want to enforce w=1, you should be using 3D points instead.

Let's fix the multiplication to take w into account.
Any objection?
Attached patch Don't assume w=1Splinter Review
r=kats since APZ seems to be the principal user of the 4d transformation.
Attachment #8784795 - Flags: review?(bugmail)
Comment on attachment 8784795 [details] [diff] [review]
Don't assume w=1

Review of attachment 8784795 [details] [diff] [review]:
-----------------------------------------------------------------

Redirecting to matt, because he did the relevant w-coordinate changes in APZ and my 4D math knowledge is lacking.
Attachment #8784795 - Flags: review?(bugmail) → review?(matt.woodrow)
Comment on attachment 8784795 [details] [diff] [review]
Don't assume w=1

Review of attachment 8784795 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/2d/Matrix.h
@@ +838,5 @@
>  
>    template<class F>
>    Point3DTyped<TargetUnits, F> operator *(const Point3DTyped<SourceUnits, F>& aPoint) const
>    {
> +    Point3DTyped<TargetUnits, F> result;

I think we can just keep the old code for this, unless we think we really need the performance boost of skipping the w multiply.
Attachment #8784795 - Flags: review?(matt.woodrow) → review+
Pushed by nsilva@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/07336fed8904
Don't assume w=1 when transforming 4d points. r=mattwoodrow
https://hg.mozilla.org/mozilla-central/rev/07336fed8904
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: