From 4564896e10e1ba1ad3b5458b2066dd65b9f3bb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 3 Apr 2012 12:57:24 +0200 Subject: [PATCH 2/2] EXA: Factor in composite region early on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exa/exa_glyphs.c | 41 +++++++++++++++++++++++++++++++++++++---- exa/exa_render.c | 18 ++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c index 5c46ec9..09f2bb5 100644 --- a/exa/exa_glyphs.c +++ b/exa/exa_glyphs.c @@ -701,11 +701,14 @@ exaGlyphs (CARD8 op, GlyphListPtr list, GlyphPtr *glyphs) { + PixmapPtr pDstPixmap = exaGetDrawablePixmap(pDst->pDrawable); + ExaPixmapPrivPtr pDstExaPix = ExaGetPixmapPriv(pDstPixmap); PixmapPtr pMaskPixmap = 0; PicturePtr pMask = NULL; ScreenPtr pScreen = pDst->pDrawable->pScreen; int width = 0, height = 0; int x, y; + int dst_off_x, dst_off_y; int first_xOff = list->xOff, first_yOff = list->yOff; int n; GlyphPtr glyph; @@ -713,6 +716,40 @@ exaGlyphs (CARD8 op, BoxRec extents = {0, 0, 0, 0}; CARD32 component_alpha; ExaGlyphBuffer buffer; + RegionRec region; + + exaGetDrawableDeltas(pDst->pDrawable, pDstPixmap, &dst_off_x, &dst_off_y); + + if (pDstExaPix->pDamage) { + extents = *RegionExtents(DamagePendingRegion(pDstExaPix->pDamage)); + extents.x1 -= (pDst->pDrawable->x + dst_off_x); + extents.x2 -= (pDst->pDrawable->x + dst_off_x); + extents.y1 -= (pDst->pDrawable->y + dst_off_y); + extents.y2 -= (pDst->pDrawable->y + dst_off_y); + } + else + GlyphExtents (nlist, list, glyphs, &extents); + + width = extents.x2 - extents.x1; + height = extents.y2 - extents.y1; + if (width <= 0 || height <= 0 || + !miComputeCompositeRegion(®ion, pSrc, NULL, pDst, + xSrc + (pSrc->pDrawable ? pSrc->pDrawable->x : 0), + ySrc + (pSrc->pDrawable ? pSrc->pDrawable->y : 0), + 0, 0, + extents.x1 + pDst->pDrawable->x, + extents.y1 + pDst->pDrawable->y, + width, height)) { + if (pDstExaPix->pDamage) + RegionEmpty(DamagePendingRegion(pDstExaPix->pDamage)); + return; + } + extents = *RegionExtents(®ion); + RegionUninit(®ion); + extents.x1 -= pDst->pDrawable->x; + extents.x2 -= pDst->pDrawable->x; + extents.y1 -= pDst->pDrawable->y; + extents.y2 -= pDst->pDrawable->y; if (maskFormat) { @@ -720,10 +757,6 @@ exaGlyphs (CARD8 op, GCPtr pGC; xRectangle rect; - GlyphExtents (nlist, list, glyphs, &extents); - - if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) - return; width = extents.x2 - extents.x1; height = extents.y2 - extents.y1; diff --git a/exa/exa_render.c b/exa/exa_render.c index 3974afe..34603dd 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -897,11 +897,29 @@ exaComposite(CARD8 op, CARD16 height) { ExaScreenPriv (pDst->pDrawable->pScreen); + PixmapPtr pDstPix = exaGetDrawablePixmap(pDst->pDrawable); + ExaPixmapPrivPtr pDstExaPix = ExaGetPixmapPriv(pDstPix); int ret = -1; Bool saveSrcRepeat = pSrc->repeat; Bool saveMaskRepeat = pMask ? pMask->repeat : 0; RegionRec region; + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc + (pSrc->pDrawable ? pSrc->pDrawable->x : 0), + ySrc + (pSrc->pDrawable ? pSrc->pDrawable->y : 0), + xMask + ((pMask && pMask->pDrawable) ? + pMask->pDrawable->x : 0), + yMask + ((pMask && pMask->pDrawable) ? + pMask->pDrawable->x : 0), + xDst + pDst->pDrawable->x, + yDst + pDst->pDrawable->y, + width, height)) { + if (pDstExaPix->pDamage) + RegionEmpty(DamagePendingRegion(pDstExaPix->pDamage)); + return; + } + RegionUninit(®ion); + if (pExaScr->swappedOut) goto fallback; -- 1.7.10