Re: API for matrix manipulation

On Mar 15, 2011, at 5:08 PM, Tab Atkins Jr. wrote:

> On Tue, Mar 15, 2011 at 5:00 PM, Chris Marrin <cmarrin@apple.com> wrote:
>> I think it would be nice to unify the classes somehow. But that might be difficult since SVG and CSS are (necessarily) separate specs. But maybe one of the API gurus has a solution?
> 
> We just discussed this on Monday at the FXTF telcon.  Sounds like
> people are, in general, okay with just using a 4x4 matrix, though
> there are some possible implementation issues with devices that can't
> do 3d at all.  (It was suggested that they can simply do a 2d
> projection, which is simple.)

I don't think there are implementation issues other than performance related ones. As you say, you can always flatten a 3D matrix for use in a purely 2D renderer. We do this in the WebKit implementation in some cases. But doing 4x4 matrix math can be expensive, especially on less capable hardware,. So it would probably be valuable to have a set of 2D affine calls on any future 4x4 class, so an implementation can easily optimize by knowing they can get away with doing a subset of the math if all the operands are 2D affine matrices. But that's just a bit of extra API.

-----
~Chris
cmarrin@apple.com

Received on Friday, 18 March 2011 20:50:50 UTC