[cairo-commit] cairo/src cairo-gstate.c, 1.173,
1.174 cairo-surface.c, 1.103, 1.104 cairoint.h, 1.216, 1.217
Carl Worth
commit at pdx.freedesktop.org
Thu Oct 27 15:06:55 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv23872/src
Modified Files:
cairo-gstate.c cairo-surface.c cairoint.h
Log Message:
2005-10-27 Carl Worth <cworth at cworth.org>
* src/cairoint.h:
* src/cairo-gstate.c: (_cairo_gstate_paint):
* src/cairo-surface.c: (_fallback_paint), (_cairo_surface_paint):
Move paint fallback from gstate to surface where it belongs.
* src/cairoint.h:
* src/cairo-surface.c: (_cairo_surface_init), (_cairo_surface_set_clip):
Add clip pointer to surface.
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- cairo-gstate.c 13 Oct 2005 23:55:14 -0000 1.173
+++ cairo-gstate.c 27 Oct 2005 22:06:53 -0000 1.174
@@ -728,10 +728,8 @@
cairo_status_t
_cairo_gstate_paint (cairo_gstate_t *gstate)
{
- cairo_rectangle_t rectangle;
cairo_status_t status;
- cairo_box_t box;
- cairo_traps_t traps;
+ cairo_pattern_union_t pattern;
if (gstate->source->status)
return gstate->source->status;
@@ -740,26 +738,13 @@
if (status)
return status;
- status = _cairo_surface_get_extents (gstate->target, &rectangle);
- if (status)
- return status;
- status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &rectangle);
- if (status)
- return status;
-
- box.p1.x = _cairo_fixed_from_int (rectangle.x);
- box.p1.y = _cairo_fixed_from_int (rectangle.y);
- box.p2.x = _cairo_fixed_from_int (rectangle.x + rectangle.width);
- box.p2.y = _cairo_fixed_from_int (rectangle.y + rectangle.height);
- status = _cairo_traps_init_box (&traps, &box);
- if (status)
- return status;
-
- _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps);
+ _cairo_gstate_copy_transformed_source (gstate, &pattern.base);
- _cairo_traps_fini (&traps);
+ status = _cairo_surface_paint (gstate->operator,
+ &pattern.base,
+ gstate->target);
- return CAIRO_STATUS_SUCCESS;
+ return status;
}
/**
Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- cairo-surface.c 14 Oct 2005 04:00:52 -0000 1.103
+++ cairo-surface.c 27 Oct 2005 22:06:53 -0000 1.104
@@ -152,6 +152,7 @@
surface->device_x_scale = 1.0;
surface->device_y_scale = 1.0;
+ surface->clip = NULL;
surface->next_clip_serial = 0;
surface->current_clip_serial = 0;
@@ -1141,6 +1142,66 @@
return _fallback_fill_rectangles (surface, operator, color, rects, num_rects);
}
+
+static cairo_status_t
+_fallback_paint (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *dst)
+{
+ cairo_status_t status;
+ cairo_rectangle_t rectangle;
+ cairo_box_t box;
+ cairo_traps_t traps;
+
+ status = _cairo_surface_get_extents (dst, &rectangle);
+ if (status)
+ return status;
+
+ status = _cairo_clip_intersect_to_rectangle (dst->clip, &rectangle);
+ if (status)
+ return status;
+
+ box.p1.x = _cairo_fixed_from_int (rectangle.x);
+ box.p1.y = _cairo_fixed_from_int (rectangle.y);
+ box.p2.x = _cairo_fixed_from_int (rectangle.x + rectangle.width);
+ box.p2.y = _cairo_fixed_from_int (rectangle.y + rectangle.height);
+
+ status = _cairo_traps_init_box (&traps, &box);
+ if (status)
+ return status;
+
+ _cairo_surface_clip_and_composite_trapezoids (pattern,
+ operator,
+ dst,
+ &traps,
+ dst->clip,
+ CAIRO_ANTIALIAS_NONE);
+
+ _cairo_traps_fini (&traps);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_surface_paint (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *dst)
+{
+ /* cairo_status_t status; */
+
+ assert (! dst->is_snapshot);
+
+ /* XXX: Need to add this to the backend.
+ if (dst->backend->paint) {
+ status = dst->backend->paint (operator, pattern, dst);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+ }
+ */
+
+ return _fallback_paint (operator, pattern, dst);
+}
+
static cairo_status_t
_fallback_fill_path (cairo_operator_t operator,
@@ -1554,9 +1615,12 @@
{
if (!surface)
return CAIRO_STATUS_NULL_POINTER;
+
+ surface->clip = clip;
+
if (clip->serial == _cairo_surface_get_current_clip_serial (surface))
return CAIRO_STATUS_SUCCESS;
-
+
if (clip->path)
return _cairo_surface_set_clip_path (surface,
clip->path,
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -d -r1.216 -r1.217
--- cairoint.h 14 Oct 2005 04:00:52 -0000 1.216
+++ cairoint.h 27 Oct 2005 22:06:53 -0000 1.217
@@ -761,6 +761,8 @@
double device_x_scale;
double device_y_scale;
+ cairo_clip_t *clip;
+
/*
* Each time a clip region is modified, it gets the next value in this
* sequence. This means that clip regions for this surface are uniquely
@@ -1548,6 +1550,11 @@
cairo_rectangle_t *rects,
int num_rects);
+cairo_status_t
+_cairo_surface_paint (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *dst);
+
cairo_private cairo_status_t
_cairo_surface_fill_path (cairo_operator_t operator,
cairo_pattern_t *pattern,
More information about the cairo-commit
mailing list