[cairo] On recovery from errors in cairo
Bill Spitzak
spitzak at d2.com
Fri Sep 22 13:46:20 PDT 2006
Owen Taylor wrote:
> What should you get from:
>
> cairo_scale(cr, 0, 0);
> cairo_set_source_image(cr, my_pattern, 0, 0);
> cairo_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
> cairo_paint();
>
> ? I guess you could argue that it should be a solid fill with the
> average pixel color of the pattern...
If this is the one that replicates the edge pixels, what it actually
should draw is four quadrants of solid color, each is the color of one
of the corner pixels of the source image. The intersection of the lines
separating the quadrants is at the translation of the transform. The
angles of the lines depend on the rotation and skew of the (now
degenerate) transform.
If, as I suspect, figuring out these angles is really difficult or
ambiguous, it could fail. But Cairo should only fail on things it cannot
draw, ONLY that should produce an error. The scale(0,0) should NOT
produce an error. The set_source should not produce an error. No error
should be produced until the paint() operation. Even that should not
produce an error if the EXTEND_REPEAT is not on, or if the destination
area is empty (probably due to the path being constructed in the
degenerate ctm), and it even should check if the 4 corner pixels are
equal and avoid an error then, too!
More information about the cairo
mailing list