diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-08 18:36:55 +0100 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-05-17 20:16:12 +0100 |
commit | d9f742ce0e4ba1a884749f373dc43f350dd2a05a (patch) | |
tree | c7c39b283d5277146b7d1a774faa46b51e9c6520 /uxa/uxa-render.c | |
parent | 538363094711d82eedea58fa29a54365e3844afd (diff) |
uxa: Transform composites with a simple translation into a blit
We can also convert a composite with an integer translation into a
blit, so long as the sample extents remains within the source.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 848ab66384508c3ad3e5fb4884e4527f3ebd3bde)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Diffstat (limited to 'uxa/uxa-render.c')
-rw-r--r-- | uxa/uxa-render.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index b2e88c47..31126770 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -1142,15 +1142,15 @@ compatible_formats (CARD8 op, PicturePtr dst, PicturePtr src) } static int -drawable_contains (DrawablePtr drawable, int x1, int y1, int x2, int y2) +drawable_contains (DrawablePtr drawable, int x, int y, int w, int h) { - if (x1 < 0 || y1 < 0) + if (x < 0 || y < 0) return FALSE; - if (x2 > drawable->width) + if (x + w > drawable->width) return FALSE; - if (y2 > drawable->height) + if (y + h > drawable->height) return FALSE; return TRUE; @@ -1171,15 +1171,16 @@ uxa_composite(CARD8 op, Bool saveSrcRepeat = pSrc->repeat; Bool saveMaskRepeat = pMask ? pMask->repeat : 0; RegionRec region; + int tx, ty; if (uxa_screen->swappedOut) goto fallback; /* Remove repeat in source if useless */ - if (pSrc->pDrawable && pSrc->repeat && !pSrc->transform && + if (pSrc->pDrawable && pSrc->repeat && + transform_is_integer_translation(pSrc->transform, &tx, &ty) && (pSrc->pDrawable->width > 1 || pSrc->pDrawable->height > 1) && - xSrc >= 0 && (xSrc + width) <= pSrc->pDrawable->width && - ySrc >= 0 && (ySrc + height) <= pSrc->pDrawable->height) + drawable_contains(pSrc->pDrawable, xSrc + tx, ySrc + ty, width, height)) pSrc->repeat = 0; if (!pMask) { @@ -1205,12 +1206,15 @@ uxa_composite(CARD8 op, width, height); if (ret == 1) goto done; - } else if (!pSrc->repeat && !pSrc->transform && - drawable_contains(pSrc->pDrawable, xSrc, ySrc, xSrc + width, ySrc + height)) { + } else if (!pSrc->repeat && + transform_is_integer_translation(pSrc->transform, &tx, &ty) && + drawable_contains(pSrc->pDrawable, + xSrc + tx, ySrc + ty, + width, height)) { xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; + xSrc += pSrc->pDrawable->x + tx; + ySrc += pSrc->pDrawable->y + ty; if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, |