diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-04-08 09:38:20 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-06-25 00:39:26 +0200 |
commit | 500544f827c266f6a9c16d8669f62e54cdfd1f48 (patch) | |
tree | 07cbdf479944e98749fbeb7785e7cbd9f638cc09 | |
parent | 8fab4afbb997f444906c09cbf3e028ead8ca1e84 (diff) | |
download | nx-libs-500544f827c266f6a9c16d8669f62e54cdfd1f48.tar.gz nx-libs-500544f827c266f6a9c16d8669f62e54cdfd1f48.tar.bz2 nx-libs-500544f827c266f6a9c16d8669f62e54cdfd1f48.zip |
hw/nxagent/NXmitrap.c: Shrink file, drop duplicate code that can identically be found in render/mitrap.c.
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c | 118 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Render.h | 1 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/render/Imakefile | 23 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/render/mitrap.c | 2 |
4 files changed, 22 insertions, 122 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c b/nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c index f418654b4..1ef445af5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c @@ -39,117 +39,9 @@ * 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" -#endif - -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; - } -} +#include "../../render/mitrap.c" void miTrapezoids (CARD8 op, @@ -182,8 +74,6 @@ miTrapezoids (CARD8 op, xDst = traps[0].left.p1.x >> 16; yDst = traps[0].left.p1.y >> 16; - #ifdef NXAGENT_SERVER - if (nxagentTrapezoidExtents != NullBox) { memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec)); @@ -197,12 +87,6 @@ miTrapezoids (CARD8 op, memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec)); } - #else - - miTrapezoidBounds (ntrap, traps, &bounds); - - #endif - if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) return; pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.h b/nx-X11/programs/Xserver/hw/nxagent/Render.h index 70f0ef20f..08c719370 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.h @@ -19,6 +19,7 @@ #define __Render_H__ #include "screenint.h" +#include "cursor.h" #include "picture.h" #include "renderproto.h" diff --git a/nx-X11/programs/Xserver/render/Imakefile b/nx-X11/programs/Xserver/render/Imakefile index ff272ecbd..d6e2f4c40 100644 --- a/nx-X11/programs/Xserver/render/Imakefile +++ b/nx-X11/programs/Xserver/render/Imakefile @@ -1,6 +1,18 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 keithp Exp $ + +NULL = + #include <Server.tmpl> +#if (!(defined(NXAgentServer) && NXAgentServer)) +NXAGENT_SKIP_SRCS = \ + mitrap.c \ + $(NULL) +NXAGENT_SKIP_OBJS = \ + mitrap.o \ + $(NULL) +#endif + SRCS = animcur.c \ filter.c \ glyph.c \ @@ -9,11 +21,12 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 miindex.c \ mipict.c \ mirect.c \ - mitrap.c \ mitri.c \ picture.c \ render.c \ - renderedge.c + renderedge.c \ + $(NXAGENT_SKIP_SRCS) \ + $(NULL) OBJS = animcur.o \ filter.o \ @@ -23,11 +36,12 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 miindex.o \ mipict.o \ mirect.o \ - mitrap.o \ mitri.o \ picture.o \ render.o \ - renderedge.o + renderedge.o \ + $(NXAGENT_SKIP_OBJS) \ + $(NULL) INCLUDES = -I. -I../include -I../mi \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ @@ -46,4 +60,3 @@ InstallDriverSDKNonExecFile(glyphstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mipict.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(picture.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(picturestr.h,$(DRIVERSDKINCLUDEDIR)) - diff --git a/nx-X11/programs/Xserver/render/mitrap.c b/nx-X11/programs/Xserver/render/mitrap.c index be1712420..96f1159a4 100644 --- a/nx-X11/programs/Xserver/render/mitrap.c +++ b/nx-X11/programs/Xserver/render/mitrap.c @@ -128,6 +128,7 @@ miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box) } } +#ifndef NXAGENT_SERVER void miTrapezoids (CARD8 op, PicturePtr pSrc, @@ -188,3 +189,4 @@ miTrapezoids (CARD8 op, miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps); } } +#endif |