mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 11:28:02 +02:00
Propagate errors up through pixman_composite_trapezoids()
Change the return type to indicate errors detected during pixman_composite_trapezoids() and add checking for failures during region ops.
This commit is contained in:
parent
bec097b5e2
commit
efee208738
2 changed files with 22 additions and 17 deletions
|
|
@ -102,10 +102,7 @@ pixman_trapezoid_bounds (int ntrap, const pixman_trapezoid_t *traps, pixman_box1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: There are failure cases in this function. Don't we need to
|
int
|
||||||
* propagate the errors out?
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pixman_composite_trapezoids (pixman_operator_t op,
|
pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
pixman_image_t *src,
|
pixman_image_t *src,
|
||||||
pixman_image_t *dst,
|
pixman_image_t *dst,
|
||||||
|
|
@ -114,15 +111,16 @@ pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
const pixman_trapezoid_t *traps,
|
const pixman_trapezoid_t *traps,
|
||||||
int ntraps)
|
int ntraps)
|
||||||
{
|
{
|
||||||
pixman_image_t *image = NULL;
|
pixman_image_t *image = NULL;
|
||||||
pixman_box16_t traps_bounds, dst_bounds, bounds;
|
pixman_box16_t traps_bounds, dst_bounds, bounds;
|
||||||
pixman_region16_t traps_region, dst_region;
|
pixman_region16_t traps_region, dst_region;
|
||||||
int16_t xDst, yDst;
|
int16_t xDst, yDst;
|
||||||
int16_t xRel, yRel;
|
int16_t xRel, yRel;
|
||||||
pixman_format_t *format;
|
pixman_format_t *format;
|
||||||
|
pixman_region_status_t status;
|
||||||
|
|
||||||
if (ntraps == 0)
|
if (ntraps == 0)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for solid alpha add
|
* Check for solid alpha add
|
||||||
|
|
@ -131,7 +129,7 @@ pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
{
|
{
|
||||||
for (; ntraps; ntraps--, traps++)
|
for (; ntraps; ntraps--, traps++)
|
||||||
fbRasterizeTrapezoid (dst, traps, 0, 0);
|
fbRasterizeTrapezoid (dst, traps, 0, 0);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xDst = traps[0].left.p1.x >> 16;
|
xDst = traps[0].left.p1.x >> 16;
|
||||||
|
|
@ -149,7 +147,12 @@ pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
dst_bounds.y2 = pixman_image_get_height (dst);
|
dst_bounds.y2 = pixman_image_get_height (dst);
|
||||||
|
|
||||||
pixman_region_init_with_extents (&dst_region, &dst_bounds);
|
pixman_region_init_with_extents (&dst_region, &dst_bounds);
|
||||||
pixman_region_intersect (&traps_region, &traps_region, &dst_region);
|
status = pixman_region_intersect (&traps_region, &traps_region, &dst_region);
|
||||||
|
if (status != PIXMAN_REGION_STATUS_SUCCESS) {
|
||||||
|
pixman_region_fini (&traps_region);
|
||||||
|
pixman_region_fini (&dst_region);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
bounds = *(pixman_region_extents (&traps_region));
|
bounds = *(pixman_region_extents (&traps_region));
|
||||||
|
|
||||||
|
|
@ -157,11 +160,11 @@ pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
pixman_region_fini (&dst_region);
|
pixman_region_fini (&dst_region);
|
||||||
|
|
||||||
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
|
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
|
format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
|
||||||
if (!format)
|
if (!format)
|
||||||
return;
|
return 1;
|
||||||
|
|
||||||
image = FbCreateAlphaPicture (dst, format,
|
image = FbCreateAlphaPicture (dst, format,
|
||||||
bounds.x2 - bounds.x1,
|
bounds.x2 - bounds.x1,
|
||||||
|
|
@ -169,7 +172,7 @@ pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
if (!image)
|
if (!image)
|
||||||
{
|
{
|
||||||
pixman_format_destroy (format);
|
pixman_format_destroy (format);
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; ntraps; ntraps--, traps++)
|
for (; ntraps; ntraps--, traps++)
|
||||||
|
|
@ -189,6 +192,8 @@ pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
pixman_image_destroy (image);
|
pixman_image_destroy (image);
|
||||||
|
|
||||||
pixman_format_destroy (format);
|
pixman_format_destroy (format);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@ pixman_fill_rectangles (pixman_operator_t op,
|
||||||
|
|
||||||
/* ictrap.c */
|
/* ictrap.c */
|
||||||
|
|
||||||
pixman_private void
|
pixman_private int
|
||||||
pixman_composite_trapezoids (pixman_operator_t op,
|
pixman_composite_trapezoids (pixman_operator_t op,
|
||||||
pixman_image_t *src,
|
pixman_image_t *src,
|
||||||
pixman_image_t *dst,
|
pixman_image_t *dst,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue