You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The otherObject matrix gets post-multiplied to the current matrix.
If is 2D of otherObject is false, set is 2D of the current matrix to false.
Return the current matrix.
This means that for step 1, if we pass in a DOMMatrix (which is assignable to DOMMatrixInit), we will create a new DOMMatrix from the passed-in DOMMatrix, which is unnecessary overhead.
In practice, that means something like the following for the implementation:
multiplySelf(other: DOMMatrixInit){constotherMat=newDOMMatrix([other.m11,other.m12, ...,other.m44])// ... perform the multiplication ...if(!otherMat[is2D])this[is2D]=falsereturnthis}
(where is2D is a symbol that I use for the "priate" is2D state in JavaScript (DOMMatrixReadOnly returns the value from a readonly getter, and DOMMatrix adds the setter for it).
As you can see here, creating a new DOMMatrix every time we want to multiply is wasteful, and for every frame of an animation this will create a new object that needs to be garbage collected.
Can we change the spec to specify that a new DOMMatrix does not need to be constructed if a DOMMatrix is passed in?
The text was updated successfully, but these errors were encountered:
The steps for multiplySelf are:
This means that for step 1, if we pass in a DOMMatrix (which is assignable to DOMMatrixInit), we will create a new DOMMatrix from the passed-in DOMMatrix, which is unnecessary overhead.
In practice, that means something like the following for the implementation:
(where
is2D
is asymbol
that I use for the "priate"is2D
state in JavaScript (DOMMatrixReadOnly
returns the value from a readonlyget
ter, andDOMMatrix
adds theset
ter for it).As you can see here, creating a
new DOMMatrix
every time we want to multiply is wasteful, and for every frame of an animation this will create a new object that needs to be garbage collected.Can we change the spec to specify that a new DOMMatrix does not need to be constructed if a DOMMatrix is passed in?
The text was updated successfully, but these errors were encountered: