EXA: Lots of damage tracking fixes.
Mostly due to exaDrawableDirty() now calculating the backing pixmap coordinates internally, for cases where they aren't trivially known. There's a new exaPixmapDirty() function for the other cases.
This commit is contained in:
parent
467c00cf45
commit
9563b2eea2
92
exa/exa.c
92
exa/exa.c
|
@ -122,20 +122,47 @@ exaGetDrawablePixmap(DrawablePtr pDrawable)
|
|||
}
|
||||
|
||||
/**
|
||||
* exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for
|
||||
* Sets the offsets to add to coordinates to make them address the same bits in
|
||||
* the backing drawable. These coordinates are nonzero only for redirected
|
||||
* windows.
|
||||
*/
|
||||
static void
|
||||
exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
|
||||
int *xp, int *yp)
|
||||
{
|
||||
#ifdef COMPOSITE
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
*xp = -pPixmap->screen_x;
|
||||
*yp = -pPixmap->screen_y;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
*xp = 0;
|
||||
*yp = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* exaPixmapDirty() marks a pixmap as dirty, allowing for
|
||||
* optimizations in pixmap migration when no changes have occurred.
|
||||
*/
|
||||
void
|
||||
exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2)
|
||||
exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
ExaPixmapPrivPtr pExaPixmap;
|
||||
ExaPixmapPriv(pPix);
|
||||
BoxRec box;
|
||||
RegionPtr pDamageReg;
|
||||
BoxRec box = { .x1 = max(x1,0), .x2 = min(x2,pDrawable->width),
|
||||
.y1 = max(y1,0), .y2 = min(y2,pDrawable->height) };
|
||||
RegionRec region;
|
||||
|
||||
pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable));
|
||||
if (!pExaPixmap || box.x1 >= box.x2 || box.y1 >= box.y2)
|
||||
if (!pExaPixmap)
|
||||
return;
|
||||
|
||||
box.x1 = max(x1, 0);
|
||||
box.y1 = max(y1, 0);
|
||||
box.x2 = min(x2, pPix->drawable.width);
|
||||
box.y2 = min(y2, pPix->drawable.height);
|
||||
|
||||
if (box.x1 >= box.x2 || box.y1 >= box.y2)
|
||||
return;
|
||||
|
||||
pDamageReg = DamageRegion(pExaPixmap->pDamage);
|
||||
|
@ -145,6 +172,29 @@ exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2)
|
|||
REGION_UNINIT(pScreen, ®ion);
|
||||
}
|
||||
|
||||
/**
|
||||
* exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for
|
||||
* optimizations in pixmap migration when no changes have occurred.
|
||||
*/
|
||||
void
|
||||
exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
PixmapPtr pPix = exaGetDrawablePixmap(pDrawable);
|
||||
int xoff, yoff;
|
||||
|
||||
x1 = max(x1, pDrawable->x);
|
||||
y1 = max(y1, pDrawable->y);
|
||||
x2 = min(x2, pDrawable->x + pDrawable->width);
|
||||
y2 = min(y2, pDrawable->y + pDrawable->height);
|
||||
|
||||
if (x1 >= x2 || y1 >= y2)
|
||||
return;
|
||||
|
||||
exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
|
||||
|
||||
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
|
||||
}
|
||||
|
||||
static Bool
|
||||
exaDestroyPixmap (PixmapPtr pPixmap)
|
||||
{
|
||||
|
@ -289,32 +339,14 @@ exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
|||
/**
|
||||
* Returns the pixmap which backs a drawable, and the offsets to add to
|
||||
* coordinates to make them address the same bits in the backing drawable.
|
||||
* These coordinates are nonzero only for redirected windows.
|
||||
*/
|
||||
PixmapPtr
|
||||
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
int x, y;
|
||||
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||
|
||||
exaGetDrawableDeltas (pDrawable, pPixmap, xp, yp);
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
||||
#ifdef COMPOSITE
|
||||
x = -pPixmap->screen_x;
|
||||
y = -pPixmap->screen_y;
|
||||
#else
|
||||
x = 0;
|
||||
y = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
pPixmap = (PixmapPtr) pDrawable;
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
*xp = x;
|
||||
*yp = y;
|
||||
if (exaPixmapIsOffscreen (pPixmap))
|
||||
return pPixmap;
|
||||
else
|
||||
|
@ -428,7 +460,7 @@ exaValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
|
|||
exaPrepareAccess(&pOldTile->drawable, EXA_PREPARE_SRC);
|
||||
pNewTile = fb24_32ReformatTile (pOldTile,
|
||||
pDrawable->bitsPerPixel);
|
||||
exaDrawableDirty(&pNewTile->drawable, 0, 0, pNewTile->drawable.width, pNewTile->drawable.height);
|
||||
exaPixmapDirty(pNewTile, 0, 0, pNewTile->drawable.width, pNewTile->drawable.height);
|
||||
exaFinishAccess(&pOldTile->drawable, EXA_PREPARE_SRC);
|
||||
}
|
||||
if (pNewTile)
|
||||
|
@ -449,7 +481,7 @@ exaValidateGC (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
|
|||
*/
|
||||
exaMoveOutPixmap(pGC->tile.pixmap);
|
||||
fbPadPixmap (pGC->tile.pixmap);
|
||||
exaDrawableDirty(&pGC->tile.pixmap->drawable, 0, 0,
|
||||
exaPixmapDirty(pGC->tile.pixmap, 0, 0,
|
||||
pGC->tile.pixmap->drawable.width,
|
||||
pGC->tile.pixmap->drawable.height);
|
||||
}
|
||||
|
|
|
@ -109,8 +109,7 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
|
|||
(*pExaScr->info->Solid) (pPixmap,
|
||||
fullX1 + off_x, fullY1 + off_y,
|
||||
fullX2 + off_x, fullY1 + 1 + off_y);
|
||||
exaDrawableDirty (pDrawable,
|
||||
fullX1 + off_x, fullY1 + off_y,
|
||||
exaPixmapDirty (pPixmap, fullX1 + off_x, fullY1 + off_y,
|
||||
fullX2 + off_x, fullY1 + 1 + off_y);
|
||||
}
|
||||
else
|
||||
|
@ -130,8 +129,7 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
|
|||
(*pExaScr->info->Solid) (pPixmap,
|
||||
partX1 + off_x, fullY1 + off_y,
|
||||
partX2 + off_x, fullY1 + 1 + off_y);
|
||||
exaDrawableDirty (pDrawable,
|
||||
partX1 + off_x, fullY1 + off_y,
|
||||
exaPixmapDirty (pPixmap, partX1 + off_x, fullY1 + off_y,
|
||||
partX2 + off_x, fullY1 + 1 + off_y);
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +231,7 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
|
|||
|
||||
exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
|
||||
}
|
||||
exaDrawableDirty(pDrawable, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
|
||||
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -362,8 +360,7 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
|
|||
dst_off_y + pbox->y1 + i,
|
||||
pbox->x2 - pbox->x1, 1);
|
||||
}
|
||||
exaDrawableDirty(pDstDrawable,
|
||||
dst_off_x + pbox->x1, dst_off_y + pbox->y1,
|
||||
exaPixmapDirty(pDstPixmap, dst_off_x + pbox->x1, dst_off_y + pbox->y1,
|
||||
dst_off_x + pbox->x2, dst_off_y + pbox->y2);
|
||||
}
|
||||
if (dirsetup != 0)
|
||||
|
@ -437,7 +434,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
pbox->x2 - pbox->x1,
|
||||
pbox->y2 - pbox->y1);
|
||||
exaDrawableDirty (pDstDrawable,
|
||||
exaPixmapDirty (pDstPixmap,
|
||||
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
|
||||
pbox++;
|
||||
|
@ -460,9 +457,7 @@ fallback:
|
|||
exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
|
||||
while (nbox--)
|
||||
{
|
||||
exaDrawableDirty (pDstDrawable,
|
||||
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
|
||||
exaDrawableDirty (pDstDrawable, pbox->x1, pbox->y1, pbox->x2, pbox->y2);
|
||||
pbox++;
|
||||
}
|
||||
}
|
||||
|
@ -704,8 +699,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
|
|||
(*pExaScr->info->Solid) (pPixmap,
|
||||
fullX1 + xoff, fullY1 + yoff,
|
||||
fullX2 + xoff, fullY2 + yoff);
|
||||
exaDrawableDirty (pDrawable,
|
||||
fullX1 + xoff, fullY1 + yoff,
|
||||
exaPixmapDirty (pPixmap, fullX1 + xoff, fullY1 + yoff,
|
||||
fullX2 + xoff, fullY2 + yoff);
|
||||
}
|
||||
else
|
||||
|
@ -736,8 +730,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
|
|||
(*pExaScr->info->Solid) (pPixmap,
|
||||
partX1 + xoff, partY1 + yoff,
|
||||
partX2 + xoff, partY2 + yoff);
|
||||
exaDrawableDirty (pDrawable,
|
||||
partX1 + xoff, partY1 + yoff,
|
||||
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff,
|
||||
partX2 + xoff, partY2 + yoff);
|
||||
}
|
||||
}
|
||||
|
@ -770,9 +763,6 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
|
|||
pixmaps[0].as_src = FALSE;
|
||||
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||
|
||||
/* We need to initialize x/yoff for tracking damage in the fallback case */
|
||||
pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
|
||||
|
||||
if (pExaScr->swappedOut ||
|
||||
pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY)
|
||||
|
@ -825,13 +815,14 @@ fallback:
|
|||
if (partY2 <= partY1)
|
||||
continue;
|
||||
|
||||
if (!fallback)
|
||||
if (!fallback) {
|
||||
(*pExaScr->info->Solid) (pPixmap,
|
||||
partX1 + xoff, partY1 + yoff,
|
||||
partX2 + xoff, partY2 + yoff);
|
||||
exaDrawableDirty (pDrawable,
|
||||
partX1 + xoff, partY1 + yoff,
|
||||
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff,
|
||||
partX2 + xoff, partY2 + yoff);
|
||||
} else
|
||||
exaDrawableDirty (pDrawable, partX1, partY1, partX2, partY2);
|
||||
}
|
||||
|
||||
if (fallback)
|
||||
|
@ -950,12 +941,17 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
|
|||
pPriv->fg,
|
||||
gx + dstXoff,
|
||||
gHeight);
|
||||
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth, gy + gHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
RegionPtr pClip = fbGetCompositeClip(pGC);
|
||||
int nbox;
|
||||
BoxPtr pbox;
|
||||
|
||||
gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
|
||||
fbPutXYImage (pDrawable,
|
||||
fbGetCompositeClip(pGC),
|
||||
pClip,
|
||||
pPriv->fg,
|
||||
pPriv->bg,
|
||||
pPriv->pm,
|
||||
|
@ -969,9 +965,19 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
|
|||
(FbStip *) pglyph,
|
||||
gStride,
|
||||
0);
|
||||
|
||||
for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
|
||||
nbox--; pbox++) {
|
||||
int x1 = max(gx, pbox->x1), x2 = min(gx + gWidth, pbox->x2);
|
||||
int y1 = max(gy, pbox->y1), y2 = min(gy + gHeight, pbox->y2);
|
||||
|
||||
if (x1 >= x2 || y1 >= y2)
|
||||
continue;
|
||||
|
||||
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth,
|
||||
gy + gHeight);
|
||||
}
|
||||
}
|
||||
exaDrawableDirty(pDrawable, gx + dstXoff, gy + dstYoff,
|
||||
gx + dstXoff + gWidth, gy + dstYoff + gHeight);
|
||||
}
|
||||
x += pci->metrics.characterWidth;
|
||||
}
|
||||
|
@ -1062,8 +1068,7 @@ exaFillRegionSolid (DrawablePtr pDrawable,
|
|||
(*pExaScr->info->Solid) (pPixmap,
|
||||
pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
pBox->x2 + xoff, pBox->y2 + yoff);
|
||||
exaDrawableDirty (pDrawable,
|
||||
pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
pBox->x2 + xoff, pBox->y2 + yoff);
|
||||
pBox++;
|
||||
}
|
||||
|
@ -1081,9 +1086,7 @@ fallback:
|
|||
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
while (nbox--)
|
||||
{
|
||||
exaDrawableDirty (pDrawable,
|
||||
pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
pBox->x2 + xoff, pBox->y2 + yoff);
|
||||
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
|
||||
pBox++;
|
||||
}
|
||||
}
|
||||
|
@ -1123,9 +1126,6 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
pixmaps[1].as_src = TRUE;
|
||||
pixmaps[1].pPix = pTile;
|
||||
|
||||
/* We need to initialize x/yoff for tracking damage in the fallback case */
|
||||
pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
|
||||
|
||||
if (pPixmap->drawable.width > pExaScr->info->maxX ||
|
||||
pPixmap->drawable.height > pExaScr->info->maxY ||
|
||||
tileWidth > pExaScr->info->maxX ||
|
||||
|
@ -1182,7 +1182,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
|
|||
dstY += h;
|
||||
tileY = 0;
|
||||
}
|
||||
exaDrawableDirty (pDrawable, pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
pBox->x2 + xoff, pBox->y2 + yoff);
|
||||
pBox++;
|
||||
}
|
||||
|
@ -1202,8 +1202,7 @@ fallback:
|
|||
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
while (nbox--)
|
||||
{
|
||||
exaDrawableDirty (pDrawable, pBox->x1 + xoff, pBox->y1 + yoff,
|
||||
pBox->x2 + xoff, pBox->y2 + yoff);
|
||||
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
|
||||
pBox++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,6 +339,9 @@ exaPrepareAccess(DrawablePtr pDrawable, int index);
|
|||
void
|
||||
exaFinishAccess(DrawablePtr pDrawable, int index);
|
||||
|
||||
void
|
||||
exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
|
||||
|
||||
void
|
||||
exaDrawableDirty(DrawablePtr pDrawable, int x1, int y1, int x2, int y2);
|
||||
|
||||
|
|
|
@ -302,8 +302,7 @@ exaTryDriverSolidFill(PicturePtr pSrc,
|
|||
(*pExaScr->info->Solid) (pDstPix,
|
||||
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
|
||||
exaDrawableDirty (pDst->pDrawable,
|
||||
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
|
||||
pbox++;
|
||||
}
|
||||
|
@ -447,8 +446,7 @@ exaTryDriverComposite(CARD8 op,
|
|||
pbox->y1 + dst_off_y,
|
||||
pbox->x2 - pbox->x1,
|
||||
pbox->y2 - pbox->y1);
|
||||
exaDrawableDirty (pDst->pDrawable,
|
||||
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
|
||||
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
|
||||
pbox++;
|
||||
}
|
||||
|
@ -712,18 +710,19 @@ void
|
|||
exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
|
||||
int x_off, int y_off)
|
||||
{
|
||||
DrawablePtr pDraw = pPicture->pDrawable;
|
||||
ExaMigrationRec pixmaps[1];
|
||||
|
||||
pixmaps[0].as_dst = TRUE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pPicture->pDrawable);
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDraw);
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
|
||||
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
|
||||
exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
|
||||
fbRasterizeTrapezoid(pPicture, trap, x_off, y_off);
|
||||
exaDrawableDirty(pPicture->pDrawable, 0, 0,
|
||||
pPicture->pDrawable->width, pPicture->pDrawable->height);
|
||||
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
|
||||
exaDrawableDirty(pDraw, pDraw->x, pDraw->y,
|
||||
pDraw->x + pDraw->width, pDraw->y + pDraw->height);
|
||||
exaFinishAccess(pDraw, EXA_PREPARE_DEST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -734,18 +733,19 @@ void
|
|||
exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
|
||||
xTriangle *tris)
|
||||
{
|
||||
DrawablePtr pDraw = pPicture->pDrawable;
|
||||
ExaMigrationRec pixmaps[1];
|
||||
|
||||
pixmaps[0].as_dst = TRUE;
|
||||
pixmaps[0].as_src = TRUE;
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pPicture->pDrawable);
|
||||
pixmaps[0].pPix = exaGetDrawablePixmap (pDraw);
|
||||
exaDoMigration(pixmaps, 1, FALSE);
|
||||
|
||||
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
|
||||
exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
|
||||
fbAddTriangles(pPicture, x_off, y_off, ntri, tris);
|
||||
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
|
||||
exaDrawableDirty(pPicture->pDrawable, 0, 0,
|
||||
pPicture->pDrawable->width, pPicture->pDrawable->height);
|
||||
exaDrawableDirty(pDraw, pDraw->x, pDraw->y,
|
||||
pDraw->x + pDraw->width, pDraw->y + pDraw->height);
|
||||
exaFinishAccess(pDraw, EXA_PREPARE_DEST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1036,7 +1036,7 @@ exaGlyphs (CARD8 op,
|
|||
0, 0, glyph->info.width, glyph->info.height, 0, 0);
|
||||
}
|
||||
|
||||
exaDrawableDirty (&pPixmap->drawable, 0, 0,
|
||||
exaPixmapDirty (pPixmap, 0, 0,
|
||||
glyph->info.width, glyph->info.height);
|
||||
|
||||
if (maskFormat)
|
||||
|
|
|
@ -23,26 +23,6 @@
|
|||
|
||||
#include "exa_priv.h"
|
||||
|
||||
#define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \
|
||||
BoxPtr extents = &pGC->pCompositeClip->extents;\
|
||||
if(box.x1 < extents->x1) box.x1 = extents->x1; \
|
||||
if(box.x2 > extents->x2) box.x2 = extents->x2; \
|
||||
if(box.y1 < extents->y1) box.y1 = extents->y1; \
|
||||
if(box.y2 > extents->y2) box.y2 = extents->y2; \
|
||||
}
|
||||
|
||||
#define TRANSLATE_BOX(box, pDrawable) { \
|
||||
box.x1 += pDrawable->x; \
|
||||
box.x2 += pDrawable->x; \
|
||||
box.y1 += pDrawable->y; \
|
||||
box.y2 += pDrawable->y; \
|
||||
}
|
||||
|
||||
#define TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC) { \
|
||||
TRANSLATE_BOX(box, pDrawable); \
|
||||
TRIM_BOX(box, pGC); \
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions wrap the low-level fb rendering functions and
|
||||
* synchronize framebuffer/accelerated drawing by stalling until
|
||||
|
@ -222,10 +202,9 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
|
|||
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
|
||||
|
||||
if (nrect) {
|
||||
BoxRec box = { .x1 = max(prect->x,0),
|
||||
.x2 = min(prect->x + prect->width,pDrawable->width),
|
||||
.y1 = max(prect->y,0),
|
||||
.y2 = min(prect->y + prect->height,pDrawable->height) };
|
||||
int x1 = max(prect->x, 0), y1 = max(prect->y, 0);
|
||||
int x2 = min(prect->x + prect->width, pDrawable->width);
|
||||
int y2 = min(prect->y + prect->height, pDrawable->height);
|
||||
|
||||
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
|
||||
exaPrepareAccessGC (pGC);
|
||||
|
@ -239,15 +218,14 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
|
|||
while (--nrect)
|
||||
{
|
||||
prect++;
|
||||
box.x1 = min(box.x1, prect->x);
|
||||
box.x2 = max(box.x2, prect->x + prect->width);
|
||||
box.y1 = min(box.y1, prect->y);
|
||||
box.y2 = max(box.y2, prect->y + prect->height);
|
||||
x1 = min(x1, prect->x);
|
||||
x2 = max(x2, prect->x + prect->width);
|
||||
y1 = min(y1, prect->y);
|
||||
y2 = max(y2, prect->y + prect->height);
|
||||
}
|
||||
|
||||
TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC);
|
||||
|
||||
exaDrawableDirty (pDrawable, box.x1, box.x2, box.y1, box.y2);
|
||||
exaDrawableDirty (pDrawable, pDrawable->x + x1, pDrawable->y + y1,
|
||||
pDrawable->x + x2, pDrawable->y + y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue