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

Behdad Esfahbod behdad at behdad.org
Mon Oct 22 12:22:54 PDT 2007


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.


-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list