Commit 500544f8 authored by Mike Gabriel's avatar Mike Gabriel

hw/nxagent/NXmitrap.c: Shrink file, drop duplicate code that can identically be…

hw/nxagent/NXmitrap.c: Shrink file, drop duplicate code that can identically be found in render/mitrap.c.
parent 8fab4afb
...@@ -39,117 +39,9 @@ ...@@ -39,117 +39,9 @@
* PERFORMANCE OF THIS SOFTWARE. * 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"
#ifdef NXAGENT_SERVER
#include "Render.h" #include "Render.h"
#endif #include "../../render/mitrap.c"
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);
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 void
miTrapezoids (CARD8 op, miTrapezoids (CARD8 op,
...@@ -182,8 +74,6 @@ miTrapezoids (CARD8 op, ...@@ -182,8 +74,6 @@ miTrapezoids (CARD8 op,
xDst = traps[0].left.p1.x >> 16; xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16; yDst = traps[0].left.p1.y >> 16;
#ifdef NXAGENT_SERVER
if (nxagentTrapezoidExtents != NullBox) if (nxagentTrapezoidExtents != NullBox)
{ {
memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec)); memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec));
...@@ -197,12 +87,6 @@ miTrapezoids (CARD8 op, ...@@ -197,12 +87,6 @@ miTrapezoids (CARD8 op,
memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec)); memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec));
} }
#else
miTrapezoidBounds (ntrap, traps, &bounds);
#endif
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
return; return;
pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define __Render_H__ #define __Render_H__
#include "screenint.h" #include "screenint.h"
#include "cursor.h"
#include "picture.h" #include "picture.h"
#include "renderproto.h" #include "renderproto.h"
......
XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 keithp Exp $ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 keithp Exp $
NULL =
#include <Server.tmpl> #include <Server.tmpl>
#if (!(defined(NXAgentServer) && NXAgentServer))
NXAGENT_SKIP_SRCS = \
mitrap.c \
$(NULL)
NXAGENT_SKIP_OBJS = \
mitrap.o \
$(NULL)
#endif
SRCS = animcur.c \ SRCS = animcur.c \
filter.c \ filter.c \
glyph.c \ glyph.c \
...@@ -9,11 +21,12 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 ...@@ -9,11 +21,12 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15
miindex.c \ miindex.c \
mipict.c \ mipict.c \
mirect.c \ mirect.c \
mitrap.c \
mitri.c \ mitri.c \
picture.c \ picture.c \
render.c \ render.c \
renderedge.c renderedge.c \
$(NXAGENT_SKIP_SRCS) \
$(NULL)
OBJS = animcur.o \ OBJS = animcur.o \
filter.o \ filter.o \
...@@ -23,11 +36,12 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 ...@@ -23,11 +36,12 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15
miindex.o \ miindex.o \
mipict.o \ mipict.o \
mirect.o \ mirect.o \
mitrap.o \
mitri.o \ mitri.o \
picture.o \ picture.o \
render.o \ render.o \
renderedge.o renderedge.o \
$(NXAGENT_SKIP_OBJS) \
$(NULL)
INCLUDES = -I. -I../include -I../mi \ INCLUDES = -I. -I../include -I../mi \
-I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
...@@ -46,4 +60,3 @@ InstallDriverSDKNonExecFile(glyphstr.h,$(DRIVERSDKINCLUDEDIR)) ...@@ -46,4 +60,3 @@ InstallDriverSDKNonExecFile(glyphstr.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(mipict.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mipict.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(picture.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(picture.h,$(DRIVERSDKINCLUDEDIR))
InstallDriverSDKNonExecFile(picturestr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(picturestr.h,$(DRIVERSDKINCLUDEDIR))
...@@ -128,6 +128,7 @@ miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box) ...@@ -128,6 +128,7 @@ miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
} }
} }
#ifndef NXAGENT_SERVER
void void
miTrapezoids (CARD8 op, miTrapezoids (CARD8 op,
PicturePtr pSrc, PicturePtr pSrc,
...@@ -188,3 +189,4 @@ miTrapezoids (CARD8 op, ...@@ -188,3 +189,4 @@ miTrapezoids (CARD8 op,
miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps); miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
} }
} }
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment