Revision: 4891

Author: jszeto@adobe.com

Date: 2009-02-06 18:15:24 -0800 (Fri, 06 Feb 2009)

Log Message:

-----------

Fix LinearGradient to properly implement FXG spec

Changed the way that LinearGradient interprets the scaleX, x, and y properties. Previously we used Matrix.createGradientBox to generate the matrix used for the gradient fill. Instead, we now do the following:

- Translate the gradient so that its top-left corner is at the origin (0,0)

- Scale the gradient in the x direction by the scaleX (or calculated) value

- Rotate the gradient using the rotation value

- Translate the gradient by the x and y values

If scaleX is not defined, then we need to calculate the length of the gradient taking into account the rotation. Depending upon the angle of the rotation, we will either use the width or height of the element's bounds to calculate the length. The breaking point is determined by getting the angle of the right triangle with the width and height as the sides.

If x and y are not defined, then we don't perform the first translation (moving the top-left corner to the origin). Instead, after we scale and rotate, we translate the gradient by half of the width and height of the element's bounds.

If only x or y is defined, we force the other property to a value of 0.

QE Notes: Any tests that set x,y values on the gradient will break.

Doc Notes: Add docs to explain that if x or y is defined, the other should be defined as well

Bugs: SDK-17653

Reviewer: Glenn

Ticket Links:

------------

http://bugs.adobe.com/jira/browse/SDK-17653

Modified Paths:

--------------

flex/sdk/branches/i10/frameworks/projects/framework/src/mx/graphics/LinearGradient.as