mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-04 22:20:28 +01:00
[pixman] Propagate allocation failure.
pixman_op() failed to propagate the failure from pixman_region_appendNonO() and the generic op.
This commit is contained in:
parent
9e99f0611c
commit
bcfc5f0bdb
1 changed files with 17 additions and 7 deletions
|
|
@ -553,7 +553,7 @@ pixman_region_appendNonO (
|
|||
{ \
|
||||
int newRects; \
|
||||
if ((newRects = rEnd - r)) { \
|
||||
RECTALLOC(newReg, newRects); \
|
||||
RECTALLOC_BAIL(newReg, newRects, bail); \
|
||||
memmove((char *)PIXREGION_TOP(newReg),(char *)r, \
|
||||
newRects * sizeof(pixman_box16_t)); \
|
||||
newReg->data->numRects += newRects; \
|
||||
|
|
@ -733,7 +733,8 @@ pixman_op(
|
|||
bot = MIN(r1->y2, r2y1);
|
||||
if (top != bot) {
|
||||
curBand = newReg->data->numRects;
|
||||
pixman_region_appendNonO(newReg, r1, r1BandEnd, top, bot);
|
||||
if (!pixman_region_appendNonO(newReg, r1, r1BandEnd, top, bot))
|
||||
goto bail;
|
||||
Coalesce(newReg, prevBand, curBand);
|
||||
}
|
||||
}
|
||||
|
|
@ -744,7 +745,8 @@ pixman_op(
|
|||
bot = MIN(r2->y2, r1y1);
|
||||
if (top != bot) {
|
||||
curBand = newReg->data->numRects;
|
||||
pixman_region_appendNonO(newReg, r2, r2BandEnd, top, bot);
|
||||
if (!pixman_region_appendNonO(newReg, r2, r2BandEnd, top, bot))
|
||||
goto bail;
|
||||
Coalesce(newReg, prevBand, curBand);
|
||||
}
|
||||
}
|
||||
|
|
@ -760,8 +762,9 @@ pixman_op(
|
|||
ybot = MIN(r1->y2, r2->y2);
|
||||
if (ybot > ytop) {
|
||||
curBand = newReg->data->numRects;
|
||||
(* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
|
||||
pOverlap);
|
||||
if (!(* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
|
||||
pOverlap))
|
||||
goto bail;
|
||||
Coalesce(newReg, prevBand, curBand);
|
||||
}
|
||||
|
||||
|
|
@ -786,7 +789,8 @@ pixman_op(
|
|||
/* Do first nonOverlap1Func call, which may be able to coalesce */
|
||||
FindBand(r1, r1BandEnd, r1End, r1y1);
|
||||
curBand = newReg->data->numRects;
|
||||
pixman_region_appendNonO(newReg, r1, r1BandEnd, MAX(r1y1, ybot), r1->y2);
|
||||
if (!pixman_region_appendNonO(newReg, r1, r1BandEnd, MAX(r1y1, ybot), r1->y2))
|
||||
goto bail;
|
||||
Coalesce(newReg, prevBand, curBand);
|
||||
/* Just append the rest of the boxes */
|
||||
AppendRegions(newReg, r1BandEnd, r1End);
|
||||
|
|
@ -795,7 +799,8 @@ pixman_op(
|
|||
/* Do first nonOverlap2Func call, which may be able to coalesce */
|
||||
FindBand(r2, r2BandEnd, r2End, r2y1);
|
||||
curBand = newReg->data->numRects;
|
||||
pixman_region_appendNonO(newReg, r2, r2BandEnd, MAX(r2y1, ybot), r2->y2);
|
||||
if (!pixman_region_appendNonO(newReg, r2, r2BandEnd, MAX(r2y1, ybot), r2->y2))
|
||||
goto bail;
|
||||
Coalesce(newReg, prevBand, curBand);
|
||||
/* Append rest of boxes */
|
||||
AppendRegions(newReg, r2BandEnd, r2End);
|
||||
|
|
@ -821,6 +826,11 @@ pixman_op(
|
|||
}
|
||||
|
||||
return PIXMAN_REGION_STATUS_SUCCESS;
|
||||
|
||||
bail:
|
||||
if (oldData)
|
||||
free(oldData);
|
||||
return PIXMAN_REGION_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/*-
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue