Closed Bug 1065127 Opened 6 years ago Closed 6 years ago

Avoid matrix multiplication in lots of places by using factory constructors and the matrix adjusting methods

Categories

(Core :: Graphics, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

(Keywords: perf)

Attachments

(1 file)

Right now the pattern:

  Matrix().Translate(x, y)

is being used in a lot of places. The same is true for the Scale and Rotate methods. This is resulting in us doing lots of floating-point multiplications, when instead we should just be using Matrix's static factory methods to create such translations/scales/rotations.
Summary: Avoid Moz2D matrix multiplications in lots of places by using the factory constructors instead → Avoid matrix multiplication in lots of places by using factory constructors and the matrix adjusting methods
I've also fixed up gfxMatrix instances in my patch. And I've gone further than conversions just to the factory methods, and used the Translate(), Scale() and Rotate() methods where that further cuts the number of floating-point multiplications.
Attached patch patchSplinter Review
Attachment #8486803 - Flags: review?(bas)
Attachment #8486803 - Flags: review?(bas) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/335f38ba4490

(Somehow I put a change that belonged in a later commit in my Try push into that earlier commit by mistake.)
Should Matrix even have a no-arg constructor if it encourages comment 0 usage.
If we removed it we'd want an Identity() static factory method, and I'm not sure people would abuse that any less. :/
https://hg.mozilla.org/mozilla-central/rev/335f38ba4490
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.