[cairo-commit] cairo/src cairo-gstate.c, 1.175,
1.176 cairo-image-surface.c, 1.63, 1.64 cairo-xlib-surface.c,
1.124, 1.125 cairoint.h, 1.218, 1.219
Keith Packard
commit at pdx.freedesktop.org
Fri Oct 28 20:41:24 PDT 2005
Committed by: keithp
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv27808/src
Modified Files:
cairo-gstate.c cairo-image-surface.c cairo-xlib-surface.c
cairoint.h
Log Message:
2005-10-28 Keith Packard <keithp at keithp.com>
* src/cairo-gstate.c: (_cairo_operator_bounded_by_mask),
(_cairo_operator_bounded_by_source),
(_cairo_gstate_clip_and_composite),
(_cairo_surface_clip_and_composite_trapezoids),
(_cairo_gstate_show_glyphs):
* src/cairo-image-surface.c: (_cairo_image_surface_composite),
(_cairo_image_surface_composite_trapezoids):
* src/cairo-xlib-surface.c: (_cairo_xlib_surface_composite),
(_cairo_xlib_surface_composite_trapezoids),
(_cairo_xlib_surface_show_glyphs):
* src/cairoint.h:
Split _cairo_operator_bounded into two
separate functions _cairo_operator_bounded_by_mask and
_cairo_operator_bound_by_source to distinguish between
how operators use source and mask operands.
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- cairo-gstate.c 28 Oct 2005 00:16:47 -0000 1.175
+++ cairo-gstate.c 29 Oct 2005 03:41:22 -0000 1.176
@@ -750,20 +750,20 @@
}
/**
- * _cairo_operator_bounded:
+ * _cairo_operator_bounded_by_mask:
* @operator: a #cairo_operator_t
*
- * A bounded operator is one where a source or mask pixel
+ * 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
+ * Return value: %TRUE if the operator is bounded by the mask operand
**/
cairo_bool_t
-_cairo_operator_bounded (cairo_operator_t operator)
+_cairo_operator_bounded_by_mask (cairo_operator_t operator)
{
switch (operator) {
case CAIRO_OPERATOR_CLEAR:
@@ -788,6 +788,46 @@
return FALSE;
}
+/**
+ * _cairo_operator_bounded_by_source:
+ * @operator: a #cairo_operator_t
+ *
+ * A bounded operator is one where source pixels of zero
+ * (in all four components, r, g, b and a) effect no change
+ * in the resulting destination image.
+ *
+ * Unbounded operators often require special handling; if you, for
+ * example, copy a surface with the SOURCE operator, the effect
+ * extends past the bounding box of the source 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)
+{
+ switch (operator) {
+ case CAIRO_OPERATOR_OVER:
+ case CAIRO_OPERATOR_ATOP:
+ case CAIRO_OPERATOR_DEST:
+ case CAIRO_OPERATOR_DEST_OVER:
+ case CAIRO_OPERATOR_DEST_OUT:
+ case CAIRO_OPERATOR_XOR:
+ case CAIRO_OPERATOR_ADD:
+ case CAIRO_OPERATOR_SATURATE:
+ return TRUE;
+ case CAIRO_OPERATOR_CLEAR:
+ case CAIRO_OPERATOR_SOURCE:
+ case CAIRO_OPERATOR_OUT:
+ case CAIRO_OPERATOR_IN:
+ case CAIRO_OPERATOR_DEST_IN:
+ case CAIRO_OPERATOR_DEST_ATOP:
+ return FALSE;
+ }
+
+ ASSERT_NOT_REACHED;
+ return FALSE;
+}
+
static cairo_status_t
_create_composite_mask_pattern (cairo_surface_pattern_t *mask_pattern,
cairo_clip_t *clip,
@@ -1057,7 +1097,7 @@
src,
draw_func, draw_closure,
dst, extents);
- else if (_cairo_operator_bounded (operator))
+ else if (_cairo_operator_bounded_by_mask (operator))
status = _cairo_gstate_clip_and_composite_with_mask (clip, operator,
src,
draw_func, draw_closure,
@@ -1338,7 +1378,7 @@
if (status)
return status;
- if (_cairo_operator_bounded (operator))
+ if (_cairo_operator_bounded_by_mask (operator))
{
if (trap_region) {
status = _cairo_clip_intersect_to_region (clip, trap_region);
@@ -1411,7 +1451,7 @@
goto out;
}
- if ((_cairo_operator_bounded (operator) && operator != CAIRO_OPERATOR_SOURCE) ||
+ if ((_cairo_operator_bounded_by_mask (operator) && operator != CAIRO_OPERATOR_SOURCE) ||
!clip->surface)
{
/* For a simple rectangle, we can just use composite(), for more
@@ -2011,7 +2051,7 @@
&transformed_glyphs[i].y);
}
- if (_cairo_operator_bounded (gstate->operator))
+ if (_cairo_operator_bounded_by_mask (gstate->operator))
status = _cairo_scaled_font_glyph_device_extents (gstate->scaled_font,
transformed_glyphs,
num_glyphs,
Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- cairo-image-surface.c 10 Oct 2005 19:45:15 -0000 1.63
+++ cairo-image-surface.c 29 Oct 2005 03:41:22 -0000 1.64
@@ -620,9 +620,7 @@
width, height);
}
- if (!_cairo_operator_bounded (operator) ||
- operator == CAIRO_OPERATOR_SOURCE ||
- operator == CAIRO_OPERATOR_CLEAR)
+ if (!_cairo_operator_bounded_by_source (operator))
status = _cairo_surface_composite_fixup_unbounded (&dst->base,
&src_attr, src->width, src->height,
mask ? &mask_attr : NULL,
@@ -785,7 +783,7 @@
dst_x, dst_y,
width, height);
- if (!_cairo_operator_bounded (operator))
+ if (!_cairo_operator_bounded_by_mask (operator))
status = _cairo_surface_composite_shape_fixup_unbounded (&dst->base,
&attributes, src->width, src->height,
width, height,
Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- cairo-xlib-surface.c 10 Oct 2005 19:45:15 -0000 1.124
+++ cairo-xlib-surface.c 29 Oct 2005 03:41:22 -0000 1.125
@@ -1302,9 +1302,7 @@
ASSERT_NOT_REACHED;
}
- if (!_cairo_operator_bounded (operator) ||
- operator == CAIRO_OPERATOR_SOURCE ||
- operator == CAIRO_OPERATOR_CLEAR)
+ if (!_cairo_operator_bounded_by_source (operator))
status = _cairo_surface_composite_fixup_unbounded (&dst->base,
&src_attr, src->width, src->height,
mask ? &mask_attr : NULL,
@@ -1511,7 +1509,7 @@
if (status)
goto FAIL;
- if (!_cairo_operator_bounded (operator)) {
+ if (!_cairo_operator_bounded_by_mask (operator)) {
/* XRenderCompositeTrapezoids() creates a mask only large enough for the
* trapezoids themselves, but if the operator is unbounded, then we need
* to actually composite all the way out to the bounds, so we create
@@ -2478,7 +2476,7 @@
source_y + attributes.y_offset - dest_y,
glyphs, num_glyphs);
- if (status == CAIRO_STATUS_SUCCESS && !_cairo_operator_bounded (operator)) {
+ if (status == CAIRO_STATUS_SUCCESS && !_cairo_operator_bounded_by_mask (operator)) {
cairo_rectangle_t extents;
status = _cairo_scaled_font_glyph_device_extents (scaled_font,
glyphs,
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- cairoint.h 28 Oct 2005 00:16:47 -0000 1.218
+++ cairoint.h 29 Oct 2005 03:41:22 -0000 1.219
@@ -1243,7 +1243,10 @@
const cairo_rectangle_t *extents);
cairo_private cairo_bool_t
-_cairo_operator_bounded (cairo_operator_t operator);
+_cairo_operator_bounded_by_mask (cairo_operator_t operator);
+
+cairo_private cairo_bool_t
+_cairo_operator_bounded_by_source (cairo_operator_t operator);
/* cairo_color.c */
cairo_private const cairo_color_t *
More information about the cairo-commit
mailing list