Bug 612846 - Part 2: Make cairo_tee_surface support flush. r=roc a=blocking-betan

This commit is contained in:
Matt Woodrow 2011-01-28 06:34:27 +01:00
parent f1a534a9d2
commit 8be445ca2f
3 changed files with 35 additions and 1 deletions

View File

@ -152,6 +152,9 @@ _cairo_surface_wrapper_snapshot (cairo_surface_wrapper_t *wrapper);
cairo_private cairo_bool_t
_cairo_surface_wrapper_has_show_text_glyphs (cairo_surface_wrapper_t *wrapper);
cairo_private cairo_status_t
_cairo_surface_wrapper_flush (cairo_surface_wrapper_t *wrapper);
static inline cairo_bool_t
_cairo_surface_wrapper_is_active (cairo_surface_wrapper_t *wrapper)
{

View File

@ -524,3 +524,11 @@ _cairo_surface_wrapper_fini (cairo_surface_wrapper_t *wrapper)
{
cairo_surface_destroy (wrapper->target);
}
cairo_status_t
_cairo_surface_wrapper_flush (cairo_surface_wrapper_t *wrapper)
{
if (wrapper->target->backend->flush) {
return wrapper->target->backend->flush(wrapper->target);
}
}

View File

@ -467,6 +467,29 @@ _cairo_tee_surface_show_text_glyphs (void *abstract_surface,
return status;
}
static cairo_status_t
_cairo_tee_surface_flush (void *abstract_surface)
{
cairo_tee_surface_t *surface = abstract_surface;
cairo_surface_wrapper_t *slaves;
int n, num_slaves;
cairo_status_t status;
status = _cairo_surface_wrapper_flush(&surface->master);
if (unlikely (status))
return status;
num_slaves = _cairo_array_num_elements (&surface->slaves);
slaves = _cairo_array_index (&surface->slaves, 0);
for (n = 0; n < num_slaves; n++) {
status = _cairo_surface_wrapper_flush(&slaves[n]);
if (unlikely (status))
return status;
}
return CAIRO_STATUS_SUCCESS;
}
static const cairo_surface_backend_t cairo_tee_surface_backend = {
CAIRO_SURFACE_TYPE_TEE,
_cairo_tee_surface_create_similar,
@ -485,7 +508,7 @@ static const cairo_surface_backend_t cairo_tee_surface_backend = {
_cairo_tee_surface_get_extents,
NULL, /* old_show_glyphs */
_cairo_tee_surface_get_font_options,
NULL, /* flush */
_cairo_tee_surface_flush,
NULL, /* mark_dirty_rectangle */
NULL, /* scaled_font_fini */
NULL, /* scaled_glyph_fini */