diff options
author | Mathias Hasselmann <mathias.hasselmann@gmx.de> | 2007-03-14 01:24:11 +0100 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2007-04-08 21:34:10 -0400 |
commit | 65f269f3a4148a6cf3b2158ea893bb8452c3ad5e (patch) | |
tree | b1959cd29c77145ad860d8b8ae30fc1f9dad53c1 /pixman | |
parent | 82cc451148eec1703d001f2b814d5b3712d31727 (diff) |
Avoid pixman_region_create in pixman_composite{,General}
Diffstat (limited to 'pixman')
-rw-r--r-- | pixman/src/fbcompose.c | 32 | ||||
-rw-r--r-- | pixman/src/fbpict.c | 32 | ||||
-rw-r--r-- | pixman/src/icimage.c | 68 |
3 files changed, 48 insertions, 84 deletions
diff --git a/pixman/src/fbcompose.c b/pixman/src/fbcompose.c index 3acf32b6..1bd7ab97 100644 --- a/pixman/src/fbcompose.c +++ b/pixman/src/fbcompose.c @@ -4198,7 +4198,7 @@ pixman_compositeGeneral (pixman_operator_t op, CARD16 width, CARD16 height) { - pixman_region16_t *region; + pixman_region16_t region; int n; BoxPtr pbox; Bool srcRepeat = FALSE; @@ -4219,22 +4219,12 @@ pixman_compositeGeneral (pixman_operator_t op, if (op == PIXMAN_OPERATOR_OVER && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format_code) && !pSrc->alphaMap) op = PIXMAN_OPERATOR_SRC; - region = pixman_region_create(); - pixman_region_union_rect (region, region, xDst, yDst, width, height); - - if (!FbComputeCompositeRegion (region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; + pixman_region_init (®ion, NULL); + pixman_region_union_rect (®ion, ®ion, xDst, yDst, width, height); + + if (!FbComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height)) + goto CLEANUP_REGION; compose_data.op = op; compose_data.src = pSrc; @@ -4243,8 +4233,8 @@ pixman_compositeGeneral (pixman_operator_t op, if (width > SCANLINE_BUFFER_LENGTH) scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - n = pixman_region_num_rects (region); - pbox = pixman_region_rects (region); + n = pixman_region_num_rects (®ion); + pbox = pixman_region_rects (®ion); while (n--) { h = pbox->y2 - pbox->y1; @@ -4298,10 +4288,12 @@ pixman_compositeGeneral (pixman_operator_t op, } pbox++; } - pixman_region_destroy (region); if (scanline_buffer != _scanline_buffer) free(scanline_buffer); + +CLEANUP_REGION: + pixman_region_uninit (®ion); } #endif diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c index 5afcd052..3fd4aa95 100644 --- a/pixman/src/fbpict.c +++ b/pixman/src/fbpict.c @@ -1390,7 +1390,7 @@ pixman_composite (pixman_operator_t op, int width, int height) { - pixman_region16_t *region; + pixman_region16_t region; int n; pixman_box16_t *pbox; CompositeFunc func = NULL; @@ -1933,25 +1933,15 @@ pixman_composite (pixman_operator_t op, if (maskTransform) maskRepeat = 0; - region = pixman_region_create(); - pixman_region_union_rect (region, region, xDst, yDst, width, height); - - if (!FbComputeCompositeRegion (region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; + pixman_region_init (®ion, NULL); + pixman_region_union_rect (®ion, ®ion, xDst, yDst, width, height); + + if (!FbComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height)) + goto CLEANUP_REGION; - n = pixman_region_num_rects (region); - pbox = pixman_region_rects (region); + n = pixman_region_num_rects (®ion); + pbox = pixman_region_rects (®ion); while (n--) { h = pbox->y2 - pbox->y1; @@ -2007,7 +1997,9 @@ pixman_composite (pixman_operator_t op, } pbox++; } - pixman_region_destroy (region); + +CLEANUP_REGION: + pixman_region_uninit (®ion); } /* The CPU detection code needs to be in a file not compiled with diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c index 1cacf664..9de0a4cf 100644 --- a/pixman/src/icimage.c +++ b/pixman/src/icimage.c @@ -858,67 +858,47 @@ FbComputeCompositeRegion (pixman_region16_t *region, y1 = yDst; v = yDst + height; y2 = BOUND(v); + /* Check for empty operation */ - if (x1 >= x2 || - y1 >= y2) - { + if (x1 >= x2 || y1 >= y2) { pixman_region_empty (region); return 1; } + /* clip against src */ if (!FbClipImageSrc (region, iSrc, xDst - xSrc, yDst - ySrc)) - { - pixman_region_destroy (region); return 0; - } - if (iSrc->alphaMap) - { - if (!FbClipImageSrc (region, iSrc->alphaMap, - xDst - (xSrc + iSrc->alphaOrigin.x), - yDst - (ySrc + iSrc->alphaOrigin.y))) - { - pixman_region_destroy (region); - return 0; - } - } + + if (iSrc->alphaMap && + !FbClipImageSrc (region, iSrc->alphaMap, + xDst - (xSrc + iSrc->alphaOrigin.x), + yDst - (ySrc + iSrc->alphaOrigin.y))) + return 0; + /* clip against mask */ - if (iMask) - { + if (iMask) { if (!FbClipImageSrc (region, iMask, xDst - xMask, yDst - yMask)) - { - pixman_region_destroy (region); return 0; - } - if (iMask->alphaMap) - { - if (!FbClipImageSrc (region, iMask->alphaMap, - xDst - (xMask + iMask->alphaOrigin.x), - yDst - (yMask + iMask->alphaOrigin.y))) - { - pixman_region_destroy (region); - return 0; - } - } + + if (iMask->alphaMap && + !FbClipImageSrc (region, iMask->alphaMap, + xDst - (xMask + iMask->alphaOrigin.x), + yDst - (yMask + iMask->alphaOrigin.y))) + return 0; } if (!FbClipImageReg (region, iDst->hasCompositeClip ? &iDst->compositeClip : NULL, - 0, 0)) { - pixman_region_destroy (region); + 0, 0)) return 0; - } - if (iDst->alphaMap) { - if (!FbClipImageReg (region, - iDst->hasCompositeClip ? - &iDst->alphaMap->compositeClip : NULL, - -iDst->alphaOrigin.x, - -iDst->alphaOrigin.y)) { - pixman_region_destroy (region); - return 0; - } - } + if (iDst->alphaMap && + !FbClipImageReg (region, + iDst->hasCompositeClip ? + &iDst->alphaMap->compositeClip : NULL, + -iDst->alphaOrigin.x, -iDst->alphaOrigin.y)) + return 0; return 1; } |