[Webkit-unassigned] [Bug 48031] AffineTransform operator* reverses order of operands.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 3 13:34:59 PST 2011

https://bugs.webkit.org/show_bug.cgi?id=48031

--- Comment #18 from Shane Stephens <shanestephens at google.com>  2011-01-03 13:34:59 PST ---
Dirk: both multiply and postMultiply do the same thing.  The following all produce the same result:

a *= b
a.multiply(b)
a.postMultiply(b)

Furthermore, the same result can be obtained in a fresh AffineTransform using:

a * b

The reason I'm keener on using a *=b and a * b over multiply, postMultiply or a new preMultiply function is that I think there's significant potential for confusion of what postMultiply and preMultiply *mean*, and multiply could conceivably mean either one or the other.

On the other hand, I think a * b is unambiguous and has a reasonably obvious meaning - there's only one correct answer, which is to multiply a on the left by b on the right.  Similarly a *= b is well understood to be equivalent to a = a * b.

Simon: For the clearest example of why this is a bug, look at the implementation of a * b.  The result is currently b * a.  Say that 'a' is a translation matrix (1, 0, 0, 1, 100, 10), and 'b' is a scale matrix (1.5, 0, 0, 1.2, 0, 0).

[ 1   0   100] [1.5   0    0 ] [1.5   0    100]
[ 0   1   10 ]x[ 0   1.2   0 ]=[ 0   1.2   10 ]
[(0) (0)  (1)] [(0)  (0)  (1)] [(0)  (0)   (1)]

However AffineTransform's operand gives (1.5, 0, 0, 1.2, 150, 12), which is b * a.  This is independent of 16062 - as you can see this notation already uses SVG's column vector orientation and does not arise because of translation to CG matrices.

--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.