summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-10-01 02:53:30 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-10-01 02:53:30 -0400
commit7c9d3e6ab754fac24c1618effa8a76f17289571a (patch)
treebdc23b60e4ac1392a8d223cef16b6a523f184e73
parente0bbbbde9ed7d19f390f1cd840f81e338568f599 (diff)
Delete old compositing code
-rw-r--r--src/cairo-pixman-surface.c681
1 files changed, 11 insertions, 670 deletions
diff --git a/src/cairo-pixman-surface.c b/src/cairo-pixman-surface.c
index bf0c0f03..0f224363 100644
--- a/src/cairo-pixman-surface.c
+++ b/src/cairo-pixman-surface.c
@@ -468,6 +468,7 @@ command_buffer_ensure (command_buffer_t *buffer, int n_more)
static void
command_buffer_clear (command_buffer_t *buffer)
{
+ /* FIXME: walk the commands and free contents */
buffer->oom = 0;
buffer->n_commands = 0;
buffer->n_allocated = 1;
@@ -489,6 +490,7 @@ command_buffer_new (void)
static void
command_buffer_free (command_buffer_t *buffer)
{
+ command_buffer_clear (buffer);
free (buffer);
}
@@ -737,6 +739,7 @@ command_buffer_process (command_buffer_t *buffer, int width, int height)
command->new_glyphs.glyph_cache,
command->new_glyphs.n_glyphs,
command->new_glyphs.glyphs);
+ images[command->new_glyphs.id] = img;
break;
case COMPOSITE:
@@ -841,23 +844,6 @@ set_properties (pixman_image_t *image, cairo_pattern_t *pattern, cairo_matrix_t
pixman_image_set_component_alpha (image, pattern->has_component_alpha);
}
-static cairo_int_status_t
-pimage_from_solid_pattern (cairo_solid_pattern_t *solid,
- pixman_image_t **result)
-{
- pixman_color_t pcolor;
-
- pcolor.red = _cairo_color_double_to_short (solid->color.red);
- pcolor.green = _cairo_color_double_to_short (solid->color.green);
- pcolor.blue = _cairo_color_double_to_short (solid->color.blue);
- pcolor.alpha = _cairo_color_double_to_short (solid->color.alpha);
-
- if (!(*result = pixman_image_create_solid_fill (&pcolor)))
- return CAIRO_INT_STATUS_NO_MEMORY;
-
- return CAIRO_INT_STATUS_SUCCESS;
-}
-
static int
pimage_from_solid_pattern2 (command_buffer_t **buffer,
cairo_solid_pattern_t *solid)
@@ -900,97 +886,6 @@ clean_up_acquire (pixman_image_t *image, void *closure)
}
}
-static cairo_int_status_t
-pimage_from_surface_pattern (cairo_surface_pattern_t *pattern,
- pixman_image_t **result)
-{
- pixman_image_t *simage;
- cairo_int_status_t status;
- acquire_source_cleanup_t *info = NULL;
-
- status = CAIRO_INT_STATUS_SUCCESS;
-
- /* First, get a pixman image that has the right bits */
- switch (pattern->surface->type)
- {
- case CAIRO_SURFACE_TYPE_PIXMAN:
- simage = ((cairo_pixman_surface_t *)pattern->surface)->pimage;
- break;
-
- case CAIRO_SURFACE_TYPE_IMAGE:
- simage = ((cairo_image_surface_t *)pattern->surface)->pixman_image;
- break;
-
- case CAIRO_SURFACE_TYPE_PDF:
- case CAIRO_SURFACE_TYPE_PS:
- case CAIRO_SURFACE_TYPE_XLIB:
- case CAIRO_SURFACE_TYPE_XCB:
- case CAIRO_SURFACE_TYPE_GLITZ:
- case CAIRO_SURFACE_TYPE_QUARTZ:
- case CAIRO_SURFACE_TYPE_WIN32:
- case CAIRO_SURFACE_TYPE_BEOS:
- case CAIRO_SURFACE_TYPE_DIRECTFB:
- case CAIRO_SURFACE_TYPE_SVG:
- case CAIRO_SURFACE_TYPE_OS2:
- case CAIRO_SURFACE_TYPE_WIN32_PRINTING:
- case CAIRO_SURFACE_TYPE_QUARTZ_IMAGE:
- case CAIRO_SURFACE_TYPE_SCRIPT:
- case CAIRO_SURFACE_TYPE_QT:
- case CAIRO_SURFACE_TYPE_RECORDING:
- case CAIRO_SURFACE_TYPE_VG:
- case CAIRO_SURFACE_TYPE_GL:
- case CAIRO_SURFACE_TYPE_DRM:
- case CAIRO_SURFACE_TYPE_TEE:
- case CAIRO_SURFACE_TYPE_XML:
- case CAIRO_SURFACE_TYPE_SKIA:
- case CAIRO_SURFACE_TYPE_SUBSURFACE:
- case CAIRO_SURFACE_TYPE_COGL:
- default:
- if (!(info = malloc (sizeof (acquire_source_cleanup_t))))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto out;
- }
-
- info->surface = pattern->surface;
- info->image = NULL;
- info->extra = NULL;
-
- status = _cairo_surface_acquire_source_image (
- pattern->surface, &info->image, &info->extra);
-
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto out;
-
- simage = info->image->pixman_image;
- break;
- }
-
- /* Then create a clone of that image */
- if (!(*result = pixman_image_create_bits (
- pixman_image_get_format (simage),
- pixman_image_get_width (simage),
- pixman_image_get_height (simage),
- pixman_image_get_data (simage),
- pixman_image_get_stride (simage))))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto out;
- }
-
- if (info)
- pixman_image_set_destroy_function (*result, clean_up_acquire, info);
-
- /* Then set the right properties on the clone */
- set_properties (*result, (cairo_pattern_t *)pattern, NULL);
-
-out:
- if (status != CAIRO_INT_STATUS_SUCCESS)
- clean_up_acquire (NULL, info);
-
- return status;
-}
-
static int
pimage_from_surface_pattern2 (command_buffer_t **buffer,
cairo_surface_pattern_t *pattern)
@@ -1080,66 +975,6 @@ pimage_from_surface_pattern2 (command_buffer_t **buffer,
#define PIXMAN_MAX_INT ((pixman_fixed_1 >> 1) - pixman_fixed_e) /* need to ensure deltas also fit */
-static cairo_int_status_t
-pimage_from_gradient_pattern (const cairo_gradient_pattern_t *pattern, pixman_image_t **image)
-{
- pixman_gradient_stop_t *pstops;
- cairo_circle_double_t extremes[2];
- pixman_point_fixed_t p1, p2;
- cairo_int_status_t status;
- cairo_matrix_t matrix;
- unsigned int i;
-
- if (!(pstops = malloc (pattern->n_stops * sizeof (pixman_gradient_stop_t))))
- return CAIRO_INT_STATUS_NO_MEMORY;
-
- for (i = 0; i < pattern->n_stops; i++)
- {
- pstops[i].x = _cairo_fixed_16_16_from_double (pattern->stops[i].offset);
- pstops[i].color.red = pattern->stops[i].color.red_short;
- pstops[i].color.green = pattern->stops[i].color.green_short;
- pstops[i].color.blue = pattern->stops[i].color.blue_short;
- pstops[i].color.alpha = pattern->stops[i].color.alpha_short;
- }
-
- _cairo_gradient_pattern_fit_to_range (pattern, PIXMAN_MAX_INT >> 1, &matrix, extremes);
-
- p1.x = _cairo_fixed_16_16_from_double (extremes[0].center.x);
- p1.y = _cairo_fixed_16_16_from_double (extremes[0].center.y);
- p2.x = _cairo_fixed_16_16_from_double (extremes[1].center.x);
- p2.y = _cairo_fixed_16_16_from_double (extremes[1].center.y);
-
- status = CAIRO_INT_STATUS_SUCCESS;
-
- if (pattern->base.type == CAIRO_PATTERN_TYPE_LINEAR)
- {
- if (!(*image = pixman_image_create_linear_gradient (
- &p1, &p2, pstops, pattern->n_stops)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- }
- }
- else /* CAIRO_PATTERN_TYPE_RADIAL */
- {
- pixman_fixed_t r1, r2;
-
- r1 = _cairo_fixed_16_16_from_double (extremes[0].radius);
- r2 = _cairo_fixed_16_16_from_double (extremes[1].radius);
-
- if (!(*image = pixman_image_create_radial_gradient (
- &p1, &p2, r1, r2, pstops, pattern->n_stops)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- }
- }
-
- set_properties (*image, (cairo_pattern_t *)pattern, &matrix);
-
- free (pstops);
-
- return status;
-}
-
static int
pimage_from_gradient_pattern2 (command_buffer_t **buffer,
const cairo_gradient_pattern_t *pattern)
@@ -1200,29 +1035,6 @@ pimage_from_gradient_pattern2 (command_buffer_t **buffer,
return command_buffer_new_image (buffer, image);
}
-static cairo_int_status_t
-pimage_from_mesh_pattern (cairo_pixman_surface_t *surface,
- const cairo_mesh_pattern_t *pattern,
- pixman_image_t **image)
-{
- int width, height;
-
- width = pixman_image_get_width (surface->pimage);
- height = pixman_image_get_height (surface->pimage);
-
- *image = pixman_image_create_bits (PIXMAN_a8r8g8b8, width, height, NULL, 0);
- if (unlikely (*image == NULL))
- return CAIRO_INT_STATUS_NO_MEMORY;
-
- _cairo_mesh_pattern_rasterize (pattern,
- pixman_image_get_data (*image),
- width, height,
- pixman_image_get_stride (*image),
- 0, 0);
-
- return CAIRO_INT_STATUS_SUCCESS;
-}
-
static int
pimage_from_mesh_pattern2 (command_buffer_t **buffer,
cairo_pixman_surface_t *surface,
@@ -1271,69 +1083,6 @@ raster_source_clean_up (pixman_image_t *pixman_image,
free (info);
}
-static cairo_int_status_t
-pimage_from_raster_source_pattern (cairo_pixman_surface_t *psurface,
- const cairo_raster_source_pattern_t *pattern,
- pixman_image_t **result)
-{
- int width, height;
- cairo_surface_t *surface;
- cairo_image_surface_t *image;
- raster_info_t *info;
- cairo_int_status_t status;
- void *extra;
-
- *result = NULL;
-
- width = pixman_image_get_width (psurface->pimage);
- height = pixman_image_get_height (psurface->pimage);
-
- surface = _cairo_raster_source_pattern_acquire (
- &pattern->base, &psurface->base, NULL);
-
- if (surface == NULL || surface->status)
- return CAIRO_INT_STATUS_NO_MEMORY;
-
- status = _cairo_surface_acquire_source_image (surface, &image, &extra);
- if (status != CAIRO_INT_STATUS_SUCCESS)
- {
- _cairo_raster_source_pattern_release (&pattern->base, surface);
-
- return status;
- }
-
- if (!(*result = pixman_image_create_bits (
- image->pixman_format, image->width, image->height,
- (uint32_t *) image->data, image->stride)))
- {
- _cairo_surface_release_source_image (surface, image, extra);
- _cairo_raster_source_pattern_release (&pattern->base, surface);
-
- return CAIRO_INT_STATUS_NO_MEMORY;
- }
-
- if (!(info = malloc (sizeof (*info))))
- {
- pixman_image_unref (*result);
- _cairo_surface_release_source_image (surface, image, extra);
- _cairo_raster_source_pattern_release (&pattern->base, surface);
-
- return CAIRO_INT_STATUS_NO_MEMORY;
- }
-
- info->pattern = &pattern->base;
- info->surface = surface;
- info->image = image;
- info->extra = extra;
-
- pixman_image_set_destroy_function (
- *result, raster_source_clean_up, info);
-
- set_properties (*result, (cairo_pattern_t *)pattern, NULL);
-
- return CAIRO_INT_STATUS_SUCCESS;
-}
-
static int
pimage_from_raster_source_pattern2 (command_buffer_t **buffer,
cairo_pixman_surface_t *psurface,
@@ -1396,45 +1145,6 @@ pimage_from_raster_source_pattern2 (command_buffer_t **buffer,
return command_buffer_new_image (buffer, result);
}
-static cairo_int_status_t
-pimage_from_pattern (cairo_pixman_surface_t *surface,
- const cairo_pattern_t *pattern, pixman_image_t **image)
-{
- switch (pattern->type)
- {
- case CAIRO_PATTERN_TYPE_SOLID:
- return pimage_from_solid_pattern (
- (cairo_solid_pattern_t *)pattern, image);
- break;
-
- case CAIRO_PATTERN_TYPE_SURFACE:
- return pimage_from_surface_pattern (
- (cairo_surface_pattern_t *)pattern, image);
- break;
-
- case CAIRO_PATTERN_TYPE_LINEAR:
- case CAIRO_PATTERN_TYPE_RADIAL:
- return pimage_from_gradient_pattern (
- (cairo_gradient_pattern_t *)pattern, image);
- break;
-
- case CAIRO_PATTERN_TYPE_MESH:
- return pimage_from_mesh_pattern (
- surface,
- (cairo_mesh_pattern_t *)pattern, image);
- break;
-
- case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
- return pimage_from_raster_source_pattern (
- surface,
- (cairo_raster_source_pattern_t *)pattern, image);
- break;
- }
-
- ASSERT_NOT_REACHED;
- return CAIRO_INT_STATUS_DEGENERATE;
-}
-
static int
pimage_from_pattern2 (command_buffer_t **buffer,
cairo_pixman_surface_t *surface,
@@ -1574,117 +1284,6 @@ traps_to_pixman_trapezoids (const cairo_traps_t *traps)
return ptraps;
}
-static cairo_int_status_t
-create_clip_image (const cairo_clip_t *clip, int width, int height,
- pixman_image_t **clip_image)
-{
- cairo_int_status_t status;
- pixman_trapezoid_t *ptraps = NULL;
- pixman_image_t *white_img = NULL;
- cairo_clip_path_t *clip_path;
- int i;
-
- status = CAIRO_INT_STATUS_SUCCESS;
-
- if (!clip)
- {
- *clip_image = NULL;
- goto out;
- }
- else if (!(*clip_image = pixman_image_create_bits (
- PIXMAN_a8, width, height, NULL, -1)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto out;
- }
-
- /* First add the boxes */
- if (!(ptraps = malloc (clip->num_boxes * sizeof (pixman_trapezoid_t))))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto out;
- }
-
- for (i = 0; i < clip->num_boxes; ++i)
- {
- cairo_box_t *box = &(clip->boxes[i]);
- pixman_trapezoid_t *trap = &(ptraps[i]);
-
- trap->top = _cairo_fixed_to_16_16 (box->p1.y);
- trap->bottom = _cairo_fixed_to_16_16 (box->p2.y);
-
- trap->left.p1.x = _cairo_fixed_to_16_16 (box->p1.x);
- trap->left.p1.y = _cairo_fixed_to_16_16 (box->p1.y);
- trap->left.p2.x = _cairo_fixed_to_16_16 (box->p1.x);
- trap->left.p2.y = _cairo_fixed_to_16_16 (box->p2.y);
-
- trap->right.p1.x = _cairo_fixed_to_16_16 (box->p2.x);
- trap->right.p1.y = _cairo_fixed_to_16_16 (box->p1.y);
- trap->right.p2.x = _cairo_fixed_to_16_16 (box->p2.x);
- trap->right.p2.y = _cairo_fixed_to_16_16 (box->p2.y);
- }
-
- pixman_add_trapezoids (*clip_image, 0, 0, clip->num_boxes, ptraps);
-
- /* Then intersect with all the paths */
- if (!(white_img = pixman_image_create_solid_fill (&white)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto out;
- }
-
- for (clip_path = clip->path; clip_path != NULL; clip_path = clip_path->prev)
- {
- cairo_polygon_t polygon;
- cairo_traps_t traps;
- pixman_trapezoid_t *ptraps = NULL;
-
- _cairo_polygon_init (&polygon, NULL, 0);
- _cairo_traps_init (&traps);
-
- status = _cairo_path_fixed_fill_to_polygon (
- &clip_path->path, clip_path->tolerance, &polygon);
-
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto exit_loop;
-
- status = _cairo_bentley_ottmann_tessellate_polygon (
- &traps, &polygon, clip_path->fill_rule);
-
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto exit_loop;
-
- if (!(ptraps = traps_to_pixman_trapezoids (&traps)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto exit_loop;
- }
-
- pixman_composite_trapezoids (
- PIXMAN_OP_IN, white_img, *clip_image, PIXMAN_a8, 0, 0, 0, 0,
- traps.num_traps, ptraps);
-
- exit_loop:
- free (ptraps);
- _cairo_polygon_fini (&polygon);
- _cairo_traps_fini (&traps);
-
- if (status != CAIRO_INT_STATUS_SUCCESS)
- break;
- }
-
-out:
- if (status != CAIRO_INT_STATUS_SUCCESS && *clip_image)
- pixman_image_unref (*clip_image);
-
- if (white_img)
- pixman_image_unref (white_img);
-
- free (ptraps);
-
- return status;
-}
-
static int
create_clip_image2 (command_buffer_t **buffer,
const cairo_clip_t *clip, int width, int height)
@@ -1854,45 +1453,6 @@ _pixman_operator (cairo_operator_t op)
}
}
-static cairo_int_status_t
-combine_mask_and_clip (pixman_image_t *mask_image, pixman_image_t *clip_image,
- pixman_image_t **combined)
-{
- if (mask_image && clip_image)
- {
- int width = pixman_image_get_width (clip_image);
- int height = pixman_image_get_height (clip_image);
-
- if (!(*combined = pixman_image_create_bits (
- PIXMAN_a8r8g8b8, width, height, NULL, -1)))
- {
- return CAIRO_INT_STATUS_NO_MEMORY;
- }
-
- pixman_image_composite32 (
- PIXMAN_OP_SRC,
- clip_image, mask_image, *combined,
- 0, 0, 0, 0, 0, 0, width, height);
-
- pixman_image_set_component_alpha (
- *combined, pixman_image_get_component_alpha (mask_image));
- }
- else if (mask_image)
- {
- *combined = pixman_image_ref (mask_image);
- }
- else if (clip_image)
- {
- *combined = pixman_image_ref (clip_image);
- }
- else
- {
- *combined = NULL;
- }
-
- return CAIRO_INT_STATUS_SUCCESS;
-}
-
static int
combine_mask_and_clip2 (command_buffer_t **buffer, int mask_id, int clip_id)
{
@@ -1906,145 +1466,6 @@ combine_mask_and_clip2 (command_buffer_t **buffer, int mask_id, int clip_id)
return combined_id;
}
-static cairo_int_status_t
-clip_and_composite (cairo_pixman_surface_t *psurface,
- cairo_operator_t operator,
- const cairo_pattern_t *source,
- pixman_image_t *mask_image,
- const cairo_clip_t *clip)
-{
- pixman_image_t *dest_image = psurface->pimage;
- int width = pixman_image_get_width (dest_image);
- int height = pixman_image_get_height (dest_image);
- pixman_image_t *src_image = NULL;
- pixman_image_t *clip_image = NULL;
- pixman_image_t *combined = NULL;
- cairo_int_status_t status;
- pixman_op_t pop;
-
- status = CAIRO_INT_STATUS_SUCCESS;
-
- if (clip && _cairo_clip_is_all_clipped (clip))
- goto out;
-
- status = create_clip_image (clip, width, height, &clip_image);
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto out;
-
- status = pimage_from_pattern (psurface, source, &src_image);
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto out;
-
- pop = _pixman_operator (operator);
-
- if (pop == PIXMAN_OP_CLEAR)
- {
- if (clip_image)
- {
- pixman_image_composite32 (
- PIXMAN_OP_OUT_REVERSE,
- clip_image, mask_image, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
- }
- else if (mask_image)
- {
- pixman_image_composite32 (
- PIXMAN_OP_OUT_REVERSE,
- mask_image, NULL, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
- }
- else
- {
- if (!(combined = pixman_image_create_solid_fill (&white)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
-
- goto out;
- }
-
- pixman_image_composite32 (
- PIXMAN_OP_OUT_REVERSE,
- combined, NULL, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
- }
- }
- else if (clip_image &&
- (pop == PIXMAN_OP_IN ||
- pop == PIXMAN_OP_OUT ||
- pop == PIXMAN_OP_IN_REVERSE ||
- pop == PIXMAN_OP_ATOP_REVERSE))
- {
- /* First composite to a temporary surface */
- if (!(combined = pixman_image_create_bits (
- pixman_image_get_format (psurface->pimage),
- width, height, NULL, -1)))
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
-
- goto out;
- }
-
- pixman_image_composite32 (
- PIXMAN_OP_SRC,
- dest_image, NULL, combined,
- 0, 0, 0, 0, 0, 0, width, height);
-
- pixman_image_composite32 (
- pop,
- src_image, mask_image, combined,
- 0, 0, 0, 0, 0, 0, width, height);
-
- /* Then punch out the clip from the destination */
- pixman_image_composite32 (
- PIXMAN_OP_OUT_REVERSE,
- clip_image, NULL, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
-
- /* And add the pieces together */
- pixman_image_composite32 (
- PIXMAN_OP_ADD,
- combined, clip_image, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
- }
- else if (pop == PIXMAN_OP_SRC)
- {
- status = combine_mask_and_clip (mask_image, clip_image, &combined);
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto out;
-
- pixman_image_composite32 (
- PIXMAN_OP_OUT_REVERSE,
- combined, NULL, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
-
- pixman_image_composite32 (
- PIXMAN_OP_ADD,
- src_image, combined, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
- }
- else
- {
- status = combine_mask_and_clip (mask_image, clip_image, &combined);
- if (status != CAIRO_INT_STATUS_SUCCESS)
- goto out;
-
- pixman_image_composite32 (
- pop,
- src_image, combined, dest_image,
- 0, 0, 0, 0, 0, 0, width, height);
- }
-
-out:
- if (combined)
- pixman_image_unref (combined);
- if (clip_image)
- pixman_image_unref (clip_image);
- if (src_image)
- pixman_image_unref (src_image);
-
- return status;
-}
-
static void
clip_and_composite2 (command_buffer_t **buffer,
cairo_pixman_surface_t *psurface,
@@ -2132,8 +1553,6 @@ cairo_pixman_surface_paint (void *abstract_surface,
clip_and_composite2 (&buffer, psurface, op, source, mask_id, clip);
return command_buffer_process (buffer, width, height);
-
- return clip_and_composite (psurface, op, source, NULL, clip);
}
static cairo_int_status_t
@@ -2157,66 +1576,6 @@ cairo_pixman_surface_mask (void *abstract_surface,
}
static cairo_int_status_t
-clip_and_composite_traps (cairo_pixman_surface_t *psurface,
- cairo_operator_t operator,
- const cairo_pattern_t *source,
- const cairo_traps_t *traps,
- cairo_antialias_t antialias,
- const cairo_clip_t *clip)
-{
- cairo_int_status_t status;
- pixman_trapezoid_t *ptraps = NULL;
- pixman_image_t *mask_image = NULL;
- pixman_format_code_t format;
- int w, h;
-
- w = pixman_image_get_width (psurface->pimage);
- h = pixman_image_get_height (psurface->pimage);
-
- switch (antialias)
- {
- case CAIRO_ANTIALIAS_NONE:
- format = PIXMAN_a1;
- break;
-
- case CAIRO_ANTIALIAS_FAST:
- format = PIXMAN_a4;
- break;
-
- default:
- case CAIRO_ANTIALIAS_GRAY:
- case CAIRO_ANTIALIAS_DEFAULT:
- case CAIRO_ANTIALIAS_SUBPIXEL:
- case CAIRO_ANTIALIAS_GOOD:
- case CAIRO_ANTIALIAS_BEST:
- format = PIXMAN_a8;
- break;
- }
-
- status = CAIRO_INT_STATUS_NO_MEMORY;
-
- if (!(mask_image = pixman_image_create_bits (format, w, h, NULL, -1)))
- goto out;
-
- if (!(ptraps = traps_to_pixman_trapezoids (traps)))
- goto out;
-
- status = CAIRO_INT_STATUS_SUCCESS;
-
- pixman_add_trapezoids (mask_image, 0, 0, traps->num_traps, ptraps);
-
- status = clip_and_composite (psurface, operator, source, mask_image, clip);
-
-out:
- free (ptraps);
-
- if (mask_image)
- pixman_image_unref (mask_image);
-
- return status;
-}
-
-static cairo_int_status_t
cairo_pixman_surface_stroke (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
@@ -2341,19 +1700,17 @@ cairo_pixman_surface_glyphs (void *abstract_surface,
pixman_glyph_cache_t *glyph_cache;
pixman_glyph_t pglyphs_stack[CAIRO_STACK_ARRAY_LENGTH (pixman_glyph_t)];
pixman_glyph_t *pglyphs = pglyphs_stack;
- pixman_format_code_t mask_format;
- pixman_image_t *white_image = NULL;
- pixman_image_t *mask_image = NULL;
int width, height;
pixman_glyph_t *pg;
+ command_buffer_t *buffer;
+ int glyph_id;
int i;
width = pixman_image_get_width (psurface->pimage);
height = pixman_image_get_height (psurface->pimage);
- if (!(white_image = pixman_image_create_solid_fill (&white)))
- return CAIRO_INT_STATUS_NO_MEMORY;
-
+ buffer = command_buffer_new ();
+
CAIRO_MUTEX_LOCK (_cairo_glyph_cache_mutex);
glyph_cache = get_glyph_cache();
@@ -2413,29 +1770,13 @@ cairo_pixman_surface_glyphs (void *abstract_surface,
pg++;
}
- mask_format = pixman_glyph_get_mask_format (glyph_cache, pg - pglyphs, pglyphs);
-
- mask_image = pixman_image_create_bits (mask_format, width, height, NULL, -1);
- if (!mask_image)
- {
- status = CAIRO_INT_STATUS_NO_MEMORY;
- goto out_thaw;
- }
+ glyph_id = command_buffer_new_glyphs (&buffer, glyph_cache, pg - pglyphs, pglyphs);
+ clip_and_composite2 (
+ &buffer, psurface, operator, source, glyph_id, clip);
- pixman_composite_glyphs (PIXMAN_OP_ADD,
- white_image, mask_image,
- mask_format,
- 0, 0, 0, 0, 0, 0, width, height,
- glyph_cache, pg - pglyphs, pglyphs);
-
- status = clip_and_composite (psurface, operator, source, mask_image, clip);
+ status = command_buffer_process (buffer, width, height);
out_thaw:
- if (mask_image)
- pixman_image_unref (mask_image);
-
- pixman_image_unref (white_image);
-
pixman_glyph_cache_thaw (glyph_cache);
if (pglyphs != pglyphs_stack)