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 /nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c | |
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.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c | 118 |
1 files changed, 1 insertions, 117 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, |