[cairo] [cairo-commit] src/cairo-gstate.c

Bill Spitzak spitzak at thefoundry.co.uk
Tue Oct 23 02:52:16 PDT 2007


Behdad Esfahbod wrote:
> On Mon, 2007-10-22 at 12:17 -0400, Chris Wilson wrote:
>> @@ -631,6 +634,8 @@ _cairo_gstate_scale (cairo_gstate_t *gstate,
>> double sx, double sy)
>>  
>>      if (sx == 0 || sy == 0)
>>         return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
>> +    if (! (sx * sx > 0.) || ! (sy * sy > 0.))
>> +       return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
>>  
>>      _cairo_gstate_unset_scaled_font (gstate); 
> 
> What's the justification for strict check (> 0 as opposed to >= 0) and
> the || instead of &&?  Why should we allow scale(0,1) but not
> scale(0,0).  AFAIK the code doesn't handle any degenerate case anyway...
> We should fix that too btw.

If you really want to match when the determinant is non-zero in the 
resulting matrix, use sx*sy != 0. This appears the same as sx&&sy but 
may also catch when underflow makes the determinant zero.

-- 
Bill Spitzak, Senior Software Engineer
The Foundry, 1 Wardour Street, London, W1D 6PA, UK
Tel: +44 (0)20 7434 0449 * Fax: +44 (0)20 7434 1550 * Web: 
www.thefoundry.co.uk
The Foundry Visionmongers Ltd * Registered in England and Wales No: 4642027



More information about the cairo mailing list