diff options
author | Keith Packard <keithp@keithp.com> | 2004-08-06 23:42:10 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2004-08-06 23:42:10 +0000 |
commit | 196aafb19a3cfdc8c21f9bf75814cf0d84ff4446 (patch) | |
tree | ac3b5554167062f5dc2ce38aef8d7d13053fd787 /render/mitrap.c | |
parent | e847bcda0827ffb87689a0162c648570de6d6f69 (diff) |
Add RenderAddTraps. Rewrite trapezoid rendering code.
Diffstat (limited to 'render/mitrap.c')
-rw-r--r-- | render/mitrap.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/render/mitrap.c b/render/mitrap.c index 05db36ec8..77cdcf03f 100644 --- a/render/mitrap.c +++ b/render/mitrap.c @@ -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); + } } |