[cairo] unbounded by source operators != unbounded by mask operators

Keith Packard keithp at keithp.com
Thu Oct 27 19:10:57 PDT 2005


Some operators effects extend beyond the bounds of the mask or source
operands, we call these 'unbounded' operators, and
_cairo_operator_bounded is supposed to distinguish between them.

Because of our extended definition of the basic rendering equation, it
turns out that the set of operators which have effects is *different* if
you're talking about mask operands vs source operands.

Two operators, SOURCE and CLEAR are defined to affect areas between the
mask and source operand, and are thus *not* bounded in effect by the
source operand.

I've found several places in the code which want to know whether the
operation is bounded by the source and are using _cairo_operator_bounded
in conjunction with explicit tests for SOURCE and (sometimes) CLEAR
operations. This seems silly to me, and I also wonder if some of these
existing cases are wrong as they don't check for CLEAR.

I suggest renaming our existing function and adding a new one:

/**
 * _cairo_operator_bounded_by_mask:
 * @operator: a #cairo_operator_t
 *
 * A bounded operator is one where mask pixel
 * of zero results in no effect on the destination image.
 *
 * Unbounded operators often require special handling; if you, for
 * example, draw trapezoids with an unbounded operator, the effect
 * extends past the bounding box of the trapezoids.
 *
 * Return value: %TRUE if the operator is bounded by the mask operand
 **/
cairo_bool_t
_cairo_operator_bounded_by_mask (cairo_operator_t operator)

/**
 * _cairo_operator_bounded_by_source:
 * @operator: a #cairo_operator_t
 *
 * A bounded operator is one where source pixels (not just alpha)
 * of zero results in no effect on the destination image.
 *
 * Unbounded operators often require special handling; if you, for
 * example, copy a surface with an unbounded operator, the effect
 * extends past the bounding box of the surface
 *
 * Return value: %TRUE if the operator is bounded by the source operand
 **/
cairo_bool_t
_cairo_operator_bounded_by_source (cairo_operator_t operator)

Questions? Concerns?

-keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051027/1859e9f7/attachment.pgp


More information about the cairo mailing list