summaryrefslogtreecommitdiff
path: root/uxa/uxa-render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-08 18:36:55 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-08 19:35:28 +0100
commit848ab66384508c3ad3e5fb4884e4527f3ebd3bde (patch)
tree75b764fa40a22b5b07c150dff4fcf84d03322d65 /uxa/uxa-render.c
parenta7b800513fcc94e063dfd68d2f63b6bab7fae47d (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>
Diffstat (limited to 'uxa/uxa-render.c')
-rw-r--r--uxa/uxa-render.c26
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
(&region, pSrc, pMask, pDst, xSrc, ySrc,