Add a call to cairo_copy_page, so that that gets called at least once within the test suite.

Fix broken implementation of copy_page in the paginated surface by hiding it from the target surface which sees only show_page operations. (It's hard to do better than that unless we can guarantee thathe subsequent page won't trigger any image fallbacks.)
This commit is contained in:
Carl Worth 2006-01-12 16:47:05 +00:00
parent 25882cd5e9
commit 4e4b38e759
3 changed files with 35 additions and 27 deletions

View file

@ -1,3 +1,16 @@
2006-01-12 Carl Worth <cworth@cworth.org>
* test/multi-page.c: (draw_some_pages), (main): Add a call to
cairo_copy_page, so that that gets called at least once within the
test suite.
* src/cairo-paginated-surface.c:
(_cairo_paginated_surface_copy_page): Fix broken implementation of
copy_page in the paginated surface by hiding it from the target
surface which sees only show_page operations. (It's hard to do
better than that unless we can guarantee thathe subsequent page
won't trigger any image fallbacks.)
2006-01-12 Carl Worth <cworth@cworth.org>
* configure.in: Add a new CAIRO_HAS_MULTI_PAGE_SURFACES automake

View file

@ -222,31 +222,18 @@ static cairo_int_status_t
_cairo_paginated_surface_copy_page (void *abstract_surface)
{
cairo_paginated_surface_t *surface = abstract_surface;
cairo_int_status_t status;
_paint_page (surface);
status = _cairo_surface_copy_page (surface->target);
/* XXX: It might make sense to add some suport here for calling
* _cairo_surface_copy_page on the target surface. It would be an
* optimization for the output, (so that PostScript could include
* copypage, for example), but the interaction with image
* fallbacks gets tricky. For now, we just let the target see a
* show_page and we implement the copying by simply not destroying
* the meta-surface. */
/* If the surface does not support copy_page then we use show_page
* instead, and we leave the meta-surface untouched so that its
* contents will remain for the next page. */
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
status = _cairo_surface_show_page (surface->target);
/* And if the surface doesn't support show_page either, we
* also fall through and clear the meta-surface. */
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
}
/* Otherwise, we clear the meta-surface since the target surface
* has already taken care of any copying in its implementation of
* copy_page. */
cairo_surface_destroy (surface->meta);
surface->meta = _cairo_meta_surface_create (surface->width, surface->height);
if (cairo_surface_status (surface->meta))
return cairo_surface_status (surface->meta);
_cairo_surface_show_page (surface->target);
return CAIRO_STATUS_SUCCESS;
}

View file

@ -103,16 +103,24 @@ draw (cairo_t *cr, double width, double height, double smile_ratio)
}
static void
draw_five_pages (cairo_surface_t *surface)
draw_some_pages (cairo_surface_t *surface)
{
cairo_t *cr;
int i;
cr = cairo_create (surface);
#define NUM_PAGES 5
for (i=0; i < NUM_PAGES; i++) {
draw (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS, (double) i / (NUM_PAGES - 1));
#define NUM_FRAMES 5
for (i=0; i < NUM_FRAMES; i++) {
draw (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS,
(double) i / (NUM_FRAMES - 1));
/* Duplicate the last frame onto another page. (This is just a
* way to sneak cairo_copy_page into the test).
*/
if (i == (NUM_FRAMES - 1))
cairo_copy_page (cr);
cairo_show_page (cr);
}
@ -140,7 +148,7 @@ main (void)
return CAIRO_TEST_FAILURE;
}
draw_five_pages (surface);
draw_some_pages (surface);
cairo_surface_destroy (surface);
@ -159,7 +167,7 @@ main (void)
return CAIRO_TEST_FAILURE;
}
draw_five_pages (surface);
draw_some_pages (surface);
cairo_surface_destroy (surface);