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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 20 17:02:07 PDT 2010


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

           Summary: AffineTransform operator* reverses order of operands.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Platform
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: shanestephens at google.com


The result of a matrix multiplication is dependent on the order of the operands.  if I have the following code:

AffineTransform a = ...
AffineTransform b = ...
AffineTransform c = a * b;

currently c is given the value of b * a, not a * b.  Looking through the code, we see:

// result = *this * t (i.e. a multRight)
AffineTransform operator*(const AffineTransform& t) const
{
  AffineTransform result = t;
  result.multLeft(*this);
  return result;
}

multLeft is a post-multiply - i.e. result.multLeft(*this) assigns result * this to result.  This means that we return t * this, not this * t as expected.

Note that this is fairly difficult to fix as a lot of code uses the incorrect definition, with reversed arguments to generate the correct behaviour.  I'd also be interested in renaming the multLeft method to something less confusing (e.g. postMultiply) in order to reduce the chance of this happening again.

-- 
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