mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 06:48:01 +02:00
fill: Fix unantialiased rectilinear-fill-to-boxes
We were calling the antialias close function from the unantialiased paths - a function that operates on a completely different structure to the one passed in. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
719bef0c90
commit
538fa0d6fb
5 changed files with 44 additions and 16 deletions
|
|
@ -142,7 +142,7 @@ _cairo_clip_intersect_rectilinear_path (cairo_clip_t *clip,
|
|||
fill_rule,
|
||||
antialias,
|
||||
&boxes);
|
||||
if (likely (status == CAIRO_STATUS_SUCCESS))
|
||||
if (likely (status == CAIRO_STATUS_SUCCESS && boxes.num_boxes))
|
||||
clip = _cairo_clip_intersect_boxes (clip, &boxes);
|
||||
else
|
||||
clip = _cairo_clip_set_all_clipped (clip);
|
||||
|
|
@ -297,7 +297,9 @@ _cairo_clip_intersect_boxes (cairo_clip_t *clip,
|
|||
boxes = &clip_boxes;
|
||||
}
|
||||
|
||||
if (boxes->num_boxes == 1) {
|
||||
if (boxes->num_boxes == 0) {
|
||||
return _cairo_clip_set_all_clipped (clip);
|
||||
} else if (boxes->num_boxes == 1) {
|
||||
clip->boxes = &clip->embedded_box;
|
||||
clip->boxes[0] = boxes->chunks.base[0];
|
||||
clip->num_boxes = 1;
|
||||
|
|
|
|||
|
|
@ -1079,7 +1079,7 @@ _cairo_image_bounded_spans (void *abstract_renderer,
|
|||
pixman_image_compositor_blt (r->compositor,
|
||||
spans[0].x, y,
|
||||
spans[1].x - spans[0].x, height,
|
||||
r->opacity * spans[0].coverage);
|
||||
r->opacity * spans[0].coverage);
|
||||
}
|
||||
spans++;
|
||||
} while (--num_spans > 1);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ typedef struct cairo_filler {
|
|||
cairo_point_t last_move_to;
|
||||
} cairo_filler_t;
|
||||
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_filler_line_to (void *closure,
|
||||
const cairo_point_t *point)
|
||||
|
|
@ -184,16 +183,23 @@ _cairo_filler_ra_line_to (void *closure,
|
|||
return status;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_filler_ra_close (void *closure)
|
||||
{
|
||||
cairo_filler_ra_t *filler = closure;
|
||||
return _cairo_filler_ra_line_to (closure, &filler->last_move_to);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_filler_ra_move_to (void *closure,
|
||||
const cairo_point_t *point)
|
||||
{
|
||||
cairo_filler_t *filler = closure;
|
||||
cairo_filler_ra_t *filler = closure;
|
||||
cairo_status_t status;
|
||||
cairo_point_t p;
|
||||
|
||||
/* close current subpath */
|
||||
status = _cairo_filler_close (closure);
|
||||
status = _cairo_filler_ra_close (closure);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
|
||||
|
|
@ -228,13 +234,13 @@ _cairo_path_fixed_fill_rectilinear_to_polygon (const cairo_path_fixed_t *path,
|
|||
status = _cairo_path_fixed_interpret_flat (path,
|
||||
_cairo_filler_ra_move_to,
|
||||
_cairo_filler_ra_line_to,
|
||||
_cairo_filler_close,
|
||||
_cairo_filler_ra_close,
|
||||
&filler,
|
||||
0.);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
|
||||
return _cairo_filler_close (&filler);
|
||||
return _cairo_filler_ra_close (&filler);
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
|
|
|
|||
|
|
@ -327,8 +327,10 @@ out:
|
|||
return surface;
|
||||
|
||||
error:
|
||||
cairo_surface_destroy (surface);
|
||||
surface = _cairo_surface_create_in_error (status);
|
||||
if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) {
|
||||
cairo_surface_destroy (surface);
|
||||
surface = _cairo_surface_create_in_error (status);
|
||||
}
|
||||
compositor->release (surface);
|
||||
return surface;
|
||||
}
|
||||
|
|
@ -355,6 +357,9 @@ clip_and_composite_with_mask (const cairo_traps_compositor_t *compositor,
|
|||
if (unlikely (mask->status))
|
||||
return mask->status;
|
||||
|
||||
if (mask->is_clear)
|
||||
goto skip;
|
||||
|
||||
if (src != NULL || dst->content != CAIRO_CONTENT_ALPHA) {
|
||||
compositor->composite (dst, op, src, mask,
|
||||
extents->bounded.x + src_x,
|
||||
|
|
@ -369,8 +374,9 @@ clip_and_composite_with_mask (const cairo_traps_compositor_t *compositor,
|
|||
extents->bounded.x, extents->bounded.y,
|
||||
extents->bounded.width, extents->bounded.height);
|
||||
}
|
||||
cairo_surface_destroy (mask);
|
||||
|
||||
skip:
|
||||
cairo_surface_destroy (mask);
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -468,6 +474,9 @@ clip_and_composite_source (const cairo_traps_compositor_t *compositor,
|
|||
if (unlikely (mask->status))
|
||||
return mask->status;
|
||||
|
||||
if (mask->is_clear)
|
||||
goto skip;
|
||||
|
||||
if (dst->is_clear) {
|
||||
compositor->composite (dst, CAIRO_OPERATOR_SOURCE, src, mask,
|
||||
extents->bounded.x + src_x, extents->bounded.y + src_y,
|
||||
|
|
@ -482,6 +491,7 @@ clip_and_composite_source (const cairo_traps_compositor_t *compositor,
|
|||
extents->bounded.width, extents->bounded.height);
|
||||
}
|
||||
|
||||
skip:
|
||||
cairo_surface_destroy (mask);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -20,12 +20,22 @@ main (int argc, char **argv)
|
|||
.surface_create = _surface_create
|
||||
};
|
||||
cairo_script_interpreter_t *csi;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
csi = cairo_script_interpreter_create ();
|
||||
cairo_script_interpreter_install_hooks (csi, &hooks);
|
||||
for (i = 1; i < argc; i++)
|
||||
for (i = 1; i < argc; i++) {
|
||||
int status, line;
|
||||
|
||||
csi = cairo_script_interpreter_create ();
|
||||
cairo_script_interpreter_install_hooks (csi, &hooks);
|
||||
cairo_script_interpreter_run (csi, argv[i]);
|
||||
return cairo_script_interpreter_destroy (csi);
|
||||
line = cairo_script_interpreter_get_line_number (csi);
|
||||
status = cairo_script_interpreter_destroy (csi);
|
||||
if (status) {
|
||||
fprintf (stderr, "Error during replay of '%s', line %d: %d\n",
|
||||
argv[i], line, status);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue