mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-30 16:40:15 +01:00
Make meta-surface store and replay extents of each operation
To be able to provide the extents of each operation to the backend during the render phase the meta-surface needs to store the extents computed by the analysis surface during the analysis phase. The extents argument is either a pointer to the extents of the operation stored in the meta-surface or NULL. During analysis the analysis surface writes the extents to the meta-surface. During the render phase the extents is made available to paginated surface backends.
This commit is contained in:
parent
d682d275b9
commit
fb7cfdd94d
3 changed files with 40 additions and 6 deletions
|
|
@ -354,6 +354,8 @@ _cairo_analysis_surface_paint (void *abstract_surface,
|
|||
}
|
||||
|
||||
is_empty = _cairo_rectangle_intersect (&extents, &surface->current_clip);
|
||||
if (paint_extents)
|
||||
*paint_extents = extents;
|
||||
|
||||
status = _add_operation (surface, &extents, backend_status);
|
||||
|
||||
|
|
@ -432,6 +434,8 @@ _cairo_analysis_surface_mask (void *abstract_surface,
|
|||
}
|
||||
|
||||
is_empty = _cairo_rectangle_intersect (&extents, &surface->current_clip);
|
||||
if (mask_extents)
|
||||
*mask_extents = extents;
|
||||
|
||||
status = _add_operation (surface, &extents, backend_status);
|
||||
|
||||
|
|
@ -505,6 +509,8 @@ _cairo_analysis_surface_stroke (void *abstract_surface,
|
|||
|
||||
_cairo_box_round_to_rectangle (&box, &extents);
|
||||
}
|
||||
if (stroke_extents)
|
||||
*stroke_extents = extents;
|
||||
|
||||
status = _add_operation (surface, &extents, backend_status);
|
||||
|
||||
|
|
@ -574,6 +580,8 @@ _cairo_analysis_surface_fill (void *abstract_surface,
|
|||
|
||||
_cairo_box_round_to_rectangle (&box, &extents);
|
||||
}
|
||||
if (fill_extents)
|
||||
*fill_extents = extents;
|
||||
|
||||
status = _add_operation (surface, &extents, backend_status);
|
||||
|
||||
|
|
@ -642,6 +650,8 @@ _cairo_analysis_surface_show_glyphs (void *abstract_surface,
|
|||
|
||||
is_empty = _cairo_rectangle_intersect (&extents, &glyph_extents);
|
||||
}
|
||||
if (show_glyphs_extents)
|
||||
*show_glyphs_extents = extents;
|
||||
|
||||
status = _add_operation (surface, &extents, backend_status);
|
||||
|
||||
|
|
@ -726,6 +736,8 @@ _cairo_analysis_surface_show_text_glyphs (void *abstract_surface,
|
|||
|
||||
is_empty = _cairo_rectangle_intersect (&extents, &glyph_extents);
|
||||
}
|
||||
if (show_text_glyphs_extents)
|
||||
*show_text_glyphs_extents = extents;
|
||||
|
||||
status = _add_operation (surface, &extents, backend_status);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ typedef enum {
|
|||
typedef struct _cairo_command_header {
|
||||
cairo_command_type_t type;
|
||||
cairo_meta_region_type_t region;
|
||||
cairo_rectangle_int_t extents;
|
||||
} cairo_command_header_t;
|
||||
|
||||
typedef struct _cairo_command_paint {
|
||||
|
|
|
|||
|
|
@ -232,6 +232,10 @@ _cairo_meta_surface_paint (void *abstract_surface,
|
|||
|
||||
command->header.type = CAIRO_COMMAND_PAINT;
|
||||
command->header.region = CAIRO_META_REGION_ALL;
|
||||
command->header.extents.x = 0;
|
||||
command->header.extents.y = 0;
|
||||
command->header.extents.width = meta->width_pixels;
|
||||
command->header.extents.height = meta->height_pixels;
|
||||
command->op = op;
|
||||
|
||||
status = _cairo_pattern_init_snapshot (&command->source.base, source);
|
||||
|
|
@ -274,6 +278,10 @@ _cairo_meta_surface_mask (void *abstract_surface,
|
|||
|
||||
command->header.type = CAIRO_COMMAND_MASK;
|
||||
command->header.region = CAIRO_META_REGION_ALL;
|
||||
command->header.extents.x = 0;
|
||||
command->header.extents.y = 0;
|
||||
command->header.extents.width = meta->width_pixels;
|
||||
command->header.extents.height = meta->height_pixels;
|
||||
command->op = op;
|
||||
|
||||
status = _cairo_pattern_init_snapshot (&command->source.base, source);
|
||||
|
|
@ -321,6 +329,10 @@ _cairo_meta_surface_stroke (void *abstract_surface,
|
|||
|
||||
command->header.type = CAIRO_COMMAND_STROKE;
|
||||
command->header.region = CAIRO_META_REGION_ALL;
|
||||
command->header.extents.x = 0;
|
||||
command->header.extents.y = 0;
|
||||
command->header.extents.width = meta->width_pixels;
|
||||
command->header.extents.height = meta->height_pixels;
|
||||
command->op = op;
|
||||
|
||||
status = _cairo_pattern_init_snapshot (&command->source.base, source);
|
||||
|
|
@ -377,6 +389,10 @@ _cairo_meta_surface_fill (void *abstract_surface,
|
|||
|
||||
command->header.type = CAIRO_COMMAND_FILL;
|
||||
command->header.region = CAIRO_META_REGION_ALL;
|
||||
command->header.extents.x = 0;
|
||||
command->header.extents.y = 0;
|
||||
command->header.extents.width = meta->width_pixels;
|
||||
command->header.extents.height = meta->height_pixels;
|
||||
command->op = op;
|
||||
|
||||
status = _cairo_pattern_init_snapshot (&command->source.base, source);
|
||||
|
|
@ -436,6 +452,10 @@ _cairo_meta_surface_show_text_glyphs (void *abstract_surface,
|
|||
|
||||
command->header.type = CAIRO_COMMAND_SHOW_TEXT_GLYPHS;
|
||||
command->header.region = CAIRO_META_REGION_ALL;
|
||||
command->header.extents.x = 0;
|
||||
command->header.extents.y = 0;
|
||||
command->header.extents.width = meta->width_pixels;
|
||||
command->header.extents.height = meta->height_pixels;
|
||||
command->op = op;
|
||||
|
||||
status = _cairo_pattern_init_snapshot (&command->source.base, source);
|
||||
|
|
@ -811,13 +831,13 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
|
|||
case CAIRO_COMMAND_PAINT:
|
||||
status = _cairo_surface_paint (target,
|
||||
command->paint.op,
|
||||
&command->paint.source.base, NULL);
|
||||
&command->paint.source.base, &command->header.extents);
|
||||
break;
|
||||
case CAIRO_COMMAND_MASK:
|
||||
status = _cairo_surface_mask (target,
|
||||
command->mask.op,
|
||||
&command->mask.source.base,
|
||||
&command->mask.mask.base, NULL);
|
||||
&command->mask.mask.base, &command->header.extents);
|
||||
break;
|
||||
case CAIRO_COMMAND_STROKE:
|
||||
{
|
||||
|
|
@ -839,7 +859,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
|
|||
&dev_ctm,
|
||||
&dev_ctm_inverse,
|
||||
command->stroke.tolerance,
|
||||
command->stroke.antialias, NULL);
|
||||
command->stroke.antialias, &command->header.extents);
|
||||
break;
|
||||
}
|
||||
case CAIRO_COMMAND_FILL:
|
||||
|
|
@ -886,7 +906,8 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
|
|||
&dev_ctm,
|
||||
&dev_ctm_inverse,
|
||||
stroke_command->stroke.tolerance,
|
||||
stroke_command->stroke.antialias, NULL);
|
||||
stroke_command->stroke.antialias,
|
||||
&stroke_command->header.extents);
|
||||
i++;
|
||||
} else
|
||||
status = _cairo_surface_fill (target,
|
||||
|
|
@ -895,7 +916,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
|
|||
dev_path,
|
||||
command->fill.fill_rule,
|
||||
command->fill.tolerance,
|
||||
command->fill.antialias, NULL);
|
||||
command->fill.antialias, &command->header.extents);
|
||||
break;
|
||||
}
|
||||
case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
|
||||
|
|
@ -932,7 +953,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
|
|||
dev_glyphs, num_glyphs,
|
||||
command->show_text_glyphs.clusters, command->show_text_glyphs.num_clusters,
|
||||
command->show_text_glyphs.cluster_flags,
|
||||
command->show_text_glyphs.scaled_font, NULL);
|
||||
command->show_text_glyphs.scaled_font, &command->header.extents);
|
||||
|
||||
free (dev_glyphs);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue