Paint with white to intermediate RGB24 images before replaying meta-surface to preserve default white background instead of forcing a black background instead.

This commit is contained in:
Carl Worth 2006-01-11 16:29:17 +00:00
parent ebeaeeccec
commit 107a52ed61
2 changed files with 30 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2006-01-11 Carl Worth <cworth@cworth.org>
* src/cairo-paginated-surface.c:
(_cairo_paginated_surface_acquire_source_image), (_paint_page),
(_cairo_paginated_surface_snapshot): Paint with white to
intermediate RGB24 images before replaying meta-surface to
preserve default white background instead of forcing a black
background instead.
2006-01-11 Carl Worth <cworth@cworth.org>
* ROADMAP: Note that PS backend has now been switched over to use

View file

@ -163,11 +163,18 @@ _cairo_paginated_surface_acquire_source_image (void *abstract_surface,
cairo_paginated_surface_t *surface = abstract_surface;
cairo_surface_t *image;
cairo_rectangle_t extents;
cairo_pattern_t *white;
_cairo_surface_get_extents (surface->target, &extents);
image = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
extents.width, extents.height);
white = _cairo_pattern_create_solid (_cairo_stock_color (CAIRO_STOCK_WHITE));
_cairo_surface_paint (image, CAIRO_OPERATOR_SOURCE, white);
cairo_pattern_destroy (white);
_cairo_meta_surface_replay (surface->meta, image);
@ -189,11 +196,17 @@ static void
_paint_page (cairo_paginated_surface_t *surface)
{
cairo_surface_t *image;
cairo_pattern_t *pattern;
cairo_pattern_t *white, *pattern;
image = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
surface->width, surface->height);
white = _cairo_pattern_create_solid (_cairo_stock_color (CAIRO_STOCK_WHITE));
_cairo_surface_paint (image, CAIRO_OPERATOR_SOURCE, white);
cairo_pattern_destroy (white);
_cairo_meta_surface_replay (surface->meta, image);
pattern = cairo_pattern_create_for_surface (image);
@ -372,6 +385,7 @@ _cairo_paginated_surface_snapshot (void *abstract_other)
#else
cairo_rectangle_t extents;
cairo_surface_t *surface;
cairo_pattern_t *white;
_cairo_surface_get_extents (other->target, &extents);
@ -379,6 +393,12 @@ _cairo_paginated_surface_snapshot (void *abstract_other)
extents.width,
extents.height);
white = _cairo_pattern_create_solid (_cairo_stock_color (CAIRO_STOCK_WHITE));
_cairo_surface_paint (surface, CAIRO_OPERATOR_SOURCE, white);
cairo_pattern_destroy (white);
_cairo_meta_surface_replay (other->meta, surface);
return surface;