diff options
Diffstat (limited to 'nx-X11/programs/Xserver/render')
19 files changed, 1182 insertions, 1382 deletions
diff --git a/nx-X11/programs/Xserver/render/Imakefile b/nx-X11/programs/Xserver/render/Imakefile index 0d7ad152f..235acf1ed 100644 --- a/nx-X11/programs/Xserver/render/Imakefile +++ b/nx-X11/programs/Xserver/render/Imakefile @@ -1,37 +1,58 @@ -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 = \ + glyph.c \ + mitrap.c \ + picture.c \ + render.c \ + $(NULL) +NXAGENT_SKIP_OBJS = \ + glyph.o \ + mitrap.o \ + picture.o \ + render.o \ + $(NULL) +#else + NX_DEFINES = -DNXAGENT_SERVER +#endif + SRCS = animcur.c \ filter.c \ glyph.c \ - miglyph.c \ + matrix.c \ 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 \ glyph.o \ - miglyph.o \ + matrix.o \ 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../../../include/fonts \ + INCLUDES = -I. -I../include -I../mi \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - -I$(FONTINCSRC) -I../Xext + -I../Xext \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln + DEFINES = \ + $(NX_DEFINES) \ + $(NULL) + NormalLibraryTarget(render,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(render,$(SRCS)) @@ -43,4 +64,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/animcur.c b/nx-X11/programs/Xserver/render/animcur.c index e3915b2b8..7336cdeff 100644 --- a/nx-X11/programs/Xserver/render/animcur.c +++ b/nx-X11/programs/Xserver/render/animcur.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/animcur.c,v 1.5tsi Exp $ - * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -36,8 +34,8 @@ #include <dix-config.h> #endif -#include <X11/X.h> -#include <X11/Xmd.h> +#include <nx-X11/X.h> +#include <nx-X11/Xmd.h> #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" @@ -95,7 +93,7 @@ int AnimCurGeneration; #define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) #define GetAnimCurScreen(s) ((AnimCurScreenPtr) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr)) #define GetAnimCurScreenIfSet(s) ((AnimCurScreenPrivateIndex != -1) ? GetAnimCurScreen(s) : NULL) -#define SetAnimCurScreen(s,p) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr = (pointer) (p)) +#define SetAnimCurScreen(s,p) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr = (void *) (p)) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) @@ -111,7 +109,7 @@ AnimCurSetCursorPosition (ScreenPtr pScreen, Bool generateEvent); static Bool -AnimCurCloseScreen (int index, ScreenPtr pScreen) +AnimCurCloseScreen (ScreenPtr pScreen) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; @@ -127,10 +125,10 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen) Unwrap(as, pScreen, UnrealizeCursor); Unwrap(as, pScreen, RecolorCursor); SetAnimCurScreen(pScreen,0); - ret = (*pScreen->CloseScreen) (index, pScreen); - xfree (as); - if (index == 0) - AnimCurScreenPrivateIndex = -1; + ret = (*pScreen->CloseScreen) (pScreen); + free (as); + if (screenInfo.numScreens <= 1) + AnimCurScreenPrivateIndex = -1; return ret; } @@ -164,9 +162,9 @@ AnimCurCursorLimits (ScreenPtr pScreen, static void AnimCurScreenBlockHandler (int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask) + void * blockData, + void * pTimeout, + void * pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; AnimCurScreenPtr as = GetAnimCurScreen(pScreen); @@ -334,7 +332,7 @@ AnimCurInit (ScreenPtr pScreen) animCurState.elt = 0; animCurState.time = 0; } - as = (AnimCurScreenPtr) xalloc (sizeof (AnimCurScreenRec)); + as = (AnimCurScreenPtr) malloc (sizeof (AnimCurScreenRec)); if (!as) return FALSE; Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); @@ -366,7 +364,7 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp if (IsAnimCur (cursors[i])) return BadMatch; - pCursor = (CursorPtr) xalloc (sizeof (CursorRec) + + pCursor = (CursorPtr) malloc (sizeof (CursorRec) + sizeof (AnimCurRec) + ncursor * sizeof (AnimCurElt)); if (!pCursor) diff --git a/nx-X11/programs/Xserver/render/filter.c b/nx-X11/programs/Xserver/render/filter.c index 919d599f2..71b893a75 100644 --- a/nx-X11/programs/Xserver/render/filter.c +++ b/nx-X11/programs/Xserver/render/filter.c @@ -62,18 +62,18 @@ PictureGetFilterId (char *filter, int len, Bool makeit) return i; if (!makeit) return -1; - name = xalloc (len + 1); + name = malloc (len + 1); if (!name) return -1; memcpy (name, filter, len); name[len] = '\0'; if (filterNames) - names = xrealloc (filterNames, (nfilterNames + 1) * sizeof (char *)); + names = realloc (filterNames, (nfilterNames + 1) * sizeof (char *)); else - names = xalloc (sizeof (char *)); + names = malloc (sizeof (char *)); if (!names) { - xfree (name); + free (name); return -1; } filterNames = names; @@ -119,8 +119,8 @@ PictureFreeFilterIds (void) int i; for (i = 0; i < nfilterNames; i++) - xfree (filterNames[i]); - xfree (filterNames); + free (filterNames[i]); + free (filterNames); nfilterNames = 0; filterNames = 0; } @@ -144,9 +144,9 @@ PictureAddFilter (ScreenPtr pScreen, if (ps->filters[i].id == id) return -1; if (ps->filters) - filters = xrealloc (ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec)); + filters = realloc (ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec)); else - filters = xalloc (sizeof (PictFilterRec)); + filters = malloc (sizeof (PictFilterRec)); if (!filters) return -1; ps->filters = filters; @@ -175,11 +175,11 @@ PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias) PictFilterAliasPtr aliases; if (ps->filterAliases) - aliases = xrealloc (ps->filterAliases, + aliases = realloc (ps->filterAliases, (ps->nfilterAliases + 1) * sizeof (PictFilterAliasRec)); else - aliases = xalloc (sizeof (PictFilterAliasRec)); + aliases = malloc (sizeof (PictFilterAliasRec)); if (!aliases) return FALSE; ps->filterAliases = aliases; @@ -215,21 +215,30 @@ PictureFindFilter (ScreenPtr pScreen, char *name, int len) } static Bool -convolutionFilterValidateParams (PicturePtr pPicture, +convolutionFilterValidateParams (ScreenPtr pScreen, int filter, xFixed *params, - int nparams) + int nparams, + int* width, + int* height) { + int w, h; + if (nparams < 3) return FALSE; if (xFixedFrac (params[0]) || xFixedFrac (params[1])) return FALSE; + w = xFixedToInt (params[0]); + h = xFixedToInt (params[1]); + nparams -= 2; - if ((xFixedToInt (params[0]) * xFixedToInt (params[1])) > nparams) + if (w * h > nparams) return FALSE; + *width = w; + *height = h; return TRUE; } @@ -263,41 +272,93 @@ PictureResetFilters (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); - xfree (ps->filters); - xfree (ps->filterAliases); + free (ps->filters); + free (ps->filterAliases); PictureFreeFilterIds (); } int SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams) { - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - PictFilterPtr pFilter = PictureFindFilter (pScreen, name, len); - xFixed *new_params; - int i; + PictFilterPtr pFilter; + ScreenPtr pScreen; + + if (pPicture->pDrawable) { + pScreen = pPicture->pDrawable->pScreen; + } + else { + pScreen = screenInfo.screens[0]; + } + + pFilter = PictureFindFilter (pScreen, name, len); if (!pFilter) - return BadName; - if (pFilter->ValidateParams) - { - if (!(*pFilter->ValidateParams) (pPicture, pFilter->id, params, nparams)) - return BadMatch; + return BadName; + + if (pPicture->pDrawable == NULL) { + int s; + + /* For source pictures, the picture isn't tied to a screen. So, ensure + * that all screens can handle a filter we set for the picture. + */ + for (s = 1; s < screenInfo.numScreens; s++) { + PictFilterPtr pScreenFilter; + + pScreenFilter = PictureFindFilter(screenInfo.screens[s], name, len); + if (!pScreenFilter || pScreenFilter->id != pFilter->id) + return BadMatch; + } } - else if (nparams) - return BadMatch; - if (nparams != pPicture->filter_nparams) - { - new_params = xalloc (nparams * sizeof (xFixed)); - if (!new_params) - return BadAlloc; - xfree (pPicture->filter_params); - pPicture->filter_params = new_params; - pPicture->filter_nparams = nparams; + return SetPicturePictFilter (pPicture, pFilter, params, nparams); +} + +int +SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter, + xFixed *params, int nparams) +{ + ScreenPtr pScreen; + int i; + + if (pPicture->pDrawable) + pScreen = pPicture->pDrawable->pScreen; + else + pScreen = screenInfo.screens[0]; + + if (pFilter->ValidateParams) { + int width, height; + + if (!(*pFilter->ValidateParams) (pScreen, pFilter->id, params, nparams, &width, &height)) + return BadMatch; + } + else if (nparams) { + return BadMatch; + } + + if (nparams != pPicture->filter_nparams) { + xFixed *new_params = malloc (nparams * sizeof (xFixed)); + + if (!new_params && nparams) + return BadAlloc; + free (pPicture->filter_params); + pPicture->filter_params = new_params; + pPicture->filter_nparams = nparams; } for (i = 0; i < nparams; i++) - pPicture->filter_params[i] = params[i]; + pPicture->filter_params[i] = params[i]; pPicture->filter = pFilter->id; + + if (pPicture->pDrawable) + { + PictureScreenPtr ps = GetPictureScreen(pScreen); + int result; + + result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter, + params, nparams); + + return result; + } pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; + return Success; } diff --git a/nx-X11/programs/Xserver/render/glyph.c b/nx-X11/programs/Xserver/render/glyph.c index 9f4d1c87b..9c9a485ea 100644 --- a/nx-X11/programs/Xserver/render/glyph.c +++ b/nx-X11/programs/Xserver/render/glyph.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.5 2001/01/30 07:01:22 keithp Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -42,12 +40,9 @@ #include "servermd.h" #include "picturestr.h" #include "glyphstr.h" +#include "mipict.h" -#if HAVE_STDINT_H #include <stdint.h> -#elif !defined(UINT32_MAX) -#define UINT32_MAX 0xffffffffU -#endif /* * From Knuth -- a good choice for hash/rehash values is p, p-2 where @@ -114,30 +109,30 @@ ResetGlyphSetPrivateIndex (void) } Bool -_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr) +_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, void * ptr) { - pointer *new; + void **new; if (n > glyphSet->maxPrivate) { if (glyphSet->devPrivates && - glyphSet->devPrivates != (pointer)(&glyphSet[1])) { - new = (pointer *) xrealloc (glyphSet->devPrivates, - (n + 1) * sizeof (pointer)); + glyphSet->devPrivates != (void *)(&glyphSet[1])) { + new = (void **) realloc (glyphSet->devPrivates, + (n + 1) * sizeof (void *)); if (!new) return FALSE; } else { - new = (pointer *) xalloc ((n + 1) * sizeof (pointer)); + new = (void **) malloc ((n + 1) * sizeof (void *)); if (!new) return FALSE; if (glyphSet->devPrivates) memcpy (new, glyphSet->devPrivates, - (glyphSet->maxPrivate + 1) * sizeof (pointer)); + (glyphSet->maxPrivate + 1) * sizeof (void *)); } glyphSet->devPrivates = new; /* Zero out new, uninitialize privates */ while (++glyphSet->maxPrivate < n) - glyphSet->devPrivates[glyphSet->maxPrivate] = (pointer)0; + glyphSet->devPrivates[glyphSet->maxPrivate] = (void *)0; } glyphSet->devPrivates[n] = ptr; return TRUE; @@ -268,10 +263,11 @@ FreeGlyph (GlyphPtr glyph, int format) gr->signature = 0; globalGlyphs[format].tableEntries--; } - xfree (glyph); + free (glyph); } } +#ifndef NXAGENT_SERVER void AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) { @@ -284,7 +280,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) gr = FindGlyphRef (&globalGlyphs[glyphSet->fdepth], hash, TRUE, glyph); if (gr->glyph && gr->glyph != DeletedGlyph) { - xfree (glyph); + free (glyph); glyph = gr->glyph; } else @@ -305,6 +301,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) gr->signature = id; CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom"); } +#endif /* NXAGENT_SERVER */ Bool DeleteGlyph (GlyphSetPtr glyphSet, Glyph id) @@ -324,6 +321,7 @@ DeleteGlyph (GlyphSetPtr glyphSet, Glyph id) return FALSE; } +#ifndef NXAGENT_SERVER GlyphPtr FindGlyph (GlyphSetPtr glyphSet, Glyph id) { @@ -334,6 +332,7 @@ FindGlyph (GlyphSetPtr glyphSet, Glyph id) glyph = 0; return glyph; } +#endif /* NXAGENT_SERVER */ GlyphPtr AllocateGlyph (xGlyphInfo *gi, int fdepth) @@ -346,7 +345,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth) if (gi->height && padded_width > (UINT32_MAX - sizeof(GlyphRec))/gi->height) return 0; size = gi->height * padded_width; - glyph = (GlyphPtr) xalloc (size + sizeof (GlyphRec)); + glyph = (GlyphPtr) malloc (size + sizeof (GlyphRec)); if (!glyph) return 0; glyph->refcnt = 0; @@ -358,7 +357,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth) Bool AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet) { - hash->table = (GlyphRefPtr) xalloc (hashSet->size * sizeof (GlyphRefRec)); + hash->table = (GlyphRefPtr) malloc (hashSet->size * sizeof (GlyphRefRec)); if (!hash->table) return FALSE; memset (hash->table, 0, hashSet->size * sizeof (GlyphRefRec)); @@ -367,6 +366,8 @@ AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet) return TRUE; } + +#ifndef NXAGENT_SERVER Bool ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global) { @@ -402,13 +403,14 @@ ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global) ++newHash.tableEntries; } } - xfree (hash->table); + free (hash->table); } *hash = newHash; if (global) CheckDuplicates (hash, "ResizeGlyphHash bottom"); return TRUE; } +#endif /* NXAGENT_SERVER */ Bool ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change) @@ -430,18 +432,18 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format) } size = (sizeof (GlyphSetRec) + - (sizeof (pointer) * _GlyphSetPrivateAllocateIndex)); - glyphSet = xalloc (size); + (sizeof (void *) * _GlyphSetPrivateAllocateIndex)); + glyphSet = malloc (size); if (!glyphSet) return FALSE; bzero((char *)glyphSet, size); glyphSet->maxPrivate = _GlyphSetPrivateAllocateIndex - 1; if (_GlyphSetPrivateAllocateIndex) - glyphSet->devPrivates = (pointer)(&glyphSet[1]); + glyphSet->devPrivates = (void *)(&glyphSet[1]); if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0])) { - xfree (glyphSet); + free (glyphSet); return FALSE; } glyphSet->refcnt = 1; @@ -451,7 +453,7 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format) } int -FreeGlyphSet (pointer value, +FreeGlyphSet (void *value, XID gid) { GlyphSetPtr glyphSet = (GlyphSetPtr) value; @@ -470,19 +472,225 @@ FreeGlyphSet (pointer value, } if (!globalGlyphs[glyphSet->fdepth].tableEntries) { - xfree (globalGlyphs[glyphSet->fdepth].table); + free (globalGlyphs[glyphSet->fdepth].table); globalGlyphs[glyphSet->fdepth].table = 0; globalGlyphs[glyphSet->fdepth].hashSet = 0; } else ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE); - xfree (table); + free (table); if (glyphSet->devPrivates && - glyphSet->devPrivates != (pointer)(&glyphSet[1])) - xfree(glyphSet->devPrivates); + glyphSet->devPrivates != (void *)(&glyphSet[1])) + free(glyphSet->devPrivates); - xfree (glyphSet); + free (glyphSet); } return Success; } + +void +GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents) +{ + int x1, x2, y1, y2; + int n; + GlyphPtr glyph; + int x, y; + + x = 0; + y = 0; + extents->x1 = MAXSHORT; + extents->x2 = MINSHORT; + extents->y1 = MAXSHORT; + extents->y2 = MINSHORT; + while (nlist--) { + x += list->xOff; + y += list->yOff; + n = list->len; + list++; + while (n--) { + glyph = *glyphs++; + x1 = x - glyph->info.x; + if (x1 < MINSHORT) + x1 = MINSHORT; + y1 = y - glyph->info.y; + if (y1 < MINSHORT) + y1 = MINSHORT; + x2 = x1 + glyph->info.width; + if (x2 > MAXSHORT) + x2 = MAXSHORT; + y2 = y1 + glyph->info.height; + if (y2 > MAXSHORT) + y2 = MAXSHORT; + if (x1 < extents->x1) + extents->x1 = x1; + if (x2 > extents->x2) + extents->x2 = x2; + if (y1 < extents->y1) + extents->y1 = y1; + if (y2 > extents->y2) + extents->y2 = y2; + x += glyph->info.xOff; + y += glyph->info.yOff; + } + } +} + +#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) + +void +CompositeGlyphs(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs) +{ + PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); + + ValidatePicture(pSrc); + ValidatePicture(pDst); + (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, + glyphs); +} + +#ifndef NXAGENT_SERVER +void +miGlyphs(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) +{ + PixmapPtr pPixmap = 0; + PicturePtr pPicture; + PixmapPtr pMaskPixmap = 0; + PicturePtr pMask; + ScreenPtr pScreen = pDst->pDrawable->pScreen; + int width = 0, height = 0; + int x, y; + int xDst = list->xOff, yDst = list->yOff; + int n; + GlyphPtr glyph; + int error; + BoxRec extents; + CARD32 component_alpha; + + if (maskFormat) { + GCPtr pGC; + xRectangle rect; + + GlyphExtents(nlist, list, glyphs, &extents); + + if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) + return; + width = extents.x2 - extents.x1; + height = extents.y2 - extents.y1; + pMaskPixmap = + (*pScreen->CreatePixmap) (pScreen, width, height, + maskFormat->depth); + if (!pMaskPixmap) + return; + component_alpha = NeedsComponent(maskFormat->format); + pMask = CreatePicture(0, &pMaskPixmap->drawable, + maskFormat, CPComponentAlpha, &component_alpha, + serverClient, &error); + if (!pMask) { + (*pScreen->DestroyPixmap) (pMaskPixmap); + return; + } + pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen); + ValidateGC(&pMaskPixmap->drawable, pGC); + rect.x = 0; + rect.y = 0; + rect.width = width; + rect.height = height; + (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect); + FreeScratchGC(pGC); + x = -extents.x1; + y = -extents.y1; + } + else { + pMask = pDst; + x = 0; + y = 0; + } + pPicture = 0; + while (nlist--) { + x += list->xOff; + y += list->yOff; + n = list->len; + while (n--) { + glyph = *glyphs++; + if (!pPicture) { + pPixmap = + GetScratchPixmapHeader(pScreen, glyph->info.width, + glyph->info.height, + list->format->depth, + list->format->depth, 0, + (void *) (glyph + 1)); + if (!pPixmap) + return; + component_alpha = NeedsComponent(list->format->format); + pPicture = CreatePicture(0, &pPixmap->drawable, list->format, + CPComponentAlpha, &component_alpha, + serverClient, &error); + if (!pPicture) { + FreeScratchPixmapHeader(pPixmap); + return; + } + } + (*pScreen->ModifyPixmapHeader) (pPixmap, + glyph->info.width, + glyph->info.height, 0, 0, -1, + (void *) (glyph + 1)); + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + if (maskFormat) { + CompositePicture(PictOpAdd, + pPicture, + None, + pMask, + 0, 0, + 0, 0, + x - glyph->info.x, + y - glyph->info.y, + glyph->info.width, glyph->info.height); + } + else { + CompositePicture(op, + pSrc, + pPicture, + pDst, + xSrc + (x - glyph->info.x) - xDst, + ySrc + (y - glyph->info.y) - yDst, + 0, 0, + x - glyph->info.x, + y - glyph->info.y, + glyph->info.width, glyph->info.height); + } + x += glyph->info.xOff; + y += glyph->info.yOff; + } + list++; + if (pPicture) { + FreeScratchPixmapHeader(pPixmap); + FreePicture((void *) pPicture, 0); + pPicture = 0; + pPixmap = 0; + } + } + if (maskFormat) { + x = extents.x1; + y = extents.y1; + CompositePicture(op, + pSrc, + pMask, + pDst, + xSrc + x - xDst, + ySrc + y - yDst, 0, 0, x, y, width, height); + FreePicture((void *) pMask, (XID) 0); + (*pScreen->DestroyPixmap) (pMaskPixmap); + } +} +#endif diff --git a/nx-X11/programs/Xserver/render/glyphstr.h b/nx-X11/programs/Xserver/render/glyphstr.h index f4777a248..5c4ed4933 100644 --- a/nx-X11/programs/Xserver/render/glyphstr.h +++ b/nx-X11/programs/Xserver/render/glyphstr.h @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3 2000/11/20 07:13:13 keithp Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -26,7 +24,7 @@ #ifndef _GLYPHSTR_H_ #define _GLYPHSTR_H_ -#include <X11/extensions/renderproto.h> +#include <nx-X11/extensions/renderproto.h> #include "picture.h" #include "screenint.h" @@ -44,10 +42,14 @@ typedef struct _Glyph { /* bits follow */ } GlyphRec, *GlyphPtr; +#ifdef NXAGENT_SERVER +#include "../hw/nxagent/NXglyphstr_GlyphRef.h" +#else typedef struct _GlyphRef { CARD32 signature; GlyphPtr glyph; } GlyphRefRec, *GlyphRefPtr; +#endif /* NXAGENT_SERVER */ #define DeletedGlyph ((GlyphPtr) 1) @@ -63,18 +65,22 @@ typedef struct _GlyphHash { CARD32 tableEntries; } GlyphHashRec, *GlyphHashPtr; +#ifdef NXAGENT_SERVER +#include "../hw/nxagent/NXglyphstr_GlyphSet.h" +#else typedef struct _GlyphSet { CARD32 refcnt; PictFormatPtr format; int fdepth; GlyphHashRec hash; int maxPrivate; - pointer *devPrivates; + void **devPrivates; } GlyphSetRec, *GlyphSetPtr; +#endif /* NXAGENT_SERVER */ #define GlyphSetGetPrivate(pGlyphSet,n) \ ((n) > (pGlyphSet)->maxPrivate ? \ - (pointer) 0 : \ + (void *) 0 : \ (pGlyphSet)->devPrivates[n]) #define GlyphSetSetPrivate(pGlyphSet,n,ptr) \ @@ -101,7 +107,7 @@ void ResetGlyphSetPrivateIndex (void); Bool -_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr); +_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, void * ptr); Bool GlyphInit (ScreenPtr pScreen); @@ -140,7 +146,7 @@ GlyphSetPtr AllocateGlyphSet (int fdepth, PictFormatPtr format); int -FreeGlyphSet (pointer value, +FreeGlyphSet (void *value, XID gid); diff --git a/nx-X11/programs/Xserver/render/matrix.c b/nx-X11/programs/Xserver/render/matrix.c new file mode 100644 index 000000000..83cd66c43 --- /dev/null +++ b/nx-X11/programs/Xserver/render/matrix.c @@ -0,0 +1,86 @@ +/* + * Copyright © 2007 Keith Packard + * + * 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 the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS 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 "misc.h" +#include "scrnintstr.h" +#include "os.h" +#include "regionstr.h" +#include "validate.h" +#include "windowstr.h" +#include "input.h" +#include "resource.h" +#include "colormapst.h" +#include "cursorstr.h" +#include "dixstruct.h" +#include "gcstruct.h" +#include "servermd.h" +#include "picturestr.h" + +void +PictTransform_from_xRenderTransform(PictTransformPtr pict, + xRenderTransform * render) +{ + pict->matrix[0][0] = render->matrix11; + pict->matrix[0][1] = render->matrix12; + pict->matrix[0][2] = render->matrix13; + + pict->matrix[1][0] = render->matrix21; + pict->matrix[1][1] = render->matrix22; + pict->matrix[1][2] = render->matrix23; + + pict->matrix[2][0] = render->matrix31; + pict->matrix[2][1] = render->matrix32; + pict->matrix[2][2] = render->matrix33; +} + +void +xRenderTransform_from_PictTransform(xRenderTransform * render, + PictTransformPtr pict) +{ + render->matrix11 = pict->matrix[0][0]; + render->matrix12 = pict->matrix[0][1]; + render->matrix13 = pict->matrix[0][2]; + + render->matrix21 = pict->matrix[1][0]; + render->matrix22 = pict->matrix[1][1]; + render->matrix23 = pict->matrix[1][2]; + + render->matrix31 = pict->matrix[2][0]; + render->matrix32 = pict->matrix[2][1]; + render->matrix33 = pict->matrix[2][2]; +} + +Bool +PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector) +{ + return pixman_transform_point(transform, vector); +} + +Bool +PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector) +{ + return pixman_transform_point_3d(transform, vector); +} diff --git a/nx-X11/programs/Xserver/render/miglyph.c b/nx-X11/programs/Xserver/render/miglyph.c deleted file mode 100644 index 237ec13a4..000000000 --- a/nx-X11/programs/Xserver/render/miglyph.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.4 2000/11/20 07:13:13 keithp Exp $ - * - * 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. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "scrnintstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "mi.h" -#include "picturestr.h" -#include "mipict.h" - -void -miGlyphExtents (int nlist, - GlyphListPtr list, - GlyphPtr *glyphs, - BoxPtr extents) -{ - int x1, x2, y1, y2; - int n; - GlyphPtr glyph; - int x, y; - - x = 0; - y = 0; - extents->x1 = MAXSHORT; - extents->x2 = MINSHORT; - extents->y1 = MAXSHORT; - extents->y2 = MINSHORT; - while (nlist--) - { - x += list->xOff; - y += list->yOff; - n = list->len; - list++; - while (n--) - { - glyph = *glyphs++; - x1 = x - glyph->info.x; - if (x1 < MINSHORT) - x1 = MINSHORT; - y1 = y - glyph->info.y; - if (y1 < MINSHORT) - y1 = MINSHORT; - x2 = x1 + glyph->info.width; - if (x2 > MAXSHORT) - x2 = MAXSHORT; - y2 = y1 + glyph->info.height; - if (y2 > MAXSHORT) - y2 = MAXSHORT; - if (x1 < extents->x1) - extents->x1 = x1; - if (x2 > extents->x2) - extents->x2 = x2; - if (y1 < extents->y1) - extents->y1 = y1; - if (y2 > extents->y2) - extents->y2 = y2; - x += glyph->info.xOff; - y += glyph->info.yOff; - } - } -} - -#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) - -void -miGlyphs (CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, - int nlist, - GlyphListPtr list, - GlyphPtr *glyphs) -{ - PixmapPtr pPixmap = 0; - PicturePtr pPicture; - PixmapPtr pMaskPixmap = 0; - PicturePtr pMask; - ScreenPtr pScreen = pDst->pDrawable->pScreen; - int width = 0, height = 0; - int x, y; - int xDst = list->xOff, yDst = list->yOff; - int n; - GlyphPtr glyph; - int error; - BoxRec extents; - CARD32 component_alpha; - - if (maskFormat) - { - GCPtr pGC; - xRectangle rect; - - miGlyphExtents (nlist, list, glyphs, &extents); - - if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) - return; - width = extents.x2 - extents.x1; - height = extents.y2 - extents.y1; - pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth); - if (!pMaskPixmap) - return; - component_alpha = NeedsComponent(maskFormat->format); - pMask = CreatePicture (0, &pMaskPixmap->drawable, - maskFormat, CPComponentAlpha, &component_alpha, - serverClient, &error); - if (!pMask) - { - (*pScreen->DestroyPixmap) (pMaskPixmap); - return; - } - pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen); - ValidateGC (&pMaskPixmap->drawable, pGC); - rect.x = 0; - rect.y = 0; - rect.width = width; - rect.height = height; - (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect); - FreeScratchGC (pGC); - x = -extents.x1; - y = -extents.y1; - } - else - { - pMask = pDst; - x = 0; - y = 0; - } - pPicture = 0; - while (nlist--) - { - x += list->xOff; - y += list->yOff; - n = list->len; - while (n--) - { - glyph = *glyphs++; - if (!pPicture) - { - pPixmap = GetScratchPixmapHeader (pScreen, glyph->info.width, glyph->info.height, - list->format->depth, - list->format->depth, - 0, (pointer) (glyph + 1)); - if (!pPixmap) - return; - component_alpha = NeedsComponent(list->format->format); - pPicture = CreatePicture (0, &pPixmap->drawable, list->format, - CPComponentAlpha, &component_alpha, - serverClient, &error); - if (!pPicture) - { - FreeScratchPixmapHeader (pPixmap); - return; - } - } - (*pScreen->ModifyPixmapHeader) (pPixmap, - glyph->info.width, glyph->info.height, - 0, 0, -1, (pointer) (glyph + 1)); - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - if (maskFormat) - { - CompositePicture (PictOpAdd, - pPicture, - None, - pMask, - 0, 0, - 0, 0, - x - glyph->info.x, - y - glyph->info.y, - glyph->info.width, - glyph->info.height); - } - else - { - CompositePicture (op, - pSrc, - pPicture, - pDst, - xSrc + (x - glyph->info.x) - xDst, - ySrc + (y - glyph->info.y) - yDst, - 0, 0, - x - glyph->info.x, - y - glyph->info.y, - glyph->info.width, - glyph->info.height); - } - x += glyph->info.xOff; - y += glyph->info.yOff; - } - list++; - if (pPicture) - { - FreeScratchPixmapHeader (pPixmap); - FreePicture ((pointer) pPicture, 0); - pPicture = 0; - pPixmap = 0; - } - } - if (maskFormat) - { - x = extents.x1; - y = extents.y1; - CompositePicture (op, - pSrc, - pMask, - pDst, - xSrc + x - xDst, - ySrc + y - yDst, - 0, 0, - x, y, - width, height); - FreePicture ((pointer) pMask, (XID) 0); - (*pScreen->DestroyPixmap) (pMaskPixmap); - } -} diff --git a/nx-X11/programs/Xserver/render/miindex.c b/nx-X11/programs/Xserver/render/miindex.c index 03e2857a2..5b5f35b19 100644 --- a/nx-X11/programs/Xserver/render/miindex.c +++ b/nx-X11/programs/Xserver/render/miindex.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/miindex.c,v 1.7 2002/11/05 06:05:04 keithp Exp $ - * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -259,15 +257,15 @@ miInitIndexed (ScreenPtr pScreen, pixels[p] = p; } - pIndexed = xalloc (sizeof (miIndexedRec)); + pIndexed = malloc (sizeof (miIndexedRec)); if (!pIndexed) return FALSE; pFormat->index.nvalues = num; - pFormat->index.pValues = xalloc (num * sizeof (xIndexValue)); + pFormat->index.pValues = malloc (num * sizeof (xIndexValue)); if (!pFormat->index.pValues) { - xfree (pIndexed); + free (pIndexed); return FALSE; } @@ -323,12 +321,12 @@ miCloseIndexed (ScreenPtr pScreen, { if (pFormat->index.devPrivate) { - xfree (pFormat->index.devPrivate); + free (pFormat->index.devPrivate); pFormat->index.devPrivate = 0; } if (pFormat->index.pValues) { - xfree (pFormat->index.pValues); + free (pFormat->index.pValues); pFormat->index.pValues = 0; } } diff --git a/nx-X11/programs/Xserver/render/mipict.c b/nx-X11/programs/Xserver/render/mipict.c index 81c775832..9b8f0cfda 100644 --- a/nx-X11/programs/Xserver/render/mipict.c +++ b/nx-X11/programs/Xserver/render/mipict.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.15tsi Exp $ - * * Copyright © 1999 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -48,7 +46,7 @@ void miDestroyPicture (PicturePtr pPicture) { if (pPicture->freeCompClip) - REGION_DESTROY(pPicture->pDrawable->pScreen, pPicture->pCompositeClip); + RegionDestroy(pPicture->pCompositeClip); } void @@ -65,7 +63,7 @@ miDestroyPictureClip (PicturePtr pPicture) * we know we'll never have a list of rectangles, since ChangeClip * immediately turns them into a region */ - REGION_DESTROY(pPicture->pDrawable->pScreen, pPicture->clientClip); + RegionDestroy(pPicture->clientClip); break; } pPicture->clientClip = NULL; @@ -75,18 +73,18 @@ miDestroyPictureClip (PicturePtr pPicture) int miChangePictureClip (PicturePtr pPicture, int type, - pointer value, + void * value, int n) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); - pointer clientClip; + void * clientClip; int clientClipType; switch (type) { case CT_PIXMAP: /* convert the pixmap to a region */ - clientClip = (pointer) BITMAP_TO_REGION(pScreen, (PixmapPtr) value); + clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; @@ -101,13 +99,13 @@ miChangePictureClip (PicturePtr pPicture, clientClipType = CT_NONE; break; default: - clientClip = (pointer) RECTS_TO_REGION(pScreen, n, + clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; - xfree(value); + free(value); break; } (*ps->DestroyPictureClip) (pPicture); @@ -129,7 +127,6 @@ miValidatePicture (PicturePtr pPicture, Mask mask) { DrawablePtr pDrawable = pPicture->pDrawable; - ScreenPtr pScreen = pDrawable->pScreen; if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) || (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) @@ -162,7 +159,7 @@ miValidatePicture (PicturePtr pPicture, if (pPicture->clientClipType == CT_NONE) { if (freeCompClip) - REGION_DESTROY(pScreen, pPicture->pCompositeClip); + RegionDestroy(pPicture->pCompositeClip); pPicture->pCompositeClip = pregWin; pPicture->freeCompClip = freeTmpClip; } @@ -177,30 +174,30 @@ miValidatePicture (PicturePtr pPicture, * clip. if neither is real, create a new region. */ - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); if (freeCompClip) { - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); if (freeTmpClip) - REGION_DESTROY(pScreen, pregWin); + RegionDestroy(pregWin); } else if (freeTmpClip) { - REGION_INTERSECT(pScreen, pregWin, pregWin, pPicture->clientClip); + RegionIntersect(pregWin, pregWin, pPicture->clientClip); pPicture->pCompositeClip = pregWin; } else { - pPicture->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0); - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + pPicture->pCompositeClip = RegionCreate(NullBox, 0); + RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); } pPicture->freeCompClip = TRUE; - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } @@ -218,31 +215,31 @@ miValidatePicture (PicturePtr pPicture, if (pPicture->freeCompClip) { - REGION_RESET(pScreen, pPicture->pCompositeClip, &pixbounds); + RegionReset(pPicture->pCompositeClip, &pixbounds); } else { pPicture->freeCompClip = TRUE; - pPicture->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1); + pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); } if (pPicture->clientClipType == CT_REGION) { if(pDrawable->x || pDrawable->y) { - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } else { - REGION_TRANSLATE(pScreen, pPicture->pCompositeClip, + RegionTranslate(pPicture->pCompositeClip, -pPicture->clipOrigin.x, -pPicture->clipOrigin.y); - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); - REGION_TRANSLATE(pScreen, pPicture->pCompositeClip, + RegionTranslate(pPicture->pCompositeClip, pPicture->clipOrigin.x, pPicture->clipOrigin.y); } } @@ -250,6 +247,22 @@ miValidatePicture (PicturePtr pPicture, } } +int +miChangePictureTransform (PicturePtr pPicture, + PictTransform *transform) +{ + return Success; +} + +int +miChangePictureFilter (PicturePtr pPicture, + int filter, + xFixed *params, + int nparams) +{ + return Success; +} + #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) static __inline Bool @@ -258,11 +271,11 @@ miClipPictureReg (RegionPtr pRegion, int dx, int dy) { - if (REGION_NUM_RECTS(pRegion) == 1 && - REGION_NUM_RECTS(pClip) == 1) + if (RegionNumRects(pRegion) == 1 && + RegionNumRects(pClip) == 1) { - BoxPtr pRbox = REGION_RECTS(pRegion); - BoxPtr pCbox = REGION_RECTS(pClip); + BoxPtr pRbox = RegionRects(pRegion); + BoxPtr pCbox = RegionRects(pClip); int v; if (pRbox->x1 < (v = pCbox->x1 + dx)) @@ -276,21 +289,21 @@ miClipPictureReg (RegionPtr pRegion, if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) { - REGION_EMPTY(pScreen, pRegion); + RegionEmpty(pRegion); } } - else if (!REGION_NOTEMPTY (pScreen, pClip)) + else if (!RegionNotEmpty(pClip)) return FALSE; else { if (dx || dy) - REGION_TRANSLATE(pScreen, pRegion, -dx, -dy); - if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip)) + RegionTranslate(pRegion, -dx, -dy); + if (!RegionIntersect(pRegion, pRegion, pClip)) return FALSE; if (dx || dy) - REGION_TRANSLATE(pScreen, pRegion, dx, dy); + RegionTranslate(pRegion, dx, dy); } - return REGION_NOTEMPTY(pScreen, pRegion); + return RegionNotEmpty(pRegion); } static __inline Bool @@ -306,13 +319,13 @@ miClipPictureSrc (RegionPtr pRegion, { if (pPicture->clientClipType != CT_NONE) { - REGION_TRANSLATE(pScreen, pRegion, + RegionTranslate(pRegion, dx - pPicture->clipOrigin.x, dy - pPicture->clipOrigin.y); - if (!REGION_INTERSECT (pScreen, pRegion, pRegion, + if (!RegionIntersect(pRegion, pRegion, (RegionPtr) pPicture->clientClip)) return FALSE; - REGION_TRANSLATE(pScreen, pRegion, + RegionTranslate(pRegion, - (dx - pPicture->clipOrigin.x), - (dy - pPicture->clipOrigin.y)); } @@ -416,13 +429,13 @@ miComputeCompositeRegion (RegionPtr pRegion, if (pRegion->extents.x1 >= pRegion->extents.x2 || pRegion->extents.y1 >= pRegion->extents.y2) { - REGION_EMPTY (pDst->pDrawable->pScreen, pRegion); + RegionEmpty(pRegion); return FALSE; } /* clip against dst */ if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } if (pDst->alphaMap) @@ -431,14 +444,14 @@ miComputeCompositeRegion (RegionPtr pRegion, -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } } /* clip against src */ if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } if (pSrc->alphaMap) @@ -447,7 +460,7 @@ miComputeCompositeRegion (RegionPtr pRegion, xDst - (xSrc + pSrc->alphaOrigin.x), yDst - (ySrc + pSrc->alphaOrigin.y))) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } } @@ -456,7 +469,7 @@ miComputeCompositeRegion (RegionPtr pRegion, { if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } if (pMask->alphaMap) @@ -465,7 +478,7 @@ miComputeCompositeRegion (RegionPtr pRegion, xDst - (xMask + pMask->alphaOrigin.x), yDst - (yMask + pMask->alphaOrigin.y))) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } } @@ -611,6 +624,8 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) ps->InitIndexed = miInitIndexed; ps->CloseIndexed = miCloseIndexed; ps->UpdateIndexed = miUpdateIndexed; + ps->ChangePictureTransform = miChangePictureTransform; + ps->ChangePictureFilter = miChangePictureFilter; /* MI rendering routines */ ps->Composite = 0; /* requires DDX support */ diff --git a/nx-X11/programs/Xserver/render/mipict.h b/nx-X11/programs/Xserver/render/mipict.h index e6e8b70fa..6a6554033 100644 --- a/nx-X11/programs/Xserver/render/mipict.h +++ b/nx-X11/programs/Xserver/render/mipict.h @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.12 2002/11/05 05:34:40 keithp Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -60,7 +58,7 @@ miDestroyPictureClip (PicturePtr pPicture); int miChangePictureClip (PicturePtr pPicture, int type, - pointer value, + void * value, int n); void @@ -71,6 +69,15 @@ void miValidatePicture (PicturePtr pPicture, Mask mask); +int +miChangePictureTransform (PicturePtr pPicture, + PictTransform *transform); + +int +miChangePictureFilter (PicturePtr pPicture, + int filter, + xFixed *params, + int nparams); Bool miClipPicture (RegionPtr pRegion, @@ -98,12 +105,6 @@ Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); void -miGlyphExtents (int nlist, - GlyphListPtr list, - GlyphPtr *glyphs, - BoxPtr extents); - -void miGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, diff --git a/nx-X11/programs/Xserver/render/mirect.c b/nx-X11/programs/Xserver/render/mirect.c index 096bb5cb2..49da8d4f8 100644 --- a/nx-X11/programs/Xserver/render/mirect.c +++ b/nx-X11/programs/Xserver/render/mirect.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/mirect.c,v 1.3 2000/12/08 07:52:05 keithp Exp $ - * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -65,8 +63,8 @@ miColorRects (PicturePtr pDst, tmpval[4] = pDst->clipOrigin.y - yoff; mask |= GCClipXOrigin|GCClipYOrigin; - pClip = REGION_CREATE (pScreen, NULL, 1); - REGION_COPY (pScreen, pClip, + pClip = RegionCreate(NULL, 1); + RegionCopy(pClip, (RegionPtr) pClipPict->clientClip); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); } @@ -137,7 +135,8 @@ miCompositeRects (CARD8 op, goto bail1; pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, - rgbaFormat->depth); + rgbaFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) goto bail2; @@ -174,7 +173,7 @@ miCompositeRects (CARD8 op, rects++; } - FreePicture ((pointer) pSrc, 0); + FreePicture ((void *) pSrc, 0); bail4: FreeScratchGC (pGC); bail3: diff --git a/nx-X11/programs/Xserver/render/mitrap.c b/nx-X11/programs/Xserver/render/mitrap.c index be1712420..2155641ce 100644 --- a/nx-X11/programs/Xserver/render/mitrap.c +++ b/nx-X11/programs/Xserver/render/mitrap.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.8 2002/09/03 19:28:28 keithp Exp $ - * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -62,7 +60,7 @@ miCreateAlphaPicture (ScreenPtr pScreen, } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, - pPictFormat->depth); + pPictFormat->depth, 0); if (!pPixmap) return 0; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); @@ -128,6 +126,7 @@ miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box) } } +#ifndef NXAGENT_SERVER void miTrapezoids (CARD8 op, PicturePtr pSrc, @@ -188,3 +187,4 @@ miTrapezoids (CARD8 op, miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps); } } +#endif diff --git a/nx-X11/programs/Xserver/render/mitri.c b/nx-X11/programs/Xserver/render/mitri.c index bc2641895..a39e23623 100644 --- a/nx-X11/programs/Xserver/render/mitri.c +++ b/nx-X11/programs/Xserver/render/mitri.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/mitri.c,v 1.5 2002/05/31 16:48:52 keithp Exp $ - * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -145,7 +143,7 @@ miTriStrip (CARD8 op, if (npoint < 3) return; ntri = npoint - 2; - tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle)); + tris = malloc (ntri * sizeof (xTriangle)); if (!tris) return; for (tri = tris; npoint >= 3; npoint--, points++, tri++) @@ -155,7 +153,7 @@ miTriStrip (CARD8 op, tri->p3 = points[2]; } (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); - DEALLOCATE_LOCAL (tris); + free (tris); } void @@ -177,7 +175,7 @@ miTriFan (CARD8 op, if (npoint < 3) return; ntri = npoint - 2; - tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle)); + tris = malloc (ntri * sizeof (xTriangle)); if (!tris) return; first = points++; @@ -188,5 +186,5 @@ miTriFan (CARD8 op, tri->p3 = points[1]; } (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); - DEALLOCATE_LOCAL (tris); + free (tris); } diff --git a/nx-X11/programs/Xserver/render/picture.c b/nx-X11/programs/Xserver/render/picture.c index 3ed60310e..eba042903 100644 --- a/nx-X11/programs/Xserver/render/picture.c +++ b/nx-X11/programs/Xserver/render/picture.c @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.c,v 1.29 2002/11/23 02:38:15 keithp Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -40,7 +38,10 @@ #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" + +#ifndef NXAGENT_SERVER #include "picturestr.h" +#endif int PictureScreenPrivateIndex = -1; int PictureWindowPrivateIndex; @@ -79,7 +80,7 @@ AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount) { unsigned int *nsizes; - nsizes = (unsigned int *)xrealloc(ps->PicturePrivateSizes, + nsizes = (unsigned int *)realloc(ps->PicturePrivateSizes, (index2 + 1) * sizeof(unsigned int)); if (!nsizes) return FALSE; @@ -114,7 +115,7 @@ PictureDestroyWindow (WindowPtr pWindow) SetPictureWindow(pWindow, pPicture->pNext); if (pPicture->id) FreeResource (pPicture->id, PictureType); - FreePicture ((pointer) pPicture, pPicture->id); + FreePicture ((void *) pPicture, pPicture->id); } pScreen->DestroyWindow = ps->DestroyWindow; ret = (*pScreen->DestroyWindow) (pWindow); @@ -124,23 +125,23 @@ PictureDestroyWindow (WindowPtr pWindow) } Bool -PictureCloseScreen (int index, ScreenPtr pScreen) +PictureCloseScreen (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; int n; pScreen->CloseScreen = ps->CloseScreen; - ret = (*pScreen->CloseScreen) (index, pScreen); + ret = (*pScreen->CloseScreen) (pScreen); PictureResetFilters (pScreen); for (n = 0; n < ps->nformats; n++) if (ps->formats[n].type == PictTypeIndexed) (*ps->CloseIndexed) (pScreen, &ps->formats[n]); SetPictureScreen(pScreen, 0); if (ps->PicturePrivateSizes) - xfree (ps->PicturePrivateSizes); - xfree (ps->formats); - xfree (ps); + free (ps->PicturePrivateSizes); + free (ps->formats); + free (ps); return ret; } @@ -212,6 +213,7 @@ addFormat (FormatInitRec formats[256], #define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1)) +#ifndef NXAGENT_SERVER PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { @@ -361,7 +363,7 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) } - pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec)); + pFormats = (PictFormatPtr) malloc (nformats * sizeof (PictFormatRec)); if (!pFormats) return 0; memset (pFormats, '\0', nformats * sizeof (PictFormatRec)); @@ -431,6 +433,7 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) *nformatp = nformats; return pFormats; } +#endif static VisualPtr PictureFindVisual (ScreenPtr pScreen, VisualID visual) @@ -653,9 +656,9 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) } for (n = 0; n < nformats; n++) { - if (!AddResource (formats[n].id, PictFormatType, (pointer) (formats+n))) + if (!AddResource (formats[n].id, PictFormatType, (void *) (formats+n))) { - xfree (formats); + free (formats); return FALSE; } if (formats[n].type == PictTypeIndexed) @@ -684,18 +687,18 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) } formats[n].format = PICT_FORMAT(0,type,a,r,g,b); } - ps = (PictureScreenPtr) xalloc (sizeof (PictureScreenRec)); + ps = (PictureScreenPtr) malloc (sizeof (PictureScreenRec)); if (!ps) { - xfree (formats); + free (formats); return FALSE; } SetPictureScreen(pScreen, ps); if (!GlyphInit (pScreen)) { SetPictureScreen(pScreen, 0); - xfree (formats); - xfree (ps); + free (formats); + free (ps); return FALSE; } @@ -725,8 +728,8 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureResetFilters (pScreen); SetPictureScreen(pScreen, 0); - xfree (formats); - xfree (ps); + free (formats); + free (ps); return FALSE; } @@ -767,6 +770,7 @@ SetPictureToDefaults (PicturePtr pPicture) pPicture->pSourcePict = 0; } +#ifndef NXAGENT_SERVER PicturePtr AllocatePicture (ScreenPtr pScreen) { @@ -778,7 +782,7 @@ AllocatePicture (ScreenPtr pScreen) unsigned int size; int i; - pPicture = (PicturePtr) xalloc (ps->totalPictureSize); + pPicture = (PicturePtr) malloc (ps->totalPictureSize); if (!pPicture) return 0; ppriv = (DevUnion *)(pPicture + 1); @@ -789,11 +793,11 @@ AllocatePicture (ScreenPtr pScreen) { if ( (size = *sizes) ) { - ppriv->ptr = (pointer)ptr; + ppriv->ptr = (void *)ptr; ptr += size; } else - ppriv->ptr = (pointer)NULL; + ppriv->ptr = (void *)NULL; } return pPicture; } @@ -847,6 +851,7 @@ CreatePicture (Picture pid, } return pPicture; } +#endif static CARD32 xRenderColorToCard32(xRenderColor c) { @@ -954,7 +959,7 @@ static void initGradient(SourcePictPtr pGradient, int stopCount, dpos = stopPoints[i]; } - pGradient->linear.stops = xalloc(stopCount*sizeof(PictGradientStop)); + pGradient->linear.stops = malloc(stopCount*sizeof(PictGradientStop)); if (!pGradient->linear.stops) { *error = BadAlloc; return; @@ -969,13 +974,15 @@ static void initGradient(SourcePictPtr pGradient, int stopCount, initGradientColorTable(pGradient, error); } +#ifndef NXAGENT_SERVER static PicturePtr createSourcePicture(void) { PicturePtr pPicture; - pPicture = (PicturePtr) xalloc(sizeof(PictureRec)); + pPicture = (PicturePtr) malloc(sizeof(PictureRec)); pPicture->pDrawable = 0; pPicture->pFormat = 0; pPicture->pNext = 0; + pPicture->devPrivates = 0; SetPictureToDefaults(pPicture); return pPicture; @@ -992,16 +999,17 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error) } pPicture->id = pid; - pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictSolidFill)); + pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); if (!pPicture->pSourcePict) { *error = BadAlloc; - xfree(pPicture); + free(pPicture); return 0; } pPicture->pSourcePict->type = SourcePictTypeSolidFill; pPicture->pSourcePict->solidFill.color = xRenderColorToCard32(*color); return pPicture; } +#endif PicturePtr CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2, @@ -1025,10 +1033,10 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2, } pPicture->id = pid; - pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictLinearGradient)); + pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; - xfree(pPicture); + free(pPicture); return 0; } @@ -1038,7 +1046,7 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2, initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { - xfree(pPicture); + free(pPicture); return 0; } return pPicture; @@ -1074,10 +1082,10 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer } pPicture->id = pid; - pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictRadialGradient)); + pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; - xfree(pPicture); + free(pPicture); return 0; } radial = &pPicture->pSourcePict->radial; @@ -1101,7 +1109,7 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { - xfree(pPicture); + free(pPicture); return 0; } return pPicture; @@ -1125,10 +1133,10 @@ CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle, } pPicture->id = pid; - pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictConicalGradient)); + pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; - xfree(pPicture); + free(pPicture); return 0; } @@ -1138,7 +1146,7 @@ CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle, initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { - xfree(pPicture); + free(pPicture); return 0; } return pPicture; @@ -1201,7 +1209,7 @@ ChangePicture (PicturePtr pPicture, pAlpha = (PicturePtr) SecurityLookupIDByType(client, pid, PictureType, - SecurityWriteAccess|SecurityReadAccess); + DixWriteAccess|DixReadAccess); if (!pAlpha) { client->errorValue = pid; @@ -1223,7 +1231,7 @@ ChangePicture (PicturePtr pPicture, if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP) pAlpha->refcnt++; if (pPicture->alphaMap) - FreePicture ((pointer) pPicture->alphaMap, (XID) 0); + FreePicture ((void *) pPicture->alphaMap, (XID) 0); pPicture->alphaMap = pAlpha; } } @@ -1262,7 +1270,7 @@ ChangePicture (PicturePtr pPicture, pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pid, RT_PIXMAP, - SecurityReadAccess); + DixReadAccess); if (!pPixmap) { client->errorValue = pid; @@ -1295,7 +1303,7 @@ ChangePicture (PicturePtr pPicture, } } error = (*ps->ChangePictureClip)(pPicture, clipType, - (pointer)pPixmap, 0); + (void *)pPixmap, 0); break; } case CPGraphicsExposure: @@ -1390,12 +1398,12 @@ SetPictureClipRects (PicturePtr pPicture, RegionPtr clientClip; int result; - clientClip = RECTS_TO_REGION(pScreen, + clientClip = RegionFromRects( nRect, rects, CT_UNSORTED); if (!clientClip) return BadAlloc; result =(*ps->ChangePictureClip) (pPicture, CT_REGION, - (pointer) clientClip, 0); + (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; @@ -1421,14 +1429,14 @@ SetPictureClipRegion (PicturePtr pPicture, if (pRegion) { type = CT_REGION; - clientClip = REGION_CREATE (pScreen, - REGION_EXTENTS(pScreen, pRegion), - REGION_NUM_RECTS(pRegion)); + clientClip = RegionCreate( + RegionExtents(pRegion), + RegionNumRects(pRegion)); if (!clientClip) return BadAlloc; - if (!REGION_COPY (pSCreen, clientClip, pRegion)) + if (!RegionCopy(clientClip, pRegion)) { - REGION_DESTROY (pScreen, clientClip); + RegionDestroy(clientClip); return BadAlloc; } } @@ -1439,7 +1447,7 @@ SetPictureClipRegion (PicturePtr pPicture, } result =(*ps->ChangePictureClip) (pPicture, type, - (pointer) clientClip, 0); + (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; @@ -1468,7 +1476,7 @@ SetPictureTransform (PicturePtr pPicture, { if (!pPicture->transform) { - pPicture->transform = (PictTransform *) xalloc (sizeof (PictTransform)); + pPicture->transform = (PictTransform *) malloc (sizeof (PictTransform)); if (!pPicture->transform) return BadAlloc; } @@ -1478,7 +1486,7 @@ SetPictureTransform (PicturePtr pPicture, { if (pPicture->transform) { - xfree (pPicture->transform); + free (pPicture->transform); pPicture->transform = 0; } } @@ -1511,7 +1519,7 @@ CopyPicture (PicturePtr pSrc, if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP) pSrc->alphaMap->refcnt++; if (pDst->alphaMap) - FreePicture ((pointer) pDst->alphaMap, (XID) 0); + FreePicture ((void *) pDst->alphaMap, (XID) 0); pDst->alphaMap = pSrc->alphaMap; break; case CPAlphaXOrigin: @@ -1538,9 +1546,9 @@ CopyPicture (PicturePtr pSrc, RegionPtr clientClip; RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip; - clientClip = REGION_CREATE(pSrc->pDrawable->pScreen, - REGION_EXTENTS(pSrc->pDrawable->pScreen, srcClientClip), - REGION_NUM_RECTS(srcClientClip)); + clientClip = RegionCreate( + RegionExtents(srcClientClip), + RegionNumRects(srcClientClip)); (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0); } break; @@ -1592,8 +1600,9 @@ ValidatePicture(PicturePtr pPicture) ValidateOnePicture (pPicture->alphaMap); } +#ifndef NXAGENT_SERVER int -FreePicture (pointer value, +FreePicture (void * value, XID pid) { PicturePtr pPicture = (PicturePtr) value; @@ -1601,19 +1610,19 @@ FreePicture (pointer value, if (--pPicture->refcnt == 0) { if (pPicture->transform) - xfree (pPicture->transform); + free (pPicture->transform); if (!pPicture->pDrawable) { if (pPicture->pSourcePict) { if (pPicture->pSourcePict->type != SourcePictTypeSolidFill) - xfree(pPicture->pSourcePict->linear.stops); - xfree(pPicture->pSourcePict); + free(pPicture->pSourcePict->linear.stops); + free(pPicture->pSourcePict); } } else { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); if (pPicture->alphaMap) - FreePicture ((pointer) pPicture->alphaMap, (XID) 0); + FreePicture ((void *) pPicture->alphaMap, (XID) 0); (*ps->DestroyPicture) (pPicture); (*ps->DestroyPictureClip) (pPicture); if (pPicture->pDrawable->type == DRAWABLE_WINDOW) @@ -1637,18 +1646,112 @@ FreePicture (pointer value, (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable); } } - xfree (pPicture); + free (pPicture); } return Success; } +#endif int -FreePictFormat (pointer pPictFormat, +FreePictFormat (void * pPictFormat, XID pid) { return Success; } +/** + * ReduceCompositeOp is used to choose simpler ops for cases where alpha + * channels are always one and so math on the alpha channel per pixel becomes + * unnecessary. It may also avoid destination reads sometimes if apps aren't + * being careful to avoid these cases. + */ +static CARD8 +ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst) +{ + Bool no_src_alpha, no_dst_alpha; + + no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) && + PICT_FORMAT_A(pSrc->format) == 0 && + pSrc->alphaMap == NULL && + pMask == NULL; + no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) && + PICT_FORMAT_A(pDst->format) == 0 && + pDst->alphaMap == NULL; + + /* TODO, maybe: Conjoint and Disjoint op reductions? */ + + /* Deal with simplifications where the source alpha is always 1. */ + if (no_src_alpha) + { + switch (op) { + case PictOpOver: + op = PictOpSrc; + break; + case PictOpInReverse: + op = PictOpDst; + break; + case PictOpOutReverse: + op = PictOpClear; + break; + case PictOpAtop: + op = PictOpIn; + break; + case PictOpAtopReverse: + op = PictOpOverReverse; + break; + case PictOpXor: + op = PictOpOut; + break; + default: + break; + } + } + + /* Deal with simplifications when the destination alpha is always 1 */ + if (no_dst_alpha) + { + switch (op) { + case PictOpOverReverse: + op = PictOpDst; + break; + case PictOpIn: + op = PictOpSrc; + break; + case PictOpOut: + op = PictOpClear; + break; + case PictOpAtop: + op = PictOpOver; + break; + case PictOpXor: + op = PictOpOutReverse; + break; + default: + break; + } + } + + /* Reduce some con/disjoint ops to the basic names. */ + switch (op) { + case PictOpDisjointClear: + case PictOpConjointClear: + op = PictOpClear; + break; + case PictOpDisjointSrc: + case PictOpConjointSrc: + op = PictOpSrc; + break; + case PictOpDisjointDst: + case PictOpConjointDst: + op = PictOpDst; + break; + default: + break; + } + + return op; +} + void CompositePicture (CARD8 op, PicturePtr pSrc, @@ -1669,6 +1772,11 @@ CompositePicture (CARD8 op, if (pMask) ValidatePicture (pMask); ValidatePicture (pDst); + + op = ReduceCompositeOp (op, pSrc, pMask, pDst); + if (op == PictOpDst) + return; + (*ps->Composite) (op, pSrc, pMask, @@ -1684,29 +1792,9 @@ CompositePicture (CARD8 op, } void -CompositeGlyphs (CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, - int nlist, - GlyphListPtr lists, - GlyphPtr *glyphs) -{ - PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); - - ValidatePicture (pSrc); - ValidatePicture (pDst); - (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs); -} - -void -CompositeRects (CARD8 op, - PicturePtr pDst, - xRenderColor *color, - int nRect, - xRectangle *rects) +CompositeRects(CARD8 op, + PicturePtr pDst, + xRenderColor * color, int nRect, xRectangle *rects) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); @@ -1794,71 +1882,3 @@ AddTraps (PicturePtr pPicture, ValidatePicture (pPicture); (*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps); } - -#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff) -#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31)) - -Bool -PictureTransformPoint3d (PictTransformPtr transform, - PictVectorPtr vector) -{ - PictVector result; - int i, j; - xFixed_32_32 partial; - xFixed_48_16 v; - - for (j = 0; j < 3; j++) - { - v = 0; - for (i = 0; i < 3; i++) - { - partial = ((xFixed_48_16) transform->matrix[j][i] * - (xFixed_48_16) vector->vector[i]); - v += partial >> 16; - } - if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) - return FALSE; - result.vector[j] = (xFixed) v; - } - if (!result.vector[2]) - return FALSE; - *vector = result; - return TRUE; -} - - -Bool -PictureTransformPoint (PictTransformPtr transform, - PictVectorPtr vector) -{ - PictVector result; - int i, j; - xFixed_32_32 partial; - xFixed_48_16 v; - - for (j = 0; j < 3; j++) - { - v = 0; - for (i = 0; i < 3; i++) - { - partial = ((xFixed_48_16) transform->matrix[j][i] * - (xFixed_48_16) vector->vector[i]); - v += partial >> 16; - } - if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) - return FALSE; - result.vector[j] = (xFixed) v; - } - if (!result.vector[2]) - return FALSE; - for (j = 0; j < 2; j++) - { - partial = (xFixed_48_16) result.vector[j] << 16; - v = partial / result.vector[2]; - if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) - return FALSE; - vector->vector[j] = (xFixed) v; - } - vector->vector[2] = xFixed1; - return TRUE; -} diff --git a/nx-X11/programs/Xserver/render/picture.h b/nx-X11/programs/Xserver/render/picture.h index b09d9aac2..5dde2d0bc 100644 --- a/nx-X11/programs/Xserver/render/picture.h +++ b/nx-X11/programs/Xserver/render/picture.h @@ -1,6 +1,4 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.h,v 1.20tsi Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -173,8 +171,7 @@ typedef __int64 xFixed_32_32; defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || \ defined(__s390x__) || \ - defined(amd64) || defined (__amd64__) || \ - (defined(sgi) && (_MIPS_SZLONG == 64)) + defined(amd64) || defined (__amd64__) typedef long xFixed_32_32; # else # if defined(__GNUC__) && \ diff --git a/nx-X11/programs/Xserver/render/picturestr.h b/nx-X11/programs/Xserver/render/picturestr.h index 4775793ab..f5c367bb4 100644 --- a/nx-X11/programs/Xserver/render/picturestr.h +++ b/nx-X11/programs/Xserver/render/picturestr.h @@ -54,13 +54,10 @@ typedef struct _PictFormat { IndexFormatRec index; } PictFormatRec; -typedef struct _PictVector { - xFixed vector[3]; -} PictVector, *PictVectorPtr; +typedef struct pixman_vector PictVector, *PictVectorPtr; +typedef struct pixman_transform PictTransform, *PictTransformPtr; -typedef struct _PictTransform { - xFixed matrix[3][3]; -} PictTransform, *PictTransformPtr; +#define pict_f_transform pixman_f_transform #define PICT_GRADIENT_STOPTABLE_SIZE 1024 #define SourcePictTypeSolidFill 0 @@ -68,10 +65,14 @@ typedef struct _PictTransform { #define SourcePictTypeRadial 2 #define SourcePictTypeConical 3 +#ifdef NXAGENT_SERVER +#include "../hw/nxagent/NXpicturestr_PictSolidFill.h" +#else typedef struct _PictSolidFill { unsigned int type; CARD32 color; } PictSolidFill, *PictSolidFillPtr; +#endif /* NXAGENT_SERVER */ typedef struct _PictGradientStop { xFixed x; @@ -149,7 +150,7 @@ typedef struct _Picture { DDXPointRec alphaOrigin; DDXPointRec clipOrigin; - pointer clientClip; + void *clientClip; Atom dither; @@ -168,12 +169,14 @@ typedef struct _Picture { SourcePictPtr pSourcePict; } PictureRec; -typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id, - xFixed *params, int nparams); +typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id, + xFixed *params, int nparams, + int *width, int *height); typedef struct { char *name; int id; PictFilterValidateParamsProcPtr ValidateParams; + int width, height; } PictFilterRec, *PictFilterPtr; #define PictFilterNearest 0 @@ -195,7 +198,7 @@ typedef int (*CreatePictureProcPtr) (PicturePtr pPicture); typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture, int clipType, - pointer value, + void *value, int n); typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture); @@ -344,7 +347,13 @@ typedef struct _PictureScreen { int nfilterAliases; ChangePictureTransformProcPtr ChangePictureTransform; + + /** + * Called immediately after a picture's transform is changed through the + * SetPictureFilter request. Not called for source-only pictures. + */ ChangePictureFilterProcPtr ChangePictureFilter; + DestroyPictureFilterProcPtr DestroyPictureFilter; TrapezoidsProcPtr Trapezoids; @@ -368,9 +377,9 @@ extern RESTYPE GlyphSetType; #define GetPictureScreen(s) ((PictureScreenPtr) ((s)->devPrivates[PictureScreenPrivateIndex].ptr)) #define GetPictureScreenIfSet(s) ((PictureScreenPrivateIndex != -1) ? GetPictureScreen(s) : NULL) -#define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (pointer) (p)) +#define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (void *) (p)) #define GetPictureWindow(w) ((PicturePtr) ((w)->devPrivates[PictureWindowPrivateIndex].ptr)) -#define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (pointer) (p)) +#define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (void *) (p)) #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\ pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\ @@ -401,7 +410,7 @@ Bool PictureDestroyWindow (WindowPtr pWindow); Bool -PictureCloseScreen (int Index, ScreenPtr pScreen); +PictureCloseScreen (ScreenPtr pScreen); void PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef); @@ -451,7 +460,12 @@ PictFilterPtr PictureFindFilter (ScreenPtr pScreen, char *name, int len); int -SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams); +SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter, + xFixed *params, int nparams); + +int +SetPictureFilter (PicturePtr pPicture, char *name, int len, + xFixed *params, int nparams); Bool PictureFinishInit (void); @@ -510,11 +524,11 @@ void ValidatePicture(PicturePtr pPicture); int -FreePicture (pointer pPicture, +FreePicture (void *pPicture, XID pid); int -FreePictFormat (pointer pPictFormat, +FreePictFormat (void *pPictFormat, XID pid); void @@ -651,4 +665,22 @@ void PanoramiXRenderInit (void); void PanoramiXRenderReset (void); #endif +/* + * matrix.c + */ + +extern _X_EXPORT void +PictTransform_from_xRenderTransform(PictTransformPtr pict, + xRenderTransform * render); + +extern _X_EXPORT void +xRenderTransform_from_PictTransform(xRenderTransform * render, + PictTransformPtr pict); + +extern _X_EXPORT Bool + PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector); + +extern _X_EXPORT Bool + PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector); + #endif /* _PICTURESTR_H_ */ diff --git a/nx-X11/programs/Xserver/render/render.c b/nx-X11/programs/Xserver/render/render.c index d25d49756..fb9208ad1 100644 --- a/nx-X11/programs/Xserver/render/render.c +++ b/nx-X11/programs/Xserver/render/render.c @@ -1,7 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/render/render.c,v 1.12 2005/08/28 19:47:39 ajax Exp $ */ /* - * $XFree86: xc/programs/Xserver/render/render.c,v 1.27tsi Exp $ - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -24,14 +21,12 @@ * Author: Keith Packard, SuSE, Inc. */ -#define NEED_REPLIES -#define NEED_EVENTS #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#include <X11/X.h> -#include <X11/Xproto.h> +#include <nx-X11/X.h> +#include <nx-X11/Xproto.h> #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -42,15 +37,14 @@ #include "colormapst.h" #include "extnsionst.h" #include "servermd.h" -#include <X11/extensions/render.h> -#include <X11/extensions/renderproto.h> +#include <nx-X11/extensions/render.h> +#include <nx-X11/extensions/renderproto.h> #include "picturestr.h" #include "glyphstr.h" -#include <X11/Xfuncproto.h> +#include <nx-X11/Xfuncproto.h> #include "cursorstr.h" -#ifdef EXTMODULE -#include "xf86_ansic.h" -#endif + +#include "protocol-versions.h" #if !defined(UINT32_MAX) #define UINT32_MAX 0xffffffffU @@ -230,8 +224,8 @@ typedef struct _RenderClient { static void RenderClientCallback (CallbackListPtr *list, - pointer closure, - pointer data) + void * closure, + void * data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; @@ -275,32 +269,36 @@ RenderResetProc (ExtensionEntry *extEntry) ResetGlyphSetPrivateIndex(); } +#ifndef NXAGENT_SERVER static int ProcRenderQueryVersion (ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryVersionReply rep; - register int n; + REQUEST(xRenderQueryVersionReq); + REQUEST_SIZE_MATCH(xRenderQueryVersionReq); + pRenderClient->major_version = stuff->majorVersion; pRenderClient->minor_version = stuff->minorVersion; - REQUEST_SIZE_MATCH(xRenderQueryVersionReq); + memset(&rep, 0, sizeof(xRenderQueryVersionReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.majorVersion = RENDER_MAJOR; - rep.minorVersion = RENDER_MINOR; + rep.majorVersion = SERVER_RENDER_MAJOR_VERSION; + rep.minorVersion = SERVER_RENDER_MINOR_VERSION; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.majorVersion, n); - swapl(&rep.minorVersion, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.majorVersion); + swapl(&rep.minorVersion); } - WriteToClient(client, sizeof(xRenderQueryVersionReply), (char *)&rep); + WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep); return (client->noClientException); } +#endif /* NXAGENT_SERVER */ #if 0 static int @@ -339,6 +337,7 @@ findVisual (ScreenPtr pScreen, VisualID vid) extern char *ConnectionInfo; +#ifndef NXAGENT_SERVER static int ProcRenderQueryPictFormats (ClientPtr client) { @@ -406,9 +405,11 @@ ProcRenderQueryPictFormats (ClientPtr client) ndepth * sizeof (xPictDepth) + nvisual * sizeof (xPictVisual) + numSubpixel * sizeof (CARD32)); - reply = (xRenderQueryPictFormatsReply *) xalloc (rlength); + reply = (xRenderQueryPictFormatsReply *) malloc (rlength); if (!reply) return BadAlloc; + memset(reply, 0, rlength); + reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = (rlength - sizeof(xGenericReply)) >> 2; @@ -447,16 +448,16 @@ ProcRenderQueryPictFormats (ClientPtr client) pictForm->colormap = None; if (client->swapped) { - swapl (&pictForm->id, n); - swaps (&pictForm->direct.red, n); - swaps (&pictForm->direct.redMask, n); - swaps (&pictForm->direct.green, n); - swaps (&pictForm->direct.greenMask, n); - swaps (&pictForm->direct.blue, n); - swaps (&pictForm->direct.blueMask, n); - swaps (&pictForm->direct.alpha, n); - swaps (&pictForm->direct.alphaMask, n); - swapl (&pictForm->colormap, n); + swapl (&pictForm->id); + swaps (&pictForm->direct.red); + swaps (&pictForm->direct.redMask); + swaps (&pictForm->direct.green); + swaps (&pictForm->direct.greenMask); + swaps (&pictForm->direct.blue); + swaps (&pictForm->direct.blueMask); + swaps (&pictForm->direct.alpha); + swaps (&pictForm->direct.alphaMask); + swapl (&pictForm->colormap); } pictForm++; } @@ -486,8 +487,8 @@ ProcRenderQueryPictFormats (ClientPtr client) pictVisual->format = pFormat->id; if (client->swapped) { - swapl (&pictVisual->visual, n); - swapl (&pictVisual->format, n); + swapl (&pictVisual->visual); + swapl (&pictVisual->format); } pictVisual++; nvisual++; @@ -497,7 +498,7 @@ ProcRenderQueryPictFormats (ClientPtr client) pictDepth->nPictVisuals = nvisual; if (client->swapped) { - swaps (&pictDepth->nPictVisuals, n); + swaps (&pictDepth->nPictVisuals); } ndepth++; pictDepth = (xPictDepth *) pictVisual; @@ -510,8 +511,8 @@ ProcRenderQueryPictFormats (ClientPtr client) pictScreen->fallback = 0; if (client->swapped) { - swapl (&pictScreen->nDepth, n); - swapl (&pictScreen->fallback, n); + swapl (&pictScreen->nDepth); + swapl (&pictScreen->fallback); } pictScreen = (xPictScreen *) pictDepth; } @@ -527,25 +528,26 @@ ProcRenderQueryPictFormats (ClientPtr client) *pictSubpixel = SubPixelUnknown; if (client->swapped) { - swapl (pictSubpixel, n); + swapl (pictSubpixel); } ++pictSubpixel; } if (client->swapped) { - swaps (&reply->sequenceNumber, n); - swapl (&reply->length, n); - swapl (&reply->numFormats, n); - swapl (&reply->numScreens, n); - swapl (&reply->numDepths, n); - swapl (&reply->numVisuals, n); - swapl (&reply->numSubpixel, n); - } - WriteToClient(client, rlength, (char *) reply); - xfree (reply); + swaps (&reply->sequenceNumber); + swapl (&reply->length); + swapl (&reply->numFormats); + swapl (&reply->numScreens); + swapl (&reply->numDepths); + swapl (&reply->numVisuals); + swapl (&reply->numSubpixel); + } + WriteToClient(client, rlength, reply); + free (reply); return client->noClientException; } +#endif /* NXAGENT_SERVER */ static int ProcRenderQueryPictIndexValues (ClientPtr client) @@ -553,7 +555,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) PictFormatPtr pFormat; int num; int rlength; - int i, n; + int i; REQUEST(xRenderQueryPictIndexValuesReq); xRenderQueryPictIndexValuesReply *reply; xIndexValue *values; @@ -563,7 +565,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { @@ -578,7 +580,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) num = pFormat->index.nvalues; rlength = (sizeof (xRenderQueryPictIndexValuesReply) + num * sizeof(xIndexValue)); - reply = (xRenderQueryPictIndexValuesReply *) xalloc (rlength); + reply = (xRenderQueryPictIndexValuesReply *) malloc (rlength); if (!reply) return BadAlloc; @@ -595,19 +597,19 @@ ProcRenderQueryPictIndexValues (ClientPtr client) { for (i = 0; i < num; i++) { - swapl (&values[i].pixel, n); - swaps (&values[i].red, n); - swaps (&values[i].green, n); - swaps (&values[i].blue, n); - swaps (&values[i].alpha, n); + swapl (&values[i].pixel); + swaps (&values[i].red); + swaps (&values[i].green); + swaps (&values[i].blue); + swaps (&values[i].alpha); } - swaps (&reply->sequenceNumber, n); - swapl (&reply->length, n); - swapl (&reply->numIndexValues, n); + swaps (&reply->sequenceNumber); + swapl (&reply->length); + swapl (&reply->numIndexValues); } - WriteToClient(client, rlength, (char *) reply); - xfree(reply); + WriteToClient(client, rlength, reply); + free(reply); return (client->noClientException); } @@ -617,6 +619,7 @@ ProcRenderQueryDithers (ClientPtr client) return BadImplementation; } +#ifndef NXAGENT_SERVER static int ProcRenderCreatePicture (ClientPtr client) { @@ -631,11 +634,11 @@ ProcRenderCreatePicture (ClientPtr client) LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, - SecurityWriteAccess); + DixWriteAccess); pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->format; @@ -656,7 +659,7 @@ ProcRenderCreatePicture (ClientPtr client) &error); if (!pPicture) return error; - if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) + if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } @@ -669,7 +672,7 @@ ProcRenderChangePicture (ClientPtr client) int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); @@ -689,7 +692,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) int result; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -706,6 +709,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) else return(result); } +#endif /* NXAGENT_SERVER */ static int ProcRenderFreePicture (ClientPtr client) @@ -715,7 +719,7 @@ ProcRenderFreePicture (ClientPtr client) REQUEST_SIZE_MATCH(xRenderFreePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityDestroyAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); FreeResource (stuff->picture, RT_NONE); return(client->noClientException); @@ -733,6 +737,7 @@ PictOpValid (CARD8 op) return FALSE; } +#ifndef NXAGENT_SERVER static int ProcRenderComposite (ClientPtr client) { @@ -745,13 +750,13 @@ ProcRenderComposite (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_ALPHA (pMask, stuff->mask, client, SecurityReadAccess, + VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask && pMask->pDrawable && pSrc->pDrawable->pScreen != pMask->pDrawable->pScreen)) @@ -770,6 +775,7 @@ ProcRenderComposite (ClientPtr client) stuff->height); return Success; } +#endif /* NXAGENT_SERVER */ static int ProcRenderScale (ClientPtr client) @@ -777,6 +783,7 @@ ProcRenderScale (ClientPtr client) return BadImplementation; } +#ifndef NXAGENT_SERVER static int ProcRenderTrapezoids (ClientPtr client) { @@ -791,9 +798,9 @@ ProcRenderTrapezoids (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -804,7 +811,7 @@ ProcRenderTrapezoids (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -823,6 +830,7 @@ ProcRenderTrapezoids (ClientPtr client) ntraps, (xTrapezoid *) &stuff[1]); return client->noClientException; } +#endif /* NXAGENT_SERVER */ static int ProcRenderTriangles (ClientPtr client) @@ -838,9 +846,9 @@ ProcRenderTriangles (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -851,7 +859,7 @@ ProcRenderTriangles (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -885,9 +893,9 @@ ProcRenderTriStrip (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -898,7 +906,7 @@ ProcRenderTriStrip (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -932,9 +940,9 @@ ProcRenderTriFan (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -945,7 +953,7 @@ ProcRenderTriFan (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -983,6 +991,7 @@ ProcRenderTransform (ClientPtr client) return BadImplementation; } +#ifndef NXAGENT_SERVER static int ProcRenderCreateGlyphSet (ClientPtr client) { @@ -997,7 +1006,7 @@ ProcRenderCreateGlyphSet (ClientPtr client) format = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!format) { client->errorValue = stuff->format; @@ -1027,7 +1036,7 @@ ProcRenderCreateGlyphSet (ClientPtr client) glyphSet = AllocateGlyphSet (f, format); if (!glyphSet) return BadAlloc; - if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet)) + if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; return Success; } @@ -1045,21 +1054,23 @@ ProcRenderReferenceGlyphSet (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->existing, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->existing; return RenderErrBase + BadGlyphSet; } glyphSet->refcnt++; - if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet)) + if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; return client->noClientException; } +#endif /* NXAGENT_SERVER */ #define NLOCALDELTA 64 #define NLOCALGLYPH 256 +#ifndef NXAGENT_SERVER static int ProcRenderFreeGlyphSet (ClientPtr client) { @@ -1070,7 +1081,7 @@ ProcRenderFreeGlyphSet (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityDestroyAccess); + DixDestroyAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1079,6 +1090,7 @@ ProcRenderFreeGlyphSet (ClientPtr client) FreeResource (stuff->glyphset, RT_NONE); return client->noClientException; } +#endif /* NXAGENT_SERVER */ typedef struct _GlyphNew { Glyph id; @@ -1092,7 +1104,7 @@ ProcRenderAddGlyphs (ClientPtr client) REQUEST(xRenderAddGlyphsReq); GlyphNewRec glyphsLocal[NLOCALGLYPH]; GlyphNewPtr glyphsBase, glyphs; - GlyphPtr glyph; + GlyphPtr glyph = NULL; int remain, nglyphs; CARD32 *gids; xGlyphInfo *gi; @@ -1104,7 +1116,7 @@ ProcRenderAddGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1119,7 +1131,7 @@ ProcRenderAddGlyphs (ClientPtr client) glyphsBase = glyphsLocal; else { - glyphsBase = (GlyphNewPtr) Xalloc (nglyphs * sizeof (GlyphNewRec)); + glyphsBase = (GlyphNewPtr) malloc (nglyphs * sizeof (GlyphNewRec)); if (!glyphsBase) return BadAlloc; } @@ -1176,16 +1188,16 @@ ProcRenderAddGlyphs (ClientPtr client) } if (glyphsBase != glyphsLocal) - Xfree (glyphsBase); + free (glyphsBase); return client->noClientException; bail: while (glyphs != glyphsBase) { --glyphs; - xfree (glyphs->glyph); + free (glyphs->glyph); } if (glyphsBase != glyphsLocal) - Xfree (glyphsBase); + free (glyphsBase); return err; } @@ -1195,6 +1207,7 @@ ProcRenderAddGlyphsFromPicture (ClientPtr client) return BadImplementation; } +#ifndef NXAGENT_SERVER static int ProcRenderFreeGlyphs (ClientPtr client) { @@ -1208,7 +1221,7 @@ ProcRenderFreeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1263,9 +1276,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -1276,7 +1289,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -1289,7 +1302,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityReadAccess); + DixReadAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1323,7 +1336,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphsBase = glyphsLocal; else { - glyphsBase = (GlyphPtr *) ALLOCATE_LOCAL (nglyph * sizeof (GlyphPtr)); + glyphsBase = (GlyphPtr *) malloc (nglyph * sizeof (GlyphPtr)); if (!glyphsBase) return BadAlloc; } @@ -1331,7 +1344,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) listsBase = listsLocal; else { - listsBase = (GlyphListPtr) ALLOCATE_LOCAL (nlist * sizeof (GlyphListRec)); + listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec)); if (!listsBase) return BadAlloc; } @@ -1351,14 +1364,14 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, gs, GlyphSetType, - SecurityReadAccess); + DixReadAccess); if (!glyphSet) { client->errorValue = gs; if (glyphsBase != glyphsLocal) - DEALLOCATE_LOCAL (glyphsBase); + free (glyphsBase); if (listsBase != listsLocal) - DEALLOCATE_LOCAL (listsBase); + free (listsBase); return RenderErrBase + BadGlyphSet; } } @@ -1412,9 +1425,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphsBase); if (glyphsBase != glyphsLocal) - DEALLOCATE_LOCAL (glyphsBase); + free (glyphsBase); if (listsBase != listsLocal) - DEALLOCATE_LOCAL (listsBase); + free (listsBase); return client->noClientException; } @@ -1432,7 +1445,7 @@ ProcRenderFillRectangles (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -1450,6 +1463,7 @@ ProcRenderFillRectangles (ClientPtr client) return client->noClientException; } +#endif /* NXAGENT_SERVER */ static void SetBit (unsigned char *line, int x, int bit) @@ -1477,6 +1491,7 @@ static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = { #define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) +#ifndef NXAGENT_SERVER static int ProcRenderCreateCursor (ClientPtr client) { @@ -1498,7 +1513,7 @@ ProcRenderCreateCursor (ClientPtr client) REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); if (!pSrc->pDrawable) return BadDrawable; @@ -1510,23 +1525,23 @@ ProcRenderCreateCursor (ClientPtr client) if ( stuff->x > width || stuff->y > height ) return (BadMatch); - argbbits = xalloc (width * height * sizeof (CARD32)); + argbbits = malloc (width * height * sizeof (CARD32)); if (!argbbits) return (BadAlloc); stride = BitmapBytePad(width); nbytes_mono = stride*height; - srcbits = (unsigned char *)xalloc(nbytes_mono); + srcbits = (unsigned char *)malloc(nbytes_mono); if (!srcbits) { - xfree (argbbits); + free (argbbits); return (BadAlloc); } - mskbits = (unsigned char *)xalloc(nbytes_mono); + mskbits = (unsigned char *)malloc(nbytes_mono); if (!mskbits) { - xfree(argbbits); - xfree(srcbits); + free(argbbits); + free(srcbits); return (BadAlloc); } bzero ((char *) mskbits, nbytes_mono); @@ -1536,7 +1551,7 @@ ProcRenderCreateCursor (ClientPtr client) { (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, width, height, ZPixmap, - 0xffffffff, (pointer) argbbits); + 0xffffffff, (void *) argbbits); } else { @@ -1548,26 +1563,27 @@ ProcRenderCreateCursor (ClientPtr client) pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!pFormat) { - xfree (argbbits); - xfree (srcbits); - xfree (mskbits); + free (argbbits); + free (srcbits); + free (mskbits); return (BadImplementation); } - pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32); + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { - xfree (argbbits); - xfree (srcbits); - xfree (mskbits); + free (argbbits); + free (srcbits); + free (mskbits); return (BadAlloc); } pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0, client, &error); if (!pPicture) { - xfree (argbbits); - xfree (srcbits); - xfree (mskbits); + free (argbbits); + free (srcbits); + free (mskbits); return error; } (*pScreen->DestroyPixmap) (pPixmap); @@ -1576,7 +1592,7 @@ ProcRenderCreateCursor (ClientPtr client) 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable, 0, 0, width, height, ZPixmap, - 0xffffffff, (pointer) argbbits); + 0xffffffff, (void *) argbbits); FreePicture (pPicture, 0); } /* @@ -1651,7 +1667,7 @@ ProcRenderCreateCursor (ClientPtr client) } else { - xfree (argbbits); + free (argbbits); argbbits = 0; } @@ -1669,7 +1685,7 @@ ProcRenderCreateCursor (ClientPtr client) GetColor(twocolor[1], 16), GetColor(twocolor[1], 8), GetColor(twocolor[1], 0)); - if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) + if (pCursor && AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) return (client->noClientException); return BadAlloc; } @@ -1682,7 +1698,7 @@ ProcRenderSetPictureTransform (ClientPtr client) int result; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); if (client->noClientException != Success) @@ -1690,6 +1706,7 @@ ProcRenderSetPictureTransform (ClientPtr client) else return(result); } +#endif /* NXAGENT_SERVER */ static int ProcRenderQueryFilters (ClientPtr client) @@ -1708,7 +1725,7 @@ ProcRenderQueryFilters (ClientPtr client) char *names; REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); - SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, SecurityReadAccess); + SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, DixReadAccess); pScreen = pDrawable->pScreen; nbytesName = 0; @@ -1724,7 +1741,7 @@ ProcRenderQueryFilters (ClientPtr client) } len = ((nnames + 1) >> 1) + ((nbytesName + 3) >> 2); total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2); - reply = (xRenderQueryFiltersReply *) xalloc (total_bytes); + reply = (xRenderQueryFiltersReply *) malloc (total_bytes); if (!reply) return BadAlloc; aliases = (INT16 *) (reply + 1); @@ -1783,23 +1800,22 @@ ProcRenderQueryFilters (ClientPtr client) if (client->swapped) { - register int n; - for (i = 0; i < reply->numAliases; i++) { - swaps (&aliases[i], n); + swaps (&aliases[i]); } - swaps(&reply->sequenceNumber, n); - swapl(&reply->length, n); - swapl(&reply->numAliases, n); - swapl(&reply->numFilters, n); + swaps(&reply->sequenceNumber); + swapl(&reply->length); + swapl(&reply->numAliases); + swapl(&reply->numFilters); } - WriteToClient(client, total_bytes, (char *) reply); - xfree (reply); + WriteToClient(client, total_bytes, reply); + free (reply); return(client->noClientException); } +#ifndef NXAGENT_SERVER static int ProcRenderSetPictureFilter (ClientPtr client) { @@ -1811,7 +1827,7 @@ ProcRenderSetPictureFilter (ClientPtr client) char *name; REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); @@ -1837,7 +1853,7 @@ ProcRenderCreateAnimCursor (ClientPtr client) if (client->req_len & 1) return BadLength; ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1; - cursors = xalloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32))); + cursors = malloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32))); if (!cursors) return BadAlloc; deltas = (CARD32 *) (cursors + ncursor); @@ -1845,10 +1861,10 @@ ProcRenderCreateAnimCursor (ClientPtr client) for (i = 0; i < ncursor; i++) { cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!cursors[i]) { - xfree (cursors); + free (cursors); client->errorValue = elt->cursor; return BadCursor; } @@ -1856,14 +1872,15 @@ ProcRenderCreateAnimCursor (ClientPtr client) elt++; } ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor); - xfree (cursors); + free (cursors); if (ret != Success) return ret; - if (AddResource (stuff->cid, RT_CURSOR, (pointer)pCursor)) + if (AddResource (stuff->cid, RT_CURSOR, (void *)pCursor)) return client->noClientException; return BadAlloc; } +#endif /* NXAGENT_SERVER */ static int ProcRenderAddTraps (ClientPtr client) @@ -1873,7 +1890,7 @@ ProcRenderAddTraps (ClientPtr client) REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -1888,6 +1905,7 @@ ProcRenderAddTraps (ClientPtr client) return client->noClientException; } +#ifndef NXAGENT_SERVER static int ProcRenderCreateSolidFill(ClientPtr client) { PicturePtr pPicture; @@ -1901,7 +1919,7 @@ static int ProcRenderCreateSolidFill(ClientPtr client) pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); if (!pPicture) return error; - if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) + if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } @@ -1932,7 +1950,7 @@ static int ProcRenderCreateLinearGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; - if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) + if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } @@ -1962,7 +1980,7 @@ static int ProcRenderCreateRadialGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; - if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) + if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } @@ -1991,7 +2009,7 @@ static int ProcRenderCreateConicalGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; - if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) + if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } @@ -2007,35 +2025,36 @@ ProcRenderDispatch (ClientPtr client) else return BadRequest; } +#endif /* NXAGENT_SERVER */ static int SProcRenderQueryVersion (ClientPtr client) { - register int n; REQUEST(xRenderQueryVersionReq); + REQUEST_SIZE_MATCH(xRenderQueryVersionReq); - swaps(&stuff->length, n); - swapl(&stuff->majorVersion, n); - swapl(&stuff->minorVersion, n); + swaps(&stuff->length); + swapl(&stuff->majorVersion); + swapl(&stuff->minorVersion); return (*ProcRenderVector[stuff->renderReqType])(client); } static int SProcRenderQueryPictFormats (ClientPtr client) { - register int n; REQUEST(xRenderQueryPictFormatsReq); - swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); + swaps(&stuff->length); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderQueryPictIndexValues (ClientPtr client) { - register int n; REQUEST(xRenderQueryPictIndexValuesReq); - swaps(&stuff->length, n); - swapl(&stuff->format, n); + REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); + swaps(&stuff->length); + swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2048,13 +2067,13 @@ SProcRenderQueryDithers (ClientPtr client) static int SProcRenderCreatePicture (ClientPtr client) { - register int n; REQUEST(xRenderCreatePictureReq); - swaps(&stuff->length, n); - swapl(&stuff->pid, n); - swapl(&stuff->drawable, n); - swapl(&stuff->format, n); - swapl(&stuff->mask, n); + REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); + swaps(&stuff->length); + swapl(&stuff->pid); + swapl(&stuff->drawable); + swapl(&stuff->format); + swapl(&stuff->mask); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2062,11 +2081,11 @@ SProcRenderCreatePicture (ClientPtr client) static int SProcRenderChangePicture (ClientPtr client) { - register int n; REQUEST(xRenderChangePictureReq); - swaps(&stuff->length, n); - swapl(&stuff->picture, n); - swapl(&stuff->mask, n); + REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); + swaps(&stuff->length); + swapl(&stuff->picture); + swapl(&stuff->mask); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2074,10 +2093,10 @@ SProcRenderChangePicture (ClientPtr client) static int SProcRenderSetPictureClipRectangles (ClientPtr client) { - register int n; REQUEST(xRenderSetPictureClipRectanglesReq); - swaps(&stuff->length, n); - swapl(&stuff->picture, n); + REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); + swaps(&stuff->length); + swapl(&stuff->picture); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2085,65 +2104,64 @@ SProcRenderSetPictureClipRectangles (ClientPtr client) static int SProcRenderFreePicture (ClientPtr client) { - register int n; REQUEST(xRenderFreePictureReq); - swaps(&stuff->length, n); - swapl(&stuff->picture, n); + REQUEST_SIZE_MATCH(xRenderFreePictureReq); + swaps(&stuff->length); + swapl(&stuff->picture); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderComposite (ClientPtr client) { - register int n; REQUEST(xRenderCompositeReq); - swaps(&stuff->length, n); - swapl(&stuff->src, n); - swapl(&stuff->mask, n); - swapl(&stuff->dst, n); - swaps(&stuff->xSrc, n); - swaps(&stuff->ySrc, n); - swaps(&stuff->xMask, n); - swaps(&stuff->yMask, n); - swaps(&stuff->xDst, n); - swaps(&stuff->yDst, n); - swaps(&stuff->width, n); - swaps(&stuff->height, n); + REQUEST_SIZE_MATCH(xRenderCompositeReq); + swaps(&stuff->length); + swapl(&stuff->src); + swapl(&stuff->mask); + swapl(&stuff->dst); + swaps(&stuff->xSrc); + swaps(&stuff->ySrc); + swaps(&stuff->xMask); + swaps(&stuff->yMask); + swaps(&stuff->xDst); + swaps(&stuff->yDst); + swaps(&stuff->width); + swaps(&stuff->height); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderScale (ClientPtr client) { - register int n; REQUEST(xRenderScaleReq); - swaps(&stuff->length, n); - swapl(&stuff->src, n); - swapl(&stuff->dst, n); - swapl(&stuff->colorScale, n); - swapl(&stuff->alphaScale, n); - swaps(&stuff->xSrc, n); - swaps(&stuff->ySrc, n); - swaps(&stuff->xDst, n); - swaps(&stuff->yDst, n); - swaps(&stuff->width, n); - swaps(&stuff->height, n); + REQUEST_SIZE_MATCH(xRenderScaleReq); + swaps(&stuff->length); + swapl(&stuff->src); + swapl(&stuff->dst); + swapl(&stuff->colorScale); + swapl(&stuff->alphaScale); + swaps(&stuff->xSrc); + swaps(&stuff->ySrc); + swaps(&stuff->xDst); + swaps(&stuff->yDst); + swaps(&stuff->width); + swaps(&stuff->height); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTrapezoids (ClientPtr client) { - register int n; REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); - swaps (&stuff->length, n); - swapl (&stuff->src, n); - swapl (&stuff->dst, n); - swapl (&stuff->maskFormat, n); - swaps (&stuff->xSrc, n); - swaps (&stuff->ySrc, n); + swaps (&stuff->length); + swapl (&stuff->src); + swapl (&stuff->dst); + swapl (&stuff->maskFormat); + swaps (&stuff->xSrc); + swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2151,16 +2169,15 @@ SProcRenderTrapezoids (ClientPtr client) static int SProcRenderTriangles (ClientPtr client) { - register int n; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); - swaps (&stuff->length, n); - swapl (&stuff->src, n); - swapl (&stuff->dst, n); - swapl (&stuff->maskFormat, n); - swaps (&stuff->xSrc, n); - swaps (&stuff->ySrc, n); + swaps (&stuff->length); + swapl (&stuff->src); + swapl (&stuff->dst); + swapl (&stuff->maskFormat); + swaps (&stuff->xSrc); + swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2168,16 +2185,15 @@ SProcRenderTriangles (ClientPtr client) static int SProcRenderTriStrip (ClientPtr client) { - register int n; REQUEST(xRenderTriStripReq); REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); - swaps (&stuff->length, n); - swapl (&stuff->src, n); - swapl (&stuff->dst, n); - swapl (&stuff->maskFormat, n); - swaps (&stuff->xSrc, n); - swaps (&stuff->ySrc, n); + swaps (&stuff->length); + swapl (&stuff->src); + swapl (&stuff->dst); + swapl (&stuff->maskFormat); + swaps (&stuff->xSrc); + swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2185,16 +2201,15 @@ SProcRenderTriStrip (ClientPtr client) static int SProcRenderTriFan (ClientPtr client) { - register int n; REQUEST(xRenderTriFanReq); REQUEST_AT_LEAST_SIZE(xRenderTriFanReq); - swaps (&stuff->length, n); - swapl (&stuff->src, n); - swapl (&stuff->dst, n); - swapl (&stuff->maskFormat, n); - swaps (&stuff->xSrc, n); - swaps (&stuff->ySrc, n); + swaps (&stuff->length); + swapl (&stuff->src); + swapl (&stuff->dst); + swapl (&stuff->maskFormat); + swaps (&stuff->xSrc); + swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2220,47 +2235,47 @@ SProcRenderTransform (ClientPtr client) static int SProcRenderCreateGlyphSet (ClientPtr client) { - register int n; REQUEST(xRenderCreateGlyphSetReq); - swaps(&stuff->length, n); - swapl(&stuff->gsid, n); - swapl(&stuff->format, n); + REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); + swaps(&stuff->length); + swapl(&stuff->gsid); + swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderReferenceGlyphSet (ClientPtr client) { - register int n; REQUEST(xRenderReferenceGlyphSetReq); - swaps(&stuff->length, n); - swapl(&stuff->gsid, n); - swapl(&stuff->existing, n); + REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); + swaps(&stuff->length); + swapl(&stuff->gsid); + swapl(&stuff->existing); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderFreeGlyphSet (ClientPtr client) { - register int n; REQUEST(xRenderFreeGlyphSetReq); - swaps(&stuff->length, n); - swapl(&stuff->glyphset, n); + REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); + swaps(&stuff->length); + swapl(&stuff->glyphset); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderAddGlyphs (ClientPtr client) { - register int n; register int i; CARD32 *gids; void *end; xGlyphInfo *gi; REQUEST(xRenderAddGlyphsReq); - swaps(&stuff->length, n); - swapl(&stuff->glyphset, n); - swapl(&stuff->nglyphs, n); + REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); + swaps(&stuff->length); + swapl(&stuff->glyphset); + swapl(&stuff->nglyphs); if (stuff->nglyphs & 0xe0000000) return BadLength; end = (CARD8 *) stuff + (client->req_len << 2); @@ -2272,13 +2287,13 @@ SProcRenderAddGlyphs (ClientPtr client) return BadLength; for (i = 0; i < stuff->nglyphs; i++) { - swapl (&gids[i], n); - swaps (&gi[i].width, n); - swaps (&gi[i].height, n); - swaps (&gi[i].x, n); - swaps (&gi[i].y, n); - swaps (&gi[i].xOff, n); - swaps (&gi[i].yOff, n); + swapl (&gids[i]); + swaps (&gi[i].width); + swaps (&gi[i].height); + swaps (&gi[i].x); + swaps (&gi[i].y); + swaps (&gi[i].xOff); + swaps (&gi[i].yOff); } return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2292,10 +2307,10 @@ SProcRenderAddGlyphsFromPicture (ClientPtr client) static int SProcRenderFreeGlyphs (ClientPtr client) { - register int n; REQUEST(xRenderFreeGlyphsReq); - swaps(&stuff->length, n); - swapl(&stuff->glyphset, n); + REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); + swaps(&stuff->length); + swapl(&stuff->glyphset); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2303,7 +2318,6 @@ SProcRenderFreeGlyphs (ClientPtr client) static int SProcRenderCompositeGlyphs (ClientPtr client) { - register int n; xGlyphElt *elt; CARD8 *buffer; CARD8 *end; @@ -2312,20 +2326,21 @@ SProcRenderCompositeGlyphs (ClientPtr client) int size; REQUEST(xRenderCompositeGlyphsReq); - + REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); + switch (stuff->renderReqType) { default: size = 1; break; case X_RenderCompositeGlyphs16: size = 2; break; case X_RenderCompositeGlyphs32: size = 4; break; } - swaps(&stuff->length, n); - swapl(&stuff->src, n); - swapl(&stuff->dst, n); - swapl(&stuff->maskFormat, n); - swapl(&stuff->glyphset, n); - swaps(&stuff->xSrc, n); - swaps(&stuff->ySrc, n); + swaps(&stuff->length); + swapl(&stuff->src); + swapl(&stuff->dst); + swapl(&stuff->maskFormat); + swapl(&stuff->glyphset); + swaps(&stuff->xSrc); + swaps(&stuff->ySrc); buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); while (buffer + sizeof (xGlyphElt) < end) @@ -2333,13 +2348,13 @@ SProcRenderCompositeGlyphs (ClientPtr client) elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); - swaps (&elt->deltax, n); - swaps (&elt->deltay, n); + swaps (&elt->deltax); + swaps (&elt->deltay); i = elt->len; if (i == 0xff) { - swapl (buffer, n); + swapl ((int *) buffer); buffer += 4; } else @@ -2352,14 +2367,14 @@ SProcRenderCompositeGlyphs (ClientPtr client) case 2: while (i--) { - swaps (buffer, n); + swaps ((short *) buffer); buffer += 2; } break; case 4: while (i--) { - swapl (buffer, n); + swapl ((int *) buffer); buffer += 4; } break; @@ -2374,16 +2389,15 @@ SProcRenderCompositeGlyphs (ClientPtr client) static int SProcRenderFillRectangles (ClientPtr client) { - register int n; REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); - swaps(&stuff->length, n); - swapl(&stuff->dst, n); - swaps(&stuff->color.red, n); - swaps(&stuff->color.green, n); - swaps(&stuff->color.blue, n); - swaps(&stuff->color.alpha, n); + swaps(&stuff->length); + swapl(&stuff->dst); + swaps(&stuff->color.red); + swaps(&stuff->color.green); + swaps(&stuff->color.blue); + swaps(&stuff->color.alpha); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2391,73 +2405,68 @@ SProcRenderFillRectangles (ClientPtr client) static int SProcRenderCreateCursor (ClientPtr client) { - register int n; REQUEST(xRenderCreateCursorReq); REQUEST_SIZE_MATCH (xRenderCreateCursorReq); - swaps(&stuff->length, n); - swapl(&stuff->cid, n); - swapl(&stuff->src, n); - swaps(&stuff->x, n); - swaps(&stuff->y, n); + swaps(&stuff->length); + swapl(&stuff->cid); + swapl(&stuff->src); + swaps(&stuff->x); + swaps(&stuff->y); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderSetPictureTransform (ClientPtr client) { - register int n; REQUEST(xRenderSetPictureTransformReq); REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - swaps(&stuff->length, n); - swapl(&stuff->picture, n); - swapl(&stuff->transform.matrix11, n); - swapl(&stuff->transform.matrix12, n); - swapl(&stuff->transform.matrix13, n); - swapl(&stuff->transform.matrix21, n); - swapl(&stuff->transform.matrix22, n); - swapl(&stuff->transform.matrix23, n); - swapl(&stuff->transform.matrix31, n); - swapl(&stuff->transform.matrix32, n); - swapl(&stuff->transform.matrix33, n); + swaps(&stuff->length); + swapl(&stuff->picture); + swapl(&stuff->transform.matrix11); + swapl(&stuff->transform.matrix12); + swapl(&stuff->transform.matrix13); + swapl(&stuff->transform.matrix21); + swapl(&stuff->transform.matrix22); + swapl(&stuff->transform.matrix23); + swapl(&stuff->transform.matrix31); + swapl(&stuff->transform.matrix32); + swapl(&stuff->transform.matrix33); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderQueryFilters (ClientPtr client) { - register int n; REQUEST (xRenderQueryFiltersReq); REQUEST_SIZE_MATCH (xRenderQueryFiltersReq); - swaps(&stuff->length, n); - swapl(&stuff->drawable, n); + swaps(&stuff->length); + swapl(&stuff->drawable); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderSetPictureFilter (ClientPtr client) { - register int n; REQUEST (xRenderSetPictureFilterReq); REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); - swaps(&stuff->length, n); - swapl(&stuff->picture, n); - swaps(&stuff->nbytes, n); + swaps(&stuff->length); + swapl(&stuff->picture); + swaps(&stuff->nbytes); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCreateAnimCursor (ClientPtr client) { - register int n; REQUEST (xRenderCreateAnimCursorReq); REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq); - swaps(&stuff->length, n); - swapl(&stuff->cid, n); + swaps(&stuff->length); + swapl(&stuff->cid); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2465,14 +2474,13 @@ SProcRenderCreateAnimCursor (ClientPtr client) static int SProcRenderAddTraps (ClientPtr client) { - register int n; REQUEST (xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq); - swaps(&stuff->length, n); - swapl(&stuff->picture, n); - swaps(&stuff->xOff, n); - swaps(&stuff->yOff, n); + swaps(&stuff->length); + swapl(&stuff->picture); + swaps(&stuff->xOff); + swaps(&stuff->yOff); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } @@ -2480,51 +2488,50 @@ SProcRenderAddTraps (ClientPtr client) static int SProcRenderCreateSolidFill(ClientPtr client) { - register int n; REQUEST (xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq); - swaps(&stuff->length, n); - swapl(&stuff->pid, n); - swaps(&stuff->color.alpha, n); - swaps(&stuff->color.red, n); - swaps(&stuff->color.green, n); - swaps(&stuff->color.blue, n); + swaps(&stuff->length); + swapl(&stuff->pid); + swaps(&stuff->color.alpha); + swaps(&stuff->color.red); + swaps(&stuff->color.green); + swaps(&stuff->color.blue); return (*ProcRenderVector[stuff->renderReqType]) (client); } static void swapStops(void *stuff, int num) { - int i, n; + int i; CARD32 *stops; CARD16 *colors; + stops = (CARD32 *)(stuff); for (i = 0; i < num; ++i) { - swapl(stops, n); + swapl(stops); ++stops; } - colors = (CARD16 *)(stops); + colors = (CARD16 *) (stops); for (i = 0; i < 4*num; ++i) { - swaps(stops, n); - ++stops; + swaps(colors); + ++colors; } } static int SProcRenderCreateLinearGradient (ClientPtr client) { - register int n; int len; REQUEST (xRenderCreateLinearGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq); - swaps(&stuff->length, n); - swapl(&stuff->pid, n); - swapl(&stuff->p1.x, n); - swapl(&stuff->p1.y, n); - swapl(&stuff->p2.x, n); - swapl(&stuff->p2.y, n); - swapl(&stuff->nStops, n); + swaps(&stuff->length); + swapl(&stuff->pid); + swapl(&stuff->p1.x); + swapl(&stuff->p1.y); + swapl(&stuff->p2.x); + swapl(&stuff->p2.y); + swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) @@ -2540,20 +2547,19 @@ SProcRenderCreateLinearGradient (ClientPtr client) static int SProcRenderCreateRadialGradient (ClientPtr client) { - register int n; int len; REQUEST (xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq); - swaps(&stuff->length, n); - swapl(&stuff->pid, n); - swapl(&stuff->inner.x, n); - swapl(&stuff->inner.y, n); - swapl(&stuff->outer.x, n); - swapl(&stuff->outer.y, n); - swapl(&stuff->inner_radius, n); - swapl(&stuff->outer_radius, n); - swapl(&stuff->nStops, n); + swaps(&stuff->length); + swapl(&stuff->pid); + swapl(&stuff->inner.x); + swapl(&stuff->inner.y); + swapl(&stuff->outer.x); + swapl(&stuff->outer.y); + swapl(&stuff->inner_radius); + swapl(&stuff->outer_radius); + swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) @@ -2569,17 +2575,16 @@ SProcRenderCreateRadialGradient (ClientPtr client) static int SProcRenderCreateConicalGradient (ClientPtr client) { - register int n; int len; REQUEST (xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq); - swaps(&stuff->length, n); - swapl(&stuff->pid, n); - swapl(&stuff->center.x, n); - swapl(&stuff->center.y, n); - swapl(&stuff->angle, n); - swapl(&stuff->nStops, n); + swaps(&stuff->length); + swapl(&stuff->pid); + swapl(&stuff->center.x); + swapl(&stuff->center.y); + swapl(&stuff->angle); + swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) @@ -2592,6 +2597,7 @@ SProcRenderCreateConicalGradient (ClientPtr client) return (*ProcRenderVector[stuff->renderReqType]) (client); } +#ifndef NXAGENT_SERVER static int SProcRenderDispatch (ClientPtr client) { @@ -2602,6 +2608,7 @@ SProcRenderDispatch (ClientPtr client) else return BadRequest; } +#endif /* NXAGENT_SERVER */ #ifdef PANORAMIX #include "panoramiX.h" @@ -2636,15 +2643,15 @@ PanoramiXRenderCreatePicture (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; - if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; newPict->info[0].id = stuff->pid; if (refDraw->type == XRT_WINDOW && - stuff->drawable == WindowTable[0]->drawable.id) + stuff->drawable == screenInfo.screens[0]->root->drawable.id) { newPict->u.pict.root = TRUE; } @@ -2664,7 +2671,7 @@ PanoramiXRenderCreatePicture (ClientPtr client) if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else - xfree(newPict); + free(newPict); return (result); } @@ -2678,7 +2685,7 @@ PanoramiXRenderChangePicture (ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2699,7 +2706,7 @@ PanoramiXRenderSetPictureClipRectangles (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2720,7 +2727,7 @@ PanoramiXRenderSetPictureTransform (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2741,7 +2748,7 @@ PanoramiXRenderSetPictureFilter (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2764,7 +2771,7 @@ PanoramiXRenderFreePicture (ClientPtr client) client->errorValue = stuff->picture; - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityDestroyAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); @@ -2790,11 +2797,11 @@ PanoramiXRenderComposite (ClientPtr client) REQUEST_SIZE_MATCH(xRenderCompositeReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_ALPHA (msk, stuff->mask, client, SecurityReadAccess, + VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); orig = *stuff; @@ -2838,9 +2845,9 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client) INT16 xSrc, ySrc; REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) + @@ -2881,11 +2888,11 @@ PanoramiXRenderFillRectangles (ClientPtr client) int extra_len; REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -2911,7 +2918,7 @@ PanoramiXRenderFillRectangles (ClientPtr client) result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client); if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -2928,15 +2935,15 @@ PanoramiXRenderTrapezoids(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) { + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -2973,7 +2980,7 @@ PanoramiXRenderTrapezoids(ClientPtr client) if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -2990,15 +2997,15 @@ PanoramiXRenderTriangles(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) { + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -3031,7 +3038,7 @@ PanoramiXRenderTriangles(ClientPtr client) if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -3048,15 +3055,15 @@ PanoramiXRenderTriStrip(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTriStripReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) { + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -3085,7 +3092,7 @@ PanoramiXRenderTriStrip(ClientPtr client) if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -3102,15 +3109,15 @@ PanoramiXRenderTriFan(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTriFanReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) { + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -3139,7 +3146,7 @@ PanoramiXRenderTriFan(ClientPtr client) if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -3158,13 +3165,13 @@ PanoramiXRenderColorTrapezoids(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderColorTrapezoidsReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) { + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -3185,7 +3192,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client) if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -3202,13 +3209,13 @@ PanoramiXRenderColorTriangles(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderColorTrianglesReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) { + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { @@ -3229,7 +3236,7 @@ PanoramiXRenderColorTriangles(ClientPtr client) if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; @@ -3248,11 +3255,11 @@ PanoramiXRenderAddTraps (ClientPtr client) INT16 x_off, y_off; REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq); - VERIFY_XIN_PICTURE (picture, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); if (extra_len && - (extra = (char *) ALLOCATE_LOCAL (extra_len))) + (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); x_off = stuff->xOff; @@ -3269,7 +3276,7 @@ PanoramiXRenderAddTraps (ClientPtr client) result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client); if(result != Success) break; } - DEALLOCATE_LOCAL(extra); + free(extra); } return result; diff --git a/nx-X11/programs/Xserver/render/renderedge.c.NX.original b/nx-X11/programs/Xserver/render/renderedge.c.NX.original deleted file mode 100644 index f095038e5..000000000 --- a/nx-X11/programs/Xserver/render/renderedge.c.NX.original +++ /dev/null @@ -1,202 +0,0 @@ -/* - * $Id: renderedge.c,v 1.4 2005/07/03 07:02:08 daniels Exp $ - * - * Copyright © 2004 Keith Packard - * - * 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 "renderedge.h" - -/* - * Compute the smallest value no less than y which is on a - * grid row - */ - -xFixed -RenderSampleCeilY (xFixed y, int n) -{ - xFixed f = xFixedFrac(y); - xFixed i = xFixedFloor(y); - - f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); - if (f > Y_FRAC_LAST(n)) - { - f = Y_FRAC_FIRST(n); - i += xFixed1; - } - return (i | f); -} - -#define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b))) - -/* - * Compute the largest value no greater than y which is on a - * grid row - */ -xFixed -RenderSampleFloorY (xFixed y, int n) -{ - xFixed f = xFixedFrac(y); - xFixed i = xFixedFloor (y); - - f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); - if (f < Y_FRAC_FIRST(n)) - { - f = Y_FRAC_LAST(n); - i -= xFixed1; - } - return (i | f); -} - -/* - * Step an edge by any amount (including negative values) - */ -void -RenderEdgeStep (RenderEdge *e, int n) -{ - xFixed_48_16 ne; - - e->x += n * e->stepx; - - ne = e->e + n * (xFixed_48_16) e->dx; - - if (n >= 0) - { - if (ne > 0) - { - int nx = (ne + e->dy - 1) / e->dy; - e->e = ne - nx * (xFixed_48_16) e->dy; - e->x += nx * e->signdx; - } - } - else - { - if (ne <= -e->dy) - { - int nx = (-ne) / e->dy; - e->e = ne + nx * (xFixed_48_16) e->dy; - e->x -= nx * e->signdx; - } - } -} - -/* - * A private routine to initialize the multi-step - * elements of an edge structure - */ -static void -_RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p) -{ - xFixed stepx; - xFixed_48_16 ne; - - ne = n * (xFixed_48_16) e->dx; - stepx = n * e->stepx; - if (ne > 0) - { - int nx = ne / e->dy; - ne -= nx * e->dy; - stepx += nx * e->signdx; - } - *dx_p = ne; - *stepx_p = stepx; -} - -/* - * Initialize one edge structure given the line endpoints and a - * starting y value - */ -void -RenderEdgeInit (RenderEdge *e, - int n, - xFixed y_start, - xFixed x_top, - xFixed y_top, - xFixed x_bot, - xFixed y_bot) -{ - xFixed dx, dy; - - e->x = x_top; - e->e = 0; - dx = x_bot - x_top; - dy = y_bot - y_top; - e->dy = dy; - e->dx = 0; - if (dy) - { - if (dx >= 0) - { - e->signdx = 1; - e->stepx = dx / dy; - e->dx = dx % dy; - e->e = -dy; - } - else - { - e->signdx = -1; - e->stepx = -(-dx / dy); - e->dx = -dx % dy; - e->e = 0; - } - - _RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small); - _RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big); - } - RenderEdgeStep (e, y_start - y_top); -} - -/* - * Initialize one edge structure given a line, starting y value - * and a pixel offset for the line - */ -void -RenderLineFixedEdgeInit (RenderEdge *e, - int n, - xFixed y, - xLineFixed *line, - int x_off, - int y_off) -{ - xFixed x_off_fixed = IntToxFixed(x_off); - xFixed y_off_fixed = IntToxFixed(y_off); - xPointFixed *top, *bot; - - if (line->p1.y <= line->p2.y) - { - top = &line->p1; - bot = &line->p2; - } - else - { - top = &line->p2; - bot = &line->p1; - } - RenderEdgeInit (e, n, y, - top->x + x_off_fixed, - top->y + y_off_fixed, - bot->x + x_off_fixed, - bot->y + y_off_fixed); -} - diff --git a/nx-X11/programs/Xserver/render/renderedge.c.X.original b/nx-X11/programs/Xserver/render/renderedge.c.X.original deleted file mode 100644 index b4031944d..000000000 --- a/nx-X11/programs/Xserver/render/renderedge.c.X.original +++ /dev/null @@ -1,201 +0,0 @@ -/* - * $Id: renderedge.c,v 1.4 2005/07/03 07:02:08 daniels Exp $ - * - * Copyright © 2004 Keith Packard - * - * 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 "renderedge.h" - -/* - * Compute the smallest value no less than y which is on a - * grid row - */ - -xFixed -RenderSampleCeilY (xFixed y, int n) -{ - xFixed f = xFixedFrac(y); - xFixed i = xFixedFloor(y); - - f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); - if (f > Y_FRAC_LAST(n)) - { - f = Y_FRAC_FIRST(n); - i += xFixed1; - } - return (i | f); -} - -#define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b))) - -/* - * Compute the largest value no greater than y which is on a - * grid row - */ -xFixed -RenderSampleFloorY (xFixed y, int n) -{ - xFixed f = xFixedFrac(y); - xFixed i = xFixedFloor (y); - - f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); - if (f < Y_FRAC_FIRST(n)) - { - f = Y_FRAC_LAST(n); - i -= xFixed1; - } - return (i | f); -} - -/* - * Step an edge by any amount (including negative values) - */ -void -RenderEdgeStep (RenderEdge *e, int n) -{ - xFixed_48_16 ne; - - e->x += n * e->stepx; - - ne = e->e + n * (xFixed_48_16) e->dx; - - if (n >= 0) - { - if (ne > 0) - { - int nx = (ne + e->dy - 1) / e->dy; - e->e = ne - nx * (xFixed_48_16) e->dy; - e->x += nx * e->signdx; - } - } - else - { - if (ne <= -e->dy) - { - int nx = (-ne) / e->dy; - e->e = ne + nx * (xFixed_48_16) e->dy; - e->x -= nx * e->signdx; - } - } -} - -/* - * A private routine to initialize the multi-step - * elements of an edge structure - */ -static void -_RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p) -{ - xFixed stepx; - xFixed_48_16 ne; - - ne = n * (xFixed_48_16) e->dx; - stepx = n * e->stepx; - if (ne > 0) - { - int nx = ne / e->dy; - ne -= nx * e->dy; - stepx += nx * e->signdx; - } - *dx_p = ne; - *stepx_p = stepx; -} - -/* - * Initialize one edge structure given the line endpoints and a - * starting y value - */ -void -RenderEdgeInit (RenderEdge *e, - int n, - xFixed y_start, - xFixed x_top, - xFixed y_top, - xFixed x_bot, - xFixed y_bot) -{ - xFixed dx, dy; - - e->x = x_top; - e->e = 0; - dx = x_bot - x_top; - dy = y_bot - y_top; - e->dy = dy; - if (dy) - { - if (dx >= 0) - { - e->signdx = 1; - e->stepx = dx / dy; - e->dx = dx % dy; - e->e = -dy; - } - else - { - e->signdx = -1; - e->stepx = -(-dx / dy); - e->dx = -dx % dy; - e->e = 0; - } - - _RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small); - _RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big); - } - RenderEdgeStep (e, y_start - y_top); -} - -/* - * Initialize one edge structure given a line, starting y value - * and a pixel offset for the line - */ -void -RenderLineFixedEdgeInit (RenderEdge *e, - int n, - xFixed y, - xLineFixed *line, - int x_off, - int y_off) -{ - xFixed x_off_fixed = IntToxFixed(x_off); - xFixed y_off_fixed = IntToxFixed(y_off); - xPointFixed *top, *bot; - - if (line->p1.y <= line->p2.y) - { - top = &line->p1; - bot = &line->p2; - } - else - { - top = &line->p2; - bot = &line->p1; - } - RenderEdgeInit (e, n, y, - top->x + x_off_fixed, - top->y + y_off_fixed, - bot->x + x_off_fixed, - bot->y + y_off_fixed); -} - |
