diff options
author | Søren Sandmann Pedersen <sandmann@redhat.com> | 2007-06-11 09:16:46 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@redhat.com> | 2007-06-11 09:43:15 -0400 |
commit | 54e023cec07aa7e392da36e11d0a4667b8341370 (patch) | |
tree | 02f721162315f7ca9e957c3b04a18b8de9159045 /render | |
parent | 5cbec267b6426960c90f6bcff1d051af5084538c (diff) |
Don't pass regions to pixman_image_composite() anymore.
Diffstat (limited to 'render')
-rw-r--r-- | render/mipict.c | 56 | ||||
-rw-r--r-- | render/mipict.h | 6 | ||||
-rw-r--r-- | render/picturestr.h | 4 |
3 files changed, 40 insertions, 26 deletions
diff --git a/render/mipict.c b/render/mipict.c index dff7f5e59..87dccbbda 100644 --- a/render/mipict.c +++ b/render/mipict.c @@ -266,19 +266,19 @@ miChangePictureFilter (PicturePtr pPicture, #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) -static __inline Bool -miClipPictureReg (RegionPtr pRegion, - RegionPtr pClip, +static inline pixman_bool_t +miClipPictureReg (pixman_region16_t * pRegion, + pixman_region16_t * pClip, int dx, int dy) { - if (REGION_NUM_RECTS(pRegion) == 1 && - REGION_NUM_RECTS(pClip) == 1) + if (pixman_region_n_rects(pRegion) == 1 && + pixman_region_n_rects(pClip) == 1) { - BoxPtr pRbox = REGION_RECTS(pRegion); - BoxPtr pCbox = REGION_RECTS(pClip); + pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL); + pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL); int v; - + if (pRbox->x1 < (v = pCbox->x1 + dx)) pRbox->x1 = BOUND(v); if (pRbox->x2 > (v = pCbox->x2 + dx)) @@ -290,23 +290,23 @@ miClipPictureReg (RegionPtr pRegion, if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) { - REGION_EMPTY(pScreen, pRegion); + pixman_region_init (pRegion); } } - else if (!REGION_NOTEMPTY (pScreen, pClip)) + else if (!pixman_region_not_empty (pClip)) return FALSE; else { if (dx || dy) - REGION_TRANSLATE(pScreen, pRegion, -dx, -dy); - if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip)) + pixman_region_translate (pRegion, -dx, -dy); + if (!pixman_region_intersect (pRegion, pRegion, pClip)) return FALSE; if (dx || dy) - REGION_TRANSLATE(pScreen, pRegion, dx, dy); + pixman_region_translate(pRegion, dx, dy); } - return REGION_NOTEMPTY(pScreen, pRegion); + return pixman_region_not_empty(pRegion); } - + static __inline Bool miClipPictureSrc (RegionPtr pRegion, PicturePtr pPicture, @@ -320,13 +320,13 @@ miClipPictureSrc (RegionPtr pRegion, { if (pPicture->clientClipType != CT_NONE) { - REGION_TRANSLATE(pScreen, pRegion, + pixman_region_translate ( pRegion, dx - pPicture->clipOrigin.x, dy - pPicture->clipOrigin.y); if (!REGION_INTERSECT (pScreen, pRegion, pRegion, - (RegionPtr) pPicture->clientClip)) + (RegionPtr) pPicture->pCompositeClip)) // clientClip)) return FALSE; - REGION_TRANSLATE(pScreen, pRegion, + pixman_region_translate ( pRegion, - (dx - pPicture->clipOrigin.x), - (dy - pPicture->clipOrigin.y)); } @@ -341,7 +341,7 @@ miClipPictureSrc (RegionPtr pRegion, } } -static void +void miCompositeSourceValidate (PicturePtr pPicture, INT16 x, INT16 y, @@ -417,6 +417,7 @@ miComputeCompositeRegion (RegionPtr pRegion, CARD16 width, CARD16 height) { + int v; pRegion->extents.x1 = xDst; @@ -430,13 +431,13 @@ miComputeCompositeRegion (RegionPtr pRegion, if (pRegion->extents.x1 >= pRegion->extents.x2 || pRegion->extents.y1 >= pRegion->extents.y2) { - REGION_EMPTY (pDst->pDrawable->pScreen, pRegion); + pixman_region_init (pRegion); return FALSE; } /* clip against dst */ if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) { - REGION_UNINIT (pScreen, pRegion); + pixman_region_fini (pRegion); return FALSE; } if (pDst->alphaMap) @@ -445,14 +446,14 @@ miComputeCompositeRegion (RegionPtr pRegion, -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) { - REGION_UNINIT (pScreen, pRegion); + pixman_region_fini (pRegion); return FALSE; } } /* clip against src */ if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { - REGION_UNINIT (pScreen, pRegion); + pixman_region_fini (pRegion); return FALSE; } if (pSrc->alphaMap) @@ -461,7 +462,7 @@ miComputeCompositeRegion (RegionPtr pRegion, xDst - (xSrc + pSrc->alphaOrigin.x), yDst - (ySrc + pSrc->alphaOrigin.y))) { - REGION_UNINIT (pScreen, pRegion); + pixman_region_fini (pRegion); return FALSE; } } @@ -470,7 +471,7 @@ miComputeCompositeRegion (RegionPtr pRegion, { if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) { - REGION_UNINIT (pScreen, pRegion); + pixman_region_fini (pRegion); return FALSE; } if (pMask->alphaMap) @@ -479,14 +480,17 @@ miComputeCompositeRegion (RegionPtr pRegion, xDst - (xMask + pMask->alphaOrigin.x), yDst - (yMask + pMask->alphaOrigin.y))) { - REGION_UNINIT (pScreen, pRegion); + pixman_region_fini (pRegion); return FALSE; } } } + + miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height); if (pMask) miCompositeSourceValidate (pMask, xMask, yMask, width, height); + return TRUE; } diff --git a/render/mipict.h b/render/mipict.h index eef155f7d..bd7c23f4b 100644 --- a/render/mipict.h +++ b/render/mipict.h @@ -88,6 +88,12 @@ miClipPicture (RegionPtr pRegion, INT16 xPict, INT16 yPict); +void +miCompositeSourceValidate (PicturePtr pPicture, + INT16 x, + INT16 y, + CARD16 width, + CARD16 height); Bool miComputeCompositeRegion (RegionPtr pRegion, PicturePtr pSrc, diff --git a/render/picturestr.h b/render/picturestr.h index 9c41fc1f2..06530e260 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -661,6 +661,10 @@ AddTraps (PicturePtr pPicture, int ntraps, xTrap *traps); +pixman_image_t * +PixmanImageFromPicture (PicturePtr pPict, + Bool hasClip); + PicturePtr CreateSolidPicture (Picture pid, xRenderColor *color, |