mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
Add RenderAddTraps. Rewrite trapezoid rendering code.
This commit is contained in:
@@ -136,16 +136,25 @@ miTrapezoids (CARD8 op,
|
||||
{
|
||||
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
||||
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
||||
PicturePtr pPicture = 0;
|
||||
BoxRec bounds;
|
||||
INT16 xDst, yDst;
|
||||
INT16 xRel, yRel;
|
||||
|
||||
xDst = traps[0].left.p1.x >> 16;
|
||||
yDst = traps[0].left.p1.y >> 16;
|
||||
|
||||
if (maskFormat)
|
||||
|
||||
/*
|
||||
* Check for solid alpha add
|
||||
*/
|
||||
if (op == PictOpAdd && miIsSolidAlpha (pSrc))
|
||||
{
|
||||
for (; ntrap; ntrap--, traps++)
|
||||
(*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
|
||||
}
|
||||
else if (maskFormat)
|
||||
{
|
||||
PicturePtr pPicture;
|
||||
BoxRec bounds;
|
||||
INT16 xDst, yDst;
|
||||
INT16 xRel, yRel;
|
||||
|
||||
xDst = traps[0].left.p1.x >> 16;
|
||||
yDst = traps[0].left.p1.y >> 16;
|
||||
|
||||
miTrapezoidBounds (ntrap, traps, &bounds);
|
||||
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
|
||||
return;
|
||||
@@ -154,37 +163,9 @@ miTrapezoids (CARD8 op,
|
||||
bounds.y2 - bounds.y1);
|
||||
if (!pPicture)
|
||||
return;
|
||||
}
|
||||
for (; ntrap; ntrap--, traps++)
|
||||
{
|
||||
if (!xTrapezoidValid(traps))
|
||||
continue;
|
||||
if (!maskFormat)
|
||||
{
|
||||
miTrapezoidBounds (1, traps, &bounds);
|
||||
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
|
||||
continue;
|
||||
pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
|
||||
bounds.x2 - bounds.x1,
|
||||
bounds.y2 - bounds.y1);
|
||||
if (!pPicture)
|
||||
continue;
|
||||
}
|
||||
(*ps->RasterizeTrapezoid) (pPicture, traps,
|
||||
-bounds.x1, -bounds.y1);
|
||||
if (!maskFormat)
|
||||
{
|
||||
xRel = bounds.x1 + xSrc - xDst;
|
||||
yRel = bounds.y1 + ySrc - yDst;
|
||||
CompositePicture (op, pSrc, pPicture, pDst,
|
||||
xRel, yRel, 0, 0, bounds.x1, bounds.y1,
|
||||
bounds.x2 - bounds.x1,
|
||||
bounds.y2 - bounds.y1);
|
||||
FreePicture (pPicture, 0);
|
||||
}
|
||||
}
|
||||
if (maskFormat)
|
||||
{
|
||||
for (; ntrap; ntrap--, traps++)
|
||||
(*ps->RasterizeTrapezoid) (pPicture, traps,
|
||||
-bounds.x1, -bounds.y1);
|
||||
xRel = bounds.x1 + xSrc - xDst;
|
||||
yRel = bounds.y1 + ySrc - yDst;
|
||||
CompositePicture (op, pSrc, pPicture, pDst,
|
||||
@@ -193,4 +174,13 @@ miTrapezoids (CARD8 op,
|
||||
bounds.y2 - bounds.y1);
|
||||
FreePicture (pPicture, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDst->polyEdge == PolyEdgeSharp)
|
||||
maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
|
||||
else
|
||||
maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
|
||||
for (; ntrap; ntrap--, traps++)
|
||||
miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user