[Webkit-unassigned] [Bug 48031] AffineTransform operator* reverses order of operands.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 15 14:45:27 PST 2010
https://bugs.webkit.org/show_bug.cgi?id=48031
--- Comment #8 from Shane Stephens <shanestephens at google.com> 2010-12-15 14:45:27 PST ---
I looked at performance in some detail, as I didn't want to cause degradation. The story is basically this:
The old multLeft didn't really multLeft, and is now called postMultiply - same implementation and same performance characteristics.
The old operator* code:
AffineTransform operator*(const AffineTransform& t) const
{
AffineTransform result = t;
result.multLeft(*this);
return result;
}
This contains two copies of AffineTransform - once when t is assigned to result, and once when result is returned by value.
The old operator*= is implemented in terms of operator*, and multiply in terms of operator*=. Thus all of these operations cost at least 2 copies of AffineTransform plus the implementation of multLeft.
The new multiply and operator*= implementations use postMultiply directly, and are thus cheaper by at least 2 copies of AffineTransform. The new operator* is implemented in the same way as the old operator*:
AffineTransform result = *this;
result *= t;
return result;
and incurs the same 2 copies, costing the same as the old operator*.
Hence, by replacing the old use of multiply with operator* here, I'm not incurring any additional cost. Actually, by eliminating an assignment I'm reducing the cost by one AffineTransform copy.
I think you're right that doing the following:
AffineTransform patternTransform = userSpaceTransformation;
patternTransform.multiply(m_patternSpaceTransformation);
Would reduce the cost still further, so I'm going to roll that into this patch.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list