aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/render
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/render')
-rw-r--r--xorg-server/render/mipict.c4
-rw-r--r--xorg-server/render/mipict.h403
-rw-r--r--xorg-server/render/mitrap.c268
-rw-r--r--xorg-server/render/mitri.c59
4 files changed, 269 insertions, 465 deletions
diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c
index db8d43641..b5eeb443d 100644
--- a/xorg-server/render/mipict.c
+++ b/xorg-server/render/mipict.c
@@ -631,8 +631,8 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->Composite = 0; /* requires DDX support */
ps->Glyphs = miGlyphs;
ps->CompositeRects = miCompositeRects;
- ps->Trapezoids = miTrapezoids;
- ps->Triangles = miTriangles;
+ ps->Trapezoids = 0;
+ ps->Triangles = 0;
ps->TriStrip = miTriStrip;
ps->TriFan = miTriFan;
diff --git a/xorg-server/render/mipict.h b/xorg-server/render/mipict.h
index eb6b6645d..67d239ab7 100644
--- a/xorg-server/render/mipict.h
+++ b/xorg-server/render/mipict.h
@@ -1,215 +1,188 @@
-/*
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifndef _MIPICT_H_
-#define _MIPICT_H_
-
-#include "picturestr.h"
-
-#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
-
-#if MI_MAX_INDEXED <= 256
-typedef CARD8 miIndexType;
-#endif
-
-typedef struct _miIndexed {
- Bool color;
- CARD32 rgba[MI_MAX_INDEXED];
- miIndexType ent[32768];
-} miIndexedRec, *miIndexedPtr;
-
-#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
- (((s) >> 6) & 0x03e0) | \
- (((s) >> 9) & 0x7c00))
-#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
-#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
-
-#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
-
-extern _X_EXPORT int
-miCreatePicture (PicturePtr pPicture);
-
-extern _X_EXPORT void
-miDestroyPicture (PicturePtr pPicture);
-
-extern _X_EXPORT void
-miDestroyPictureClip (PicturePtr pPicture);
-
-extern _X_EXPORT int
-miChangePictureClip (PicturePtr pPicture,
- int type,
- pointer value,
- int n);
-
-extern _X_EXPORT void
-miChangePicture (PicturePtr pPicture,
- Mask mask);
-
-extern _X_EXPORT void
-miValidatePicture (PicturePtr pPicture,
- Mask mask);
-
-extern _X_EXPORT int
-miChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform);
-
-extern _X_EXPORT int
-miChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
-
-extern _X_EXPORT void
-miCompositeSourceValidate (PicturePtr pPicture,
- INT16 x,
- INT16 y,
- CARD16 width,
- CARD16 height);
-extern _X_EXPORT Bool
-miComputeCompositeRegion (RegionPtr pRegion,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-extern _X_EXPORT Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
-
-extern _X_EXPORT Bool
-miRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph);
-
-extern _X_EXPORT void
-miUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph);
-
-extern _X_EXPORT void
-miGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-
-extern _X_EXPORT void
-miRenderColorToPixel (PictFormatPtr pPict,
- xRenderColor *color,
- CARD32 *pixel);
-
-extern _X_EXPORT void
-miRenderPixelToColor (PictFormatPtr pPict,
- CARD32 pixel,
- xRenderColor *color);
-
-extern _X_EXPORT Bool
-miIsSolidAlpha (PicturePtr pSrc);
-
-extern _X_EXPORT void
-miCompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
-
-extern _X_EXPORT void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box);
-
-extern _X_EXPORT void
-miTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
-
-extern _X_EXPORT void
-miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds);
-
-extern _X_EXPORT void
-miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds);
-
-extern _X_EXPORT void
-miTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntri,
- xTriangle *tris);
-
-extern _X_EXPORT void
-miTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-extern _X_EXPORT void
-miTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-extern _X_EXPORT PicturePtr
-miCreateAlphaPicture (ScreenPtr pScreen,
- PicturePtr pDst,
- PictFormatPtr pPictFormat,
- CARD16 width,
- CARD16 height);
-
-extern _X_EXPORT Bool
-miInitIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-extern _X_EXPORT void
-miCloseIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-extern _X_EXPORT void
-miUpdateIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef);
-
-#endif /* _MIPICT_H_ */
+/*
+ *
+ * Copyright © 2000 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifndef _MIPICT_H_
+#define _MIPICT_H_
+
+#include "picturestr.h"
+
+#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
+
+#if MI_MAX_INDEXED <= 256
+typedef CARD8 miIndexType;
+#endif
+
+typedef struct _miIndexed {
+ Bool color;
+ CARD32 rgba[MI_MAX_INDEXED];
+ miIndexType ent[32768];
+} miIndexedRec, *miIndexedPtr;
+
+#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
+ (((s) >> 6) & 0x03e0) | \
+ (((s) >> 9) & 0x7c00))
+#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
+#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
+
+#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
+
+extern _X_EXPORT int
+miCreatePicture (PicturePtr pPicture);
+
+extern _X_EXPORT void
+miDestroyPicture (PicturePtr pPicture);
+
+extern _X_EXPORT void
+miDestroyPictureClip (PicturePtr pPicture);
+
+extern _X_EXPORT int
+miChangePictureClip (PicturePtr pPicture,
+ int type,
+ pointer value,
+ int n);
+
+extern _X_EXPORT void
+miChangePicture (PicturePtr pPicture,
+ Mask mask);
+
+extern _X_EXPORT void
+miValidatePicture (PicturePtr pPicture,
+ Mask mask);
+
+extern _X_EXPORT int
+miChangePictureTransform (PicturePtr pPicture,
+ PictTransform *transform);
+
+extern _X_EXPORT int
+miChangePictureFilter (PicturePtr pPicture,
+ int filter,
+ xFixed *params,
+ int nparams);
+
+extern _X_EXPORT void
+miCompositeSourceValidate (PicturePtr pPicture,
+ INT16 x,
+ INT16 y,
+ CARD16 width,
+ CARD16 height);
+extern _X_EXPORT Bool
+miComputeCompositeRegion (RegionPtr pRegion,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+extern _X_EXPORT Bool
+miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
+
+extern _X_EXPORT Bool
+miRealizeGlyph (ScreenPtr pScreen,
+ GlyphPtr glyph);
+
+extern _X_EXPORT void
+miUnrealizeGlyph (ScreenPtr pScreen,
+ GlyphPtr glyph);
+
+extern _X_EXPORT void
+miGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
+extern _X_EXPORT void
+miRenderColorToPixel (PictFormatPtr pPict,
+ xRenderColor *color,
+ CARD32 *pixel);
+
+extern _X_EXPORT void
+miRenderPixelToColor (PictFormatPtr pPict,
+ CARD32 pixel,
+ xRenderColor *color);
+
+extern _X_EXPORT Bool
+miIsSolidAlpha (PicturePtr pSrc);
+
+extern _X_EXPORT void
+miCompositeRects (CARD8 op,
+ PicturePtr pDst,
+ xRenderColor *color,
+ int nRect,
+ xRectangle *rects);
+
+extern _X_EXPORT void
+miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box);
+
+extern _X_EXPORT void
+miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds);
+
+extern _X_EXPORT void
+miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds);
+
+extern _X_EXPORT void
+miTriStrip (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int npoint,
+ xPointFixed *points);
+
+extern _X_EXPORT void
+miTriFan (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int npoint,
+ xPointFixed *points);
+
+extern _X_EXPORT Bool
+miInitIndexed (ScreenPtr pScreen,
+ PictFormatPtr pFormat);
+
+extern _X_EXPORT void
+miCloseIndexed (ScreenPtr pScreen,
+ PictFormatPtr pFormat);
+
+extern _X_EXPORT void
+miUpdateIndexed (ScreenPtr pScreen,
+ PictFormatPtr pFormat,
+ int ndef,
+ xColorItem *pdef);
+
+#endif /* _MIPICT_H_ */
diff --git a/xorg-server/render/mitrap.c b/xorg-server/render/mitrap.c
index 8bdc8a8d0..37d917451 100644
--- a/xorg-server/render/mitrap.c
+++ b/xorg-server/render/mitrap.c
@@ -1,189 +1,79 @@
-/*
- *
- * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "mipict.h"
-
-PicturePtr
-miCreateAlphaPicture (ScreenPtr pScreen,
- PicturePtr pDst,
- PictFormatPtr pPictFormat,
- CARD16 width,
- CARD16 height)
-{
- PixmapPtr pPixmap;
- PicturePtr pPicture;
- GCPtr pGC;
- int error;
- xRectangle rect;
-
- if (width > 32767 || height > 32767)
- return 0;
-
- if (!pPictFormat)
- {
- if (pDst->polyEdge == PolyEdgeSharp)
- pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
- else
- pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
- if (!pPictFormat)
- return 0;
- }
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
- pPictFormat->depth, 0);
- if (!pPixmap)
- return 0;
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- if (!pGC)
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return 0;
- }
- ValidateGC (&pPixmap->drawable, pGC);
- rect.x = 0;
- rect.y = 0;
- rect.width = width;
- rect.height = height;
- (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
- FreeScratchGC (pGC);
- pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
- 0, 0, serverClient, &error);
- (*pScreen->DestroyPixmap) (pPixmap);
- return pPicture;
-}
-
-static xFixed
-miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
-{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
- if (ceil)
- ex += (dy - 1);
- return l->p1.x + (xFixed) (ex / dy);
-}
-
-void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
-{
- box->y1 = MAXSHORT;
- box->y2 = MINSHORT;
- box->x1 = MAXSHORT;
- box->x2 = MINSHORT;
- for (; ntrap; ntrap--, traps++)
- {
- INT16 x1, y1, x2, y2;
-
- if (!xTrapezoidValid(traps))
- continue;
- y1 = xFixedToInt (traps->top);
- if (y1 < box->y1)
- box->y1 = y1;
-
- y2 = xFixedToInt (xFixedCeil (traps->bottom));
- if (y2 > box->y2)
- box->y2 = y2;
-
- x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE),
- miLineFixedX (&traps->left, traps->bottom, FALSE)));
- if (x1 < box->x1)
- box->x1 = x1;
-
- x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE),
- miLineFixedX (&traps->right, traps->bottom, TRUE))));
- if (x2 > box->x2)
- box->x2 = x2;
- }
-}
-
-void
-miTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- /*
- * 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;
- pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
- bounds.x2 - bounds.x1,
- bounds.y2 - bounds.y1);
- if (!pPicture)
- return;
- 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,
- xRel, yRel, 0, 0, bounds.x1, bounds.y1,
- bounds.x2 - bounds.x1,
- 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);
- }
-}
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "mipict.h"
+
+static xFixed
+miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
+{
+ xFixed dx = l->p2.x - l->p1.x;
+ xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
+ xFixed dy = l->p2.y - l->p1.y;
+ if (ceil)
+ ex += (dy - 1);
+ return l->p1.x + (xFixed) (ex / dy);
+}
+
+void
+miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
+{
+ box->y1 = MAXSHORT;
+ box->y2 = MINSHORT;
+ box->x1 = MAXSHORT;
+ box->x2 = MINSHORT;
+ for (; ntrap; ntrap--, traps++)
+ {
+ INT16 x1, y1, x2, y2;
+
+ if (!xTrapezoidValid(traps))
+ continue;
+ y1 = xFixedToInt (traps->top);
+ if (y1 < box->y1)
+ box->y1 = y1;
+
+ y2 = xFixedToInt (xFixedCeil (traps->bottom));
+ if (y2 > box->y2)
+ box->y2 = y2;
+
+ x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE),
+ miLineFixedX (&traps->left, traps->bottom, FALSE)));
+ if (x1 < box->x1)
+ box->x1 = x1;
+
+ x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE),
+ miLineFixedX (&traps->right, traps->bottom, TRUE))));
+ if (x2 > box->x2)
+ box->x2 = x2;
+ }
+}
diff --git a/xorg-server/render/mitri.c b/xorg-server/render/mitri.c
index 3e11cffd9..3ebb1a693 100644
--- a/xorg-server/render/mitri.c
+++ b/xorg-server/render/mitri.c
@@ -68,65 +68,6 @@ miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds)
}
void
-miTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntri,
- xTriangle *tris)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- /*
- * Check for solid alpha add
- */
- if (op == PictOpAdd && miIsSolidAlpha (pSrc))
- {
- (*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
- }
- else if (maskFormat)
- {
- BoxRec bounds;
- PicturePtr pPicture;
- INT16 xDst, yDst;
- INT16 xRel, yRel;
-
- xDst = tris[0].p1.x >> 16;
- yDst = tris[0].p1.y >> 16;
-
- miTriangleBounds (ntri, tris, &bounds);
- if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
- return;
- pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
- bounds.x2 - bounds.x1,
- bounds.y2 - bounds.y1);
- if (!pPicture)
- return;
- (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
-
- 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);
- }
- else
- {
- if (pDst->polyEdge == PolyEdgeSharp)
- maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
- else
- maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
-
- for (; ntri; ntri--, tris++)
- miTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
- }
-}
-
-void
miTriStrip (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,