Re: Fixed point cairo.. or no cairo?



On Wed, 2006-08-16 at 04:50 -0400, Michael Meeks wrote:
> On Wed, 2006-08-16 at 00:19 +0000, Aivars Kalvans wrote:
> > Matrix with values like { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 } does not
> > require any multiplication, because result is the same as input.
> 
> 	I like your patch, and I guess it'll always be faster on a machine with
> no FPU, of course there are a number of other places where this should
> be used.
> 
> 	Having something like:
> 
> enum {
> 	MATRIX_CORE_IS_UNIT = 0,
> 	MATRIX_CORE_IS_PURE_SCALE = 1,
> 	MATRIX_HAS_TRANSLATE = 0x800
> } MatrixProp;
> 
> 	Or whatever,
> 
> 	That was tracked, and used to annotate the various matrix operations
> might be fast & small enough for both use-cases; might also accelerate
> some other cases: general matrix products etc.

This works, but is very error prune.  Instead, I suggest one implements
an opaque matrix type for cairo's internal use that maintains properties
like the one you suggest and short-circuits operation based on the
properties.  These can be implemented as inlined wrappers around
cairo_matrix_t, such that the compiler has the opportunity to optimize
away some stuff for the constant values.


> 	HTH,
> 
> 		Michael.

-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]