mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 02:18:03 +02:00
Update composite-over-white code to use a pattern, not a surface. (to match _cairo_surface_composite API change.)
This commit is contained in:
parent
dca785faaf
commit
608a52ff93
3 changed files with 18 additions and 34 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2005-01-30 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* src/cairo_ps_surface.c (_cairo_ps_surface_copy_page): Update
|
||||
composite-over-white code to use a pattern, not a surface.
|
||||
(to match _cairo_surface_composite API change.)
|
||||
|
||||
2005-01-30 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Fixes from David Reveman:
|
||||
|
|
|
|||
|
|
@ -314,12 +314,10 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
|
|||
|
||||
int i, x, y;
|
||||
|
||||
cairo_surface_t *white_surface;
|
||||
cairo_pattern_t white_pattern;
|
||||
char *rgb, *compressed;
|
||||
long rgb_size, compressed_size;
|
||||
|
||||
cairo_color_t white;
|
||||
|
||||
rgb_size = 3 * width * height;
|
||||
rgb = malloc (rgb_size);
|
||||
if (rgb == NULL) {
|
||||
|
|
@ -336,26 +334,19 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
|
|||
|
||||
/* PostScript can not represent the alpha channel, so we blend the
|
||||
current image over a white RGB surface to eliminate it. */
|
||||
white_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
|
||||
if (white_surface == NULL) {
|
||||
status = CAIRO_STATUS_NO_MEMORY;
|
||||
goto BAIL2;
|
||||
}
|
||||
|
||||
_cairo_color_init (&white);
|
||||
_cairo_surface_fill_rectangle (white_surface,
|
||||
CAIRO_OPERATOR_SRC,
|
||||
&white,
|
||||
0, 0, 1, 1);
|
||||
cairo_surface_set_repeat (white_surface, 1);
|
||||
_cairo_pattern_init_solid (&white_pattern, 1.0, 1.0, 1.0);
|
||||
|
||||
_cairo_surface_composite (CAIRO_OPERATOR_OVER_REVERSE,
|
||||
white_surface,
|
||||
&white_pattern,
|
||||
NULL,
|
||||
&surface->image->base,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
width, height);
|
||||
|
||||
_cairo_pattern_fini (&white_pattern);
|
||||
|
||||
i = 0;
|
||||
for (y = 0; y < height; y++) {
|
||||
|
|
@ -399,8 +390,6 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
|
|||
/* Page footer */
|
||||
fprintf (file, "%%%%EndPage\n");
|
||||
|
||||
cairo_surface_destroy (white_surface);
|
||||
BAIL2:
|
||||
free (compressed);
|
||||
BAIL1:
|
||||
free (rgb);
|
||||
|
|
|
|||
|
|
@ -314,12 +314,10 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
|
|||
|
||||
int i, x, y;
|
||||
|
||||
cairo_surface_t *white_surface;
|
||||
cairo_pattern_t white_pattern;
|
||||
char *rgb, *compressed;
|
||||
long rgb_size, compressed_size;
|
||||
|
||||
cairo_color_t white;
|
||||
|
||||
rgb_size = 3 * width * height;
|
||||
rgb = malloc (rgb_size);
|
||||
if (rgb == NULL) {
|
||||
|
|
@ -336,26 +334,19 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
|
|||
|
||||
/* PostScript can not represent the alpha channel, so we blend the
|
||||
current image over a white RGB surface to eliminate it. */
|
||||
white_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
|
||||
if (white_surface == NULL) {
|
||||
status = CAIRO_STATUS_NO_MEMORY;
|
||||
goto BAIL2;
|
||||
}
|
||||
|
||||
_cairo_color_init (&white);
|
||||
_cairo_surface_fill_rectangle (white_surface,
|
||||
CAIRO_OPERATOR_SRC,
|
||||
&white,
|
||||
0, 0, 1, 1);
|
||||
cairo_surface_set_repeat (white_surface, 1);
|
||||
_cairo_pattern_init_solid (&white_pattern, 1.0, 1.0, 1.0);
|
||||
|
||||
_cairo_surface_composite (CAIRO_OPERATOR_OVER_REVERSE,
|
||||
white_surface,
|
||||
&white_pattern,
|
||||
NULL,
|
||||
&surface->image->base,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
width, height);
|
||||
|
||||
_cairo_pattern_fini (&white_pattern);
|
||||
|
||||
i = 0;
|
||||
for (y = 0; y < height; y++) {
|
||||
|
|
@ -399,8 +390,6 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
|
|||
/* Page footer */
|
||||
fprintf (file, "%%%%EndPage\n");
|
||||
|
||||
cairo_surface_destroy (white_surface);
|
||||
BAIL2:
|
||||
free (compressed);
|
||||
BAIL1:
|
||||
free (rgb);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue