[cairo-commit] cairo/src cairo-glitz-surface.c, 1.32,
1.33 cairo-gstate.c, 1.111, 1.112 cairo-image-surface.c, 1.36,
1.37 cairo-pdf-surface.c, 1.29, 1.30 cairo-ps-surface.c, 1.32,
1.33 cairo-quartz-surface.c, 1.7, 1.8 cairo-surface.c, 1.59,
1.60 cairo-win32-surface.c, 1.17, 1.18 cairo-xcb-surface.c,
1.22, 1.23 cairo-xlib-surface.c, 1.59, 1.60 cairo.c, 1.78,
1.79 cairo.h, 1.99, 1.100 cairoint.h, 1.127, 1.128
Carl Worth
commit at pdx.freedesktop.org
Tue Apr 19 16:29:07 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv32558/src
Modified Files:
cairo-glitz-surface.c cairo-gstate.c cairo-image-surface.c
cairo-pdf-surface.c cairo-ps-surface.c cairo-quartz-surface.c
cairo-surface.c cairo-win32-surface.c cairo-xcb-surface.c
cairo-xlib-surface.c cairo.c cairo.h cairoint.h
Log Message:
* src/cairo.c: (cairo_paint):
* src/cairo.h: Add new cairo_paint function.
* src/cairoint.h: Add new get_extents function to the surface
backend interface.
* src/cairo-gstate.c: (_cairo_gstate_get_clip_extents): Add
function to query current clip_extents.
* src/cairo-glitz-surface.c: (_cairo_glitz_surface_get_extents):
* src/cairo-image-surface.c: (_cairo_image_surface_get_extents),
(_cairo_image_abstract_surface_get_extents):
* src/cairo-pdf-surface.c: (_cairo_pdf_surface_get_extents):
* src/cairo-ps-surface.c: (_cairo_ps_surface_get_extents):
* src/cairo-quartz-surface.c: (_cairo_quartz_surface_get_extents):
* src/cairo-win32-surface.c: (_cairo_win32_get_extents):
* src/cairo-xcb-surface.c: (_cairo_xcb_surface_get_extents):
* src/cairo-xlib-surface.c: (_cairo_xlib_surface_get_extents):
Implement the new get_extents function for each backend.
* src/cairo-surface.c: (_cairo_surface_init),
(_cairo_surface_set_clip_region),
(_cairo_surface_get_clip_extents): Save the clip extents from
set_clip_region and implement _cairo_surface_get_clip_extents.
* src/cairo-xlib-surface.c: (_cairo_xlib_surface_get_size),
(_get_image_surface): Abstract away the evil XGetGeometry
roundtrip in _cairo_xlib_surface_get_size.
* test/gradient-alpha.c: (draw):
* test/linear-gradient.c: (draw): Rewrite a couple of tests to
call cairo_paint.
Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cairo-glitz-surface.c 14 Apr 2005 21:42:26 -0000 1.32
+++ cairo-glitz-surface.c 19 Apr 2005 23:29:05 -0000 1.33
@@ -1199,6 +1199,20 @@
return CAIRO_STATUS_SUCCESS;
}
+static cairo_int_status_t
+_cairo_glitz_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_glitz_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+ rectangle->width = glitz_surface_get_width (surface->surface);
+ rectangle->height = glitz_surface_get_height (surface->surface);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static const cairo_surface_backend_t cairo_glitz_surface_backend = {
_cairo_glitz_surface_create_similar,
_cairo_glitz_surface_finish,
@@ -1213,6 +1227,7 @@
NULL, /* copy_page */
NULL, /* show_page */
_cairo_glitz_surface_set_clip_region,
+ _cairo_glitz_surface_get_extents,
NULL /* show_glyphs */
};
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- cairo-gstate.c 14 Apr 2005 21:42:26 -0000 1.111
+++ cairo-gstate.c 19 Apr 2005 23:29:05 -0000 1.112
@@ -1298,6 +1298,13 @@
}
cairo_status_t
+_cairo_gstate_get_clip_extents (cairo_gstate_t *gstate,
+ cairo_rectangle_t *rectangle)
+{
+ return _cairo_surface_get_clip_extents (gstate->surface, rectangle);
+}
+
+cairo_status_t
_cairo_gstate_stroke (cairo_gstate_t *gstate)
{
cairo_status_t status;
Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cairo-image-surface.c 13 Apr 2005 21:51:59 -0000 1.36
+++ cairo-image-surface.c 19 Apr 2005 23:29:05 -0000 1.37
@@ -626,6 +626,27 @@
return CAIRO_STATUS_SUCCESS;
}
+static cairo_int_status_t
+_cairo_image_surface_get_extents (cairo_image_surface_t *surface,
+ cairo_rectangle_t *rectangle)
+{
+ rectangle->x = 0;
+ rectangle->y = 0;
+ rectangle->width = surface->width;
+ rectangle->height = surface->height;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_cairo_image_abstract_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_image_surface_t *surface = abstract_surface;
+
+ return _cairo_image_surface_get_extents (surface, rectangle);
+}
+
/**
* _cairo_surface_is_image:
* @surface: a #cairo_surface_t
@@ -654,5 +675,6 @@
NULL, /* copy_page */
NULL, /* show_page */
_cairo_image_abstract_surface_set_clip_region,
+ _cairo_image_abstract_surface_get_extents,
NULL /* show_glyphs */
};
Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cairo-pdf-surface.c 14 Apr 2005 21:42:26 -0000 1.29
+++ cairo-pdf-surface.c 19 Apr 2005 23:29:05 -0000 1.30
@@ -1712,6 +1712,25 @@
return status;
}
+static cairo_int_status_t
+_cairo_pdf_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_pdf_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+
+ /* XXX: The conversion to integers here is pretty bogus, (not to
+ * mention the aribitray limitation of width to a short(!). We
+ * may need to come up with a better interface for get_size.
+ */
+ rectangle->width = (int) (surface->width_inches * 72.0 + 1.0);
+ rectangle->height = (int) (surface->height_inches * 72.0 + 1.0);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static cairo_pdf_font_t *
_cairo_pdf_document_get_font (cairo_pdf_document_t *document,
cairo_scaled_font_t *scaled_font)
@@ -1743,7 +1762,7 @@
return pdf_font;
}
-static cairo_status_t
+static cairo_int_status_t
_cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
@@ -1807,6 +1826,7 @@
_cairo_pdf_surface_copy_page,
_cairo_pdf_surface_show_page,
NULL, /* set_clip_region */
+ _cairo_pdf_surface_get_extents,
_cairo_pdf_surface_show_glyphs
};
Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cairo-ps-surface.c 14 Apr 2005 21:42:26 -0000 1.32
+++ cairo-ps-surface.c 19 Apr 2005 23:29:05 -0000 1.33
@@ -303,6 +303,25 @@
return _cairo_image_surface_set_clip_region (surface->image, region);
}
+static cairo_int_status_t
+_cairo_ps_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+
+ /* XXX: The conversion to integers here is pretty bogus, (not to
+ * mention the aribitray limitation of width to a short(!). We
+ * may need to come up with a better interface for get_size.
+ */
+ rectangle->width = (surface->width_inches * 72.0 + 0.5);
+ rectangle->height = (surface->height_inches * 72.0 + 0.5);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static const cairo_surface_backend_t cairo_ps_surface_backend = {
_cairo_ps_surface_create_similar,
_cairo_ps_surface_finish,
@@ -317,5 +336,6 @@
_cairo_ps_surface_copy_page,
_cairo_ps_surface_show_page,
_cairo_ps_surface_set_clip_region,
+ _cairo_ps_surface_get_extents,
NULL /* show_glyphs */
};
Index: cairo-quartz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-quartz-surface.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cairo-quartz-surface.c 7 Apr 2005 21:25:00 -0000 1.7
+++ cairo-quartz-surface.c 19 Apr 2005 23:29:05 -0000 1.8
@@ -82,7 +82,6 @@
cairo_surface_destroy(surface);
}
-
static cairo_surface_t *_cairo_quartz_surface_create_similar(void
*abstract_src,
cairo_format_t
@@ -94,7 +93,6 @@
return NULL;
}
-
static void _cairo_quartz_surface_finish(void *abstract_surface)
{
cairo_quartz_surface_t *surface = abstract_surface;
@@ -222,6 +220,15 @@
return _cairo_image_surface_set_clip_region(surface->image, region);
}
+static void
+_cairo_quartz_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t * rectangle)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+
+ _cairo_image_surface_get_extents(surface->image, rectangle);
+}
+
static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
_cairo_quartz_surface_create_similar,
_cairo_quartz_surface_finish,
@@ -236,6 +243,7 @@
NULL, /* copy_page */
NULL, /* show_page */
_cairo_quartz_surface_set_clip_region,
+ _cairo_quartz_surface_get_extents,
NULL /* show_glyphs */
};
Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo-surface.c 14 Apr 2005 21:42:26 -0000 1.59
+++ cairo-surface.c 19 Apr 2005 23:29:05 -0000 1.60
@@ -56,6 +56,12 @@
surface->device_x_offset = 0;
surface->device_y_offset = 0;
+
+ surface->is_clipped = 0;
+ surface->clip_extents.x = 0;
+ surface->clip_extents.y = 0;
+ surface->clip_extents.width = 0;
+ surface->clip_extents.height = 0;
}
cairo_surface_t *
@@ -850,15 +856,46 @@
}
cairo_status_t
-_cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region)
+_cairo_surface_set_clip_region (cairo_surface_t *surface,
+ pixman_region16_t *region)
{
+ pixman_box16_t *box;
+
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
+ if (region) {
+ box = pixman_region_extents (region);
+
+ surface->clip_extents.x = box->x1;
+ surface->clip_extents.y = box->y1;
+ surface->clip_extents.width = box->x2 - box->x1;
+ surface->clip_extents.height = box->y2 - box->y1;
+
+ surface->is_clipped = 1;
+ } else {
+ surface->is_clipped = 0;
+ }
+
return surface->backend->set_clip_region (surface, region);
}
cairo_status_t
+_cairo_surface_get_clip_extents (cairo_surface_t *surface,
+ cairo_rectangle_t *rectangle)
+{
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ if (surface->is_clipped) {
+ *rectangle = surface->clip_extents;
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ return surface->backend->get_extents (surface, rectangle);
+}
+
+cairo_status_t
_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
Index: cairo-win32-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-surface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cairo-win32-surface.c 7 Apr 2005 21:25:00 -0000 1.17
+++ cairo-win32-surface.c 19 Apr 2005 23:29:05 -0000 1.18
@@ -780,6 +780,23 @@
}
}
+static cairo_int_status_t
+_cairo_win32_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ RECT clip_box;
+
+ if (GetClipBox (surface->dc, &clip_box) == ERROR)
+ return _cairo_win32_print_gdi_error ("_cairo_win3_surface_acquire_dest_image");
+
+ rectangle->x = clip_box.left;
+ rectangle->y = clip_box.top;
+ rectangle->width = clip_box.right - clip_box.left;
+ rectangle->height = clip_box.bottom - clip_box.top;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
cairo_surface_t *
cairo_win32_surface_create (HDC hdc)
{
@@ -844,5 +861,6 @@
NULL, /* copy_page */
NULL, /* show_page */
_cairo_win32_surface_set_clip_region,
+ _cairo_win32_surface_get_extents,
NULL /* show_glyphs */
};
Index: cairo-xcb-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xcb-surface.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cairo-xcb-surface.c 7 Apr 2005 21:25:00 -0000 1.22
+++ cairo-xcb-surface.c 19 Apr 2005 23:29:05 -0000 1.23
@@ -848,6 +848,20 @@
return CAIRO_INT_STATUS_UNSUPPORTED;
}
+static cairo_int_status_t
+_cairo_xcb_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_xlib_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+ rectangle->width = surface->width;
+ rectangle->height = surface->height;
+
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+}
+
static const cairo_surface_backend_t cairo_xcb_surface_backend = {
_cairo_xcb_surface_create_similar,
_cairo_xcb_surface_finish,
@@ -862,6 +876,7 @@
NULL, /* copy_page */
NULL, /* show_page */
_cairo_xcb_surface_set_clip_region,
+ _cairo_xcb_surface_get_extents,
NULL /* show_glyphs */
};
Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo-xlib-surface.c 14 Apr 2005 21:42:26 -0000 1.59
+++ cairo-xlib-surface.c 19 Apr 2005 23:29:05 -0000 1.60
@@ -159,6 +159,40 @@
return CAIRO_STATUS_SUCCESS;
}
+static void
+_cairo_xlib_surface_get_size (cairo_xlib_surface_t *surface,
+ int *width,
+ int *height)
+{
+ unsigned int width_u, height_u;
+ Window root_ignore;
+ int x_ignore, y_ignore;
+ unsigned int bwidth_ignore, depth_ignore;
+
+ if (surface->width >= 0 && surface->height >= 0) {
+ *width = surface->width;
+ *height = surface->height;
+ return;
+ }
+
+ XGetGeometry (surface->dpy,
+ surface->drawable,
+ &root_ignore, &x_ignore, &y_ignore,
+ &width_u, &height_u,
+ &bwidth_ignore, &depth_ignore);
+
+ /* The size of a pixmap can't change, so we store
+ * the information to avoid having to get it again
+ */
+ if (surface->type == CAIRO_XLIB_PIXMAP) {
+ surface->width = width_u;
+ surface->height = height_u;
+ }
+
+ *width = width_u;
+ *height = height_u;
+}
+
static cairo_status_t
_get_image_surface (cairo_xlib_surface_t *surface,
cairo_rectangle_t *interest_rect,
@@ -171,33 +205,8 @@
x1 = 0;
y1 = 0;
-
- if (surface->width >= 0 && surface->height >= 0) {
- x2 = surface->width;
- y2 = surface->height;
- } else {
- unsigned int width, height;
- Window root_ignore;
- int x_ignore, y_ignore;
- unsigned int bwidth_ignore, depth_ignore;
-
- XGetGeometry (surface->dpy,
- surface->drawable,
- &root_ignore, &x_ignore, &y_ignore,
- &width, &height,
- &bwidth_ignore, &depth_ignore);
- /* The size of a pixmap can't change, so we store
- * the information to avoid having to get it again
- */
- if (surface->type == CAIRO_XLIB_PIXMAP) {
- surface->width = width;
- surface->height = height;
- }
-
- x2 = width;
- y2 = height;
- }
+ _cairo_xlib_surface_get_size (surface, &x2, &y2);
if (interest_rect) {
cairo_rectangle_t rect;
@@ -835,7 +844,26 @@
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
+static cairo_int_status_t
+_cairo_xlib_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_xlib_surface_t *surface = abstract_surface;
+ int width, height;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+
+ _cairo_xlib_surface_get_size (surface,
+ &width, &height);
+
+ rectangle->width = width;
+ rectangle->height = height;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
@@ -863,6 +891,7 @@
NULL, /* copy_page */
NULL, /* show_page */
_cairo_xlib_surface_set_clip_region,
+ _cairo_xlib_surface_get_extents,
_cairo_xlib_surface_show_glyphs
};
@@ -1553,7 +1582,7 @@
}
-static cairo_status_t
+static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- cairo.c 14 Apr 2005 21:42:26 -0000 1.78
+++ cairo.c 19 Apr 2005 23:29:05 -0000 1.79
@@ -1362,7 +1362,7 @@
/* XXX: NYI
void
-cairo_stroke_path (cairo_t *cr)
+cairo_stroke_to_path (cairo_t *cr)
{
if (cr->status)
return;
@@ -1383,6 +1383,35 @@
}
slim_hidden_def(cairo_close_path);
+/**
+ * cairo_paint:
+ * @cr: a cairo context
+ *
+ * A drawing operator that paints the current source everywhere within
+ * the current clip region.
+ **/
+void
+cairo_paint (cairo_t *cr)
+{
+ cairo_rectangle_t rectangle;
+
+ CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ return;
+
+ cr->status = _cairo_gstate_get_clip_extents (cr->gstate, &rectangle);
+ if (cr->status)
+ return;
+
+ cairo_rectangle (cr,
+ rectangle.x, rectangle.y,
+ rectangle.width, rectangle.height);
+
+ cairo_fill (cr);
+
+ CAIRO_CHECK_SANITY (cr);
+}
+
void
cairo_stroke (cairo_t *cr)
{
Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- cairo.h 14 Apr 2005 21:42:27 -0000 1.99
+++ cairo.h 19 Apr 2005 23:29:05 -0000 1.100
@@ -428,6 +428,9 @@
/* Painting functions */
void
+cairo_paint (cairo_t *cr);
+
+void
cairo_stroke (cairo_t *cr);
void
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- cairoint.h 14 Apr 2005 21:42:27 -0000 1.127
+++ cairoint.h 19 Apr 2005 23:29:05 -0000 1.128
@@ -176,7 +176,7 @@
cairo_line_t left, right;
} cairo_trapezoid_t;
-typedef struct _cairo_rectangle_int {
+typedef struct _cairo_rectangle {
short x, y;
unsigned short width, height;
} cairo_rectangle_t, cairo_glyph_size_t;
@@ -565,21 +565,21 @@
typedef struct _cairo_surface_backend {
cairo_surface_t *
(*create_similar) (void *surface,
- cairo_format_t format,
- int drawable,
- int width,
- int height);
+ cairo_format_t format,
+ int drawable,
+ int width,
+ int height);
cairo_status_t
(*finish) (void *surface);
cairo_status_t
- (* acquire_source_image) (void *abstract_surface,
+ (*acquire_source_image) (void *abstract_surface,
cairo_image_surface_t **image_out,
void **image_extra);
void
- (* release_source_image) (void *abstract_surface,
+ (*release_source_image) (void *abstract_surface,
cairo_image_surface_t *image,
void *image_extra);
@@ -604,39 +604,39 @@
/* XXX: dst should be the first argument for consistency */
cairo_int_status_t
- (*composite) (cairo_operator_t operator,
+ (*composite) (cairo_operator_t operator,
cairo_pattern_t *src,
cairo_pattern_t *mask,
void *dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height);
+ int src_x,
+ int src_y,
+ int mask_x,
+ int mask_y,
+ int dst_x,
+ int dst_y,
+ unsigned int width,
+ unsigned int height);
cairo_int_status_t
(*fill_rectangles) (void *surface,
- cairo_operator_t operator,
+ cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
- int num_rects);
+ int num_rects);
/* XXX: dst should be the first argument for consistency */
cairo_int_status_t
- (*composite_trapezoids) (cairo_operator_t operator,
+ (*composite_trapezoids) (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *dst,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ unsigned int width,
+ unsigned int height,
cairo_trapezoid_t *traps,
- int num_traps);
+ int num_traps);
cairo_int_status_t
(*copy_page) (void *surface);
@@ -647,24 +647,39 @@
cairo_int_status_t
(*set_clip_region) (void *surface,
pixman_region16_t *region);
+
+ /* Get the extents of the current surface. For many surface types
+ * this will be as simple as { x=0, y=0, width=surface->width,
+ * height=surface->height}.
+ *
+ * This function need not take account of any clipping from
+ * set_clip_region since the generic version of set_clip_region
+ * saves those, and the generic get_clip_extents will only call
+ * into the specific surface->get_extents if there is no current
+ * clip.
+ */
+ cairo_int_status_t
+ (*get_extents) (void *surface,
+ cairo_rectangle_t *rectangle);
+
/*
* This is an optional entry to let the surface manage its own glyph
* resources. If null, the font will be asked to render against this
* surface, using image surfaces as glyphs.
*/
- cairo_status_t
- (*show_glyphs) (cairo_scaled_font_t *scaled_font,
- cairo_operator_t operator,
+ cairo_int_status_t
+ (*show_glyphs) (cairo_scaled_font_t *font,
+ cairo_operator_t operator,
cairo_pattern_t *pattern,
void *surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
const cairo_glyph_t *glyphs,
- int num_glyphs);
+ int num_glyphs);
} cairo_surface_backend_t;
typedef struct _cairo_format_masks {
@@ -688,6 +703,9 @@
double device_x_offset;
double device_y_offset;
+
+ int is_clipped;
+ cairo_rectangle_t clip_extents;
};
struct _cairo_image_surface {
@@ -1083,6 +1101,10 @@
void *closure);
cairo_private cairo_status_t
+_cairo_gstate_get_clip_extents (cairo_gstate_t *gstate,
+ cairo_rectangle_t *rectangle);
+
+cairo_private cairo_status_t
_cairo_gstate_stroke (cairo_gstate_t *gstate);
cairo_private cairo_status_t
@@ -1485,7 +1507,12 @@
cairo_surface_t **clone_out);
cairo_private cairo_status_t
-_cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region);
+_cairo_surface_set_clip_region (cairo_surface_t *surface,
+ pixman_region16_t *region);
+
+cairo_private cairo_status_t
+_cairo_surface_get_clip_extents (cairo_surface_t *surface,
+ cairo_rectangle_t *rectangle);
cairo_private cairo_status_t
_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
More information about the cairo-commit
mailing list