aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/render
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/render')
-rw-r--r--xorg-server/render/mipict.c1216
-rw-r--r--xorg-server/render/render.c442
2 files changed, 810 insertions, 848 deletions
diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c
index 1623b335f..9a44c2729 100644
--- a/xorg-server/render/mipict.c
+++ b/xorg-server/render/mipict.c
@@ -1,610 +1,606 @@
-/*
- *
- * Copyright © 1999 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 "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "mipict.h"
-
-#ifndef __GNUC__
-#define __inline
-#endif
-
-int
-miCreatePicture (PicturePtr pPicture)
-{
- return Success;
-}
-
-void
-miDestroyPicture (PicturePtr pPicture)
-{
- if (pPicture->freeCompClip)
- RegionDestroy(pPicture->pCompositeClip);
-}
-
-void
-miDestroyPictureClip (PicturePtr pPicture)
-{
- switch (pPicture->clientClipType) {
- case CT_NONE:
- return;
- case CT_PIXMAP:
- (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
- break;
- default:
- /*
- * we know we'll never have a list of rectangles, since ChangeClip
- * immediately turns them into a region
- */
- RegionDestroy(pPicture->clientClip);
- break;
- }
- pPicture->clientClip = NULL;
- pPicture->clientClipType = CT_NONE;
-}
-
-int
-miChangePictureClip (PicturePtr pPicture,
- int type,
- pointer value,
- int n)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- pointer clientClip;
- int clientClipType;
-
- switch (type) {
- case CT_PIXMAP:
- /* convert the pixmap to a region */
- clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value);
- if (!clientClip)
- return BadAlloc;
- clientClipType = CT_REGION;
- (*pScreen->DestroyPixmap) ((PixmapPtr) value);
- break;
- case CT_REGION:
- clientClip = value;
- clientClipType = CT_REGION;
- break;
- case CT_NONE:
- clientClip = 0;
- clientClipType = CT_NONE;
- break;
- default:
- clientClip = (pointer) RegionFromRects(n,
- (xRectangle *) value,
- type);
- if (!clientClip)
- return BadAlloc;
- clientClipType = CT_REGION;
- free(value);
- break;
- }
- (*ps->DestroyPictureClip) (pPicture);
- pPicture->clientClip = clientClip;
- pPicture->clientClipType = clientClipType;
- pPicture->stateChanges |= CPClipMask;
- return Success;
-}
-
-void
-miChangePicture (PicturePtr pPicture,
- Mask mask)
-{
- return;
-}
-
-void
-miValidatePicture (PicturePtr pPicture,
- Mask mask)
-{
- DrawablePtr pDrawable = pPicture->pDrawable;
-
- if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) ||
- (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS)))
- {
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWin = (WindowPtr) pDrawable;
- RegionPtr pregWin;
- Bool freeTmpClip, freeCompClip;
-
- if (pPicture->subWindowMode == IncludeInferiors)
- {
- pregWin = NotClippedByChildren(pWin);
- freeTmpClip = TRUE;
- }
- else
- {
- pregWin = &pWin->clipList;
- freeTmpClip = FALSE;
- }
- freeCompClip = pPicture->freeCompClip;
-
- /*
- * if there is no client clip, we can get by with just keeping the
- * pointer we got, and remembering whether or not should destroy
- * (or maybe re-use) it later. this way, we avoid unnecessary
- * copying of regions. (this wins especially if many clients clip
- * by children and have no client clip.)
- */
- if (pPicture->clientClipType == CT_NONE)
- {
- if (freeCompClip)
- RegionDestroy(pPicture->pCompositeClip);
- pPicture->pCompositeClip = pregWin;
- pPicture->freeCompClip = freeTmpClip;
- }
- else
- {
- /*
- * we need one 'real' region to put into the composite clip. if
- * pregWin the current composite clip are real, we can get rid of
- * one. if pregWin is real and the current composite clip isn't,
- * use pregWin for the composite clip. if the current composite
- * clip is real and pregWin isn't, use the current composite
- * clip. if neither is real, create a new region.
- */
-
- RegionTranslate(pPicture->clientClip,
- pDrawable->x + pPicture->clipOrigin.x,
- pDrawable->y + pPicture->clipOrigin.y);
-
- if (freeCompClip)
- {
- RegionIntersect(pPicture->pCompositeClip,
- pregWin, pPicture->clientClip);
- if (freeTmpClip)
- RegionDestroy(pregWin);
- }
- else if (freeTmpClip)
- {
- RegionIntersect(pregWin, pregWin, pPicture->clientClip);
- pPicture->pCompositeClip = pregWin;
- }
- else
- {
- pPicture->pCompositeClip = RegionCreate(NullBox, 0);
- RegionIntersect(pPicture->pCompositeClip,
- pregWin, pPicture->clientClip);
- }
- pPicture->freeCompClip = TRUE;
- RegionTranslate(pPicture->clientClip,
- -(pDrawable->x + pPicture->clipOrigin.x),
- -(pDrawable->y + pPicture->clipOrigin.y));
- }
- } /* end of composite clip for a window */
- else
- {
- BoxRec pixbounds;
-
- /* XXX should we translate by drawable.x/y here ? */
- /* If you want pixmaps in offscreen memory, yes */
- pixbounds.x1 = pDrawable->x;
- pixbounds.y1 = pDrawable->y;
- pixbounds.x2 = pDrawable->x + pDrawable->width;
- pixbounds.y2 = pDrawable->y + pDrawable->height;
-
- if (pPicture->freeCompClip)
- {
- RegionReset(pPicture->pCompositeClip, &pixbounds);
- }
- else
- {
- pPicture->freeCompClip = TRUE;
- pPicture->pCompositeClip = RegionCreate(&pixbounds, 1);
- }
-
- if (pPicture->clientClipType == CT_REGION)
- {
- if(pDrawable->x || pDrawable->y) {
- RegionTranslate(pPicture->clientClip,
- pDrawable->x + pPicture->clipOrigin.x,
- pDrawable->y + pPicture->clipOrigin.y);
- RegionIntersect(pPicture->pCompositeClip,
- pPicture->pCompositeClip, pPicture->clientClip);
- RegionTranslate(pPicture->clientClip,
- -(pDrawable->x + pPicture->clipOrigin.x),
- -(pDrawable->y + pPicture->clipOrigin.y));
- } else {
- RegionTranslate(pPicture->pCompositeClip,
- -pPicture->clipOrigin.x, -pPicture->clipOrigin.y);
- RegionIntersect(pPicture->pCompositeClip,
- pPicture->pCompositeClip, pPicture->clientClip);
- RegionTranslate(pPicture->pCompositeClip,
- pPicture->clipOrigin.x, pPicture->clipOrigin.y);
- }
- }
- } /* end of composite clip for pixmap */
- }
-}
-
-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 pixman_bool_t
-miClipPictureReg (pixman_region16_t * pRegion,
- pixman_region16_t * pClip,
- int dx,
- int dy)
-{
- if (pixman_region_n_rects(pRegion) == 1 &&
- pixman_region_n_rects(pClip) == 1)
- {
- pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
- pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
- int v;
-
- if (pRbox->x1 < (v = pCbox->x1 + dx))
- pRbox->x1 = BOUND(v);
- if (pRbox->x2 > (v = pCbox->x2 + dx))
- pRbox->x2 = BOUND(v);
- if (pRbox->y1 < (v = pCbox->y1 + dy))
- pRbox->y1 = BOUND(v);
- if (pRbox->y2 > (v = pCbox->y2 + dy))
- pRbox->y2 = BOUND(v);
- if (pRbox->x1 >= pRbox->x2 ||
- pRbox->y1 >= pRbox->y2)
- {
- pixman_region_init (pRegion);
- }
- }
- else if (!pixman_region_not_empty (pClip))
- return FALSE;
- else
- {
- if (dx || dy)
- pixman_region_translate (pRegion, -dx, -dy);
- if (!pixman_region_intersect (pRegion, pRegion, pClip))
- return FALSE;
- if (dx || dy)
- pixman_region_translate(pRegion, dx, dy);
- }
- return pixman_region_not_empty(pRegion);
-}
-
-static __inline Bool
-miClipPictureSrc (RegionPtr pRegion,
- PicturePtr pPicture,
- int dx,
- int dy)
-{
- if (pPicture->clientClipType != CT_NONE)
- {
- Bool result;
-
- pixman_region_translate ( pPicture->clientClip,
- pPicture->clipOrigin.x + dx,
- pPicture->clipOrigin.y + dy);
-
- result = RegionIntersect(pRegion, pRegion, pPicture->clientClip);
-
- pixman_region_translate ( pPicture->clientClip,
- - (pPicture->clipOrigin.x + dx),
- - (pPicture->clipOrigin.y + dy));
-
- if (!result)
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-SourceValidateOnePicture (PicturePtr pPicture)
-{
- DrawablePtr pDrawable = pPicture->pDrawable;
- ScreenPtr pScreen;
-
- if (!pDrawable)
- return;
-
- pScreen = pDrawable->pScreen;
-
- if (pScreen->SourceValidate)
- {
- pScreen->SourceValidate (
- pDrawable, 0, 0, pDrawable->width, pDrawable->height, pPicture->subWindowMode);
- }
-}
-
-void
-miCompositeSourceValidate (PicturePtr pPicture)
-{
- SourceValidateOnePicture (pPicture);
- if (pPicture->alphaMap)
- SourceValidateOnePicture (pPicture->alphaMap);
-}
-
-/*
- * returns FALSE if the final region is empty. Indistinguishable from
- * an allocation failure, but rendering ignores those anyways.
- */
-
-Bool
-miComputeCompositeRegion (RegionPtr pRegion,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
-
- int v;
-
- pRegion->extents.x1 = xDst;
- v = xDst + width;
- pRegion->extents.x2 = BOUND(v);
- pRegion->extents.y1 = yDst;
- v = yDst + height;
- pRegion->extents.y2 = BOUND(v);
- pRegion->data = 0;
- /* Check for empty operation */
- if (pRegion->extents.x1 >= pRegion->extents.x2 ||
- pRegion->extents.y1 >= pRegion->extents.y2)
- {
- pixman_region_init (pRegion);
- return FALSE;
- }
- /* clip against dst */
- if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- if (pDst->alphaMap)
- {
- if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip,
- -pDst->alphaOrigin.x,
- -pDst->alphaOrigin.y))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- }
- /* clip against src */
- if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- if (pSrc->alphaMap)
- {
- if (!miClipPictureSrc (pRegion, pSrc->alphaMap,
- xDst - (xSrc - pSrc->alphaOrigin.x),
- yDst - (ySrc - pSrc->alphaOrigin.y)))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- }
- /* clip against mask */
- if (pMask)
- {
- if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- if (pMask->alphaMap)
- {
- if (!miClipPictureSrc (pRegion, pMask->alphaMap,
- xDst - (xMask - pMask->alphaOrigin.x),
- yDst - (yMask - pMask->alphaOrigin.y)))
- {
- pixman_region_fini (pRegion);
- return FALSE;
- }
- }
- }
-
-
- miCompositeSourceValidate (pSrc);
- if (pMask)
- miCompositeSourceValidate (pMask);
-
- return TRUE;
-}
-
-void
-miRenderColorToPixel (PictFormatPtr format,
- xRenderColor *color,
- CARD32 *pixel)
-{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
-
- switch (format->type) {
- case PictTypeDirect:
- r = color->red >> (16 - Ones (format->direct.redMask));
- g = color->green >> (16 - Ones (format->direct.greenMask));
- b = color->blue >> (16 - Ones (format->direct.blueMask));
- a = color->alpha >> (16 - Ones (format->direct.alphaMask));
- r = r << format->direct.red;
- g = g << format->direct.green;
- b = b << format->direct.blue;
- a = a << format->direct.alpha;
- *pixel = r|g|b|a;
- break;
- case PictTypeIndexed:
- pIndexed = (miIndexedPtr) (format->index.devPrivate);
- if (pIndexed->color)
- {
- r = color->red >> 11;
- g = color->green >> 11;
- b = color->blue >> 11;
- *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b);
- }
- else
- {
- r = color->red >> 8;
- g = color->green >> 8;
- b = color->blue >> 8;
- *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b);
- }
- break;
- }
-}
-
-static CARD16
-miFillColor (CARD32 pixel, int bits)
-{
- while (bits < 16)
- {
- pixel |= pixel << bits;
- bits <<= 1;
- }
- return (CARD16) pixel;
-}
-
-Bool
-miIsSolidAlpha (PicturePtr pSrc)
-{
- ScreenPtr pScreen;
- char line[1];
-
- if (!pSrc->pDrawable)
- return FALSE;
-
- pScreen = pSrc->pDrawable->pScreen;
-
- /* Alpha-only */
- if (PICT_FORMAT_TYPE (pSrc->format) != PICT_TYPE_A)
- return FALSE;
- /* repeat */
- if (!pSrc->repeat)
- return FALSE;
- /* 1x1 */
- if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
- return FALSE;
- line[0] = 1;
- (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line);
- switch (pSrc->pDrawable->bitsPerPixel) {
- case 1:
- return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80;
- case 4:
- return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
- case 8:
- return (CARD8) line[0] == 0xff;
- default:
- return FALSE;
- }
-}
-
-void
-miRenderPixelToColor (PictFormatPtr format,
- CARD32 pixel,
- xRenderColor *color)
-{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
-
- switch (format->type) {
- case PictTypeDirect:
- r = (pixel >> format->direct.red) & format->direct.redMask;
- g = (pixel >> format->direct.green) & format->direct.greenMask;
- b = (pixel >> format->direct.blue) & format->direct.blueMask;
- a = (pixel >> format->direct.alpha) & format->direct.alphaMask;
- color->red = miFillColor (r, Ones (format->direct.redMask));
- color->green = miFillColor (g, Ones (format->direct.greenMask));
- color->blue = miFillColor (b, Ones (format->direct.blueMask));
- color->alpha = miFillColor (a, Ones (format->direct.alphaMask));
- break;
- case PictTypeIndexed:
- pIndexed = (miIndexedPtr) (format->index.devPrivate);
- pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)];
- r = (pixel >> 16) & 0xff;
- g = (pixel >> 8) & 0xff;
- b = (pixel ) & 0xff;
- color->red = miFillColor (r, 8);
- color->green = miFillColor (g, 8);
- color->blue = miFillColor (b, 8);
- color->alpha = 0xffff;
- break;
- }
-}
-
-Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
-{
- PictureScreenPtr ps;
-
- if (!PictureInit (pScreen, formats, nformats))
- return FALSE;
- ps = GetPictureScreen(pScreen);
- ps->CreatePicture = miCreatePicture;
- ps->DestroyPicture = miDestroyPicture;
- ps->ChangePictureClip = miChangePictureClip;
- ps->DestroyPictureClip = miDestroyPictureClip;
- ps->ChangePicture = miChangePicture;
- ps->ValidatePicture = miValidatePicture;
- ps->InitIndexed = miInitIndexed;
- ps->CloseIndexed = miCloseIndexed;
- ps->UpdateIndexed = miUpdateIndexed;
- ps->ChangePictureTransform = miChangePictureTransform;
- ps->ChangePictureFilter = miChangePictureFilter;
- ps->RealizeGlyph = miRealizeGlyph;
- ps->UnrealizeGlyph = miUnrealizeGlyph;
-
- /* MI rendering routines */
- ps->Composite = 0; /* requires DDX support */
- ps->Glyphs = miGlyphs;
- ps->CompositeRects = miCompositeRects;
- ps->Trapezoids = 0;
- ps->Triangles = 0;
-
- ps->RasterizeTrapezoid = 0; /* requires DDX support */
- ps->AddTraps = 0; /* requires DDX support */
- ps->AddTriangles = 0; /* requires DDX support */
-
- return TRUE;
-}
+/*
+ *
+ * Copyright © 1999 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 "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "mipict.h"
+
+int
+miCreatePicture (PicturePtr pPicture)
+{
+ return Success;
+}
+
+void
+miDestroyPicture (PicturePtr pPicture)
+{
+ if (pPicture->freeCompClip)
+ RegionDestroy(pPicture->pCompositeClip);
+}
+
+void
+miDestroyPictureClip (PicturePtr pPicture)
+{
+ switch (pPicture->clientClipType) {
+ case CT_NONE:
+ return;
+ case CT_PIXMAP:
+ (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
+ break;
+ default:
+ /*
+ * we know we'll never have a list of rectangles, since ChangeClip
+ * immediately turns them into a region
+ */
+ RegionDestroy(pPicture->clientClip);
+ break;
+ }
+ pPicture->clientClip = NULL;
+ pPicture->clientClipType = CT_NONE;
+}
+
+int
+miChangePictureClip (PicturePtr pPicture,
+ int type,
+ pointer value,
+ int n)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ pointer clientClip;
+ int clientClipType;
+
+ switch (type) {
+ case CT_PIXMAP:
+ /* convert the pixmap to a region */
+ clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value);
+ if (!clientClip)
+ return BadAlloc;
+ clientClipType = CT_REGION;
+ (*pScreen->DestroyPixmap) ((PixmapPtr) value);
+ break;
+ case CT_REGION:
+ clientClip = value;
+ clientClipType = CT_REGION;
+ break;
+ case CT_NONE:
+ clientClip = 0;
+ clientClipType = CT_NONE;
+ break;
+ default:
+ clientClip = (pointer) RegionFromRects(n,
+ (xRectangle *) value,
+ type);
+ if (!clientClip)
+ return BadAlloc;
+ clientClipType = CT_REGION;
+ free(value);
+ break;
+ }
+ (*ps->DestroyPictureClip) (pPicture);
+ pPicture->clientClip = clientClip;
+ pPicture->clientClipType = clientClipType;
+ pPicture->stateChanges |= CPClipMask;
+ return Success;
+}
+
+void
+miChangePicture (PicturePtr pPicture,
+ Mask mask)
+{
+ return;
+}
+
+void
+miValidatePicture (PicturePtr pPicture,
+ Mask mask)
+{
+ DrawablePtr pDrawable = pPicture->pDrawable;
+
+ if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) ||
+ (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS)))
+ {
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pPicture->subWindowMode == IncludeInferiors)
+ {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else
+ {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pPicture->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy
+ * (or maybe re-use) it later. this way, we avoid unnecessary
+ * copying of regions. (this wins especially if many clients clip
+ * by children and have no client clip.)
+ */
+ if (pPicture->clientClipType == CT_NONE)
+ {
+ if (freeCompClip)
+ RegionDestroy(pPicture->pCompositeClip);
+ pPicture->pCompositeClip = pregWin;
+ pPicture->freeCompClip = freeTmpClip;
+ }
+ else
+ {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ RegionTranslate(pPicture->clientClip,
+ pDrawable->x + pPicture->clipOrigin.x,
+ pDrawable->y + pPicture->clipOrigin.y);
+
+ if (freeCompClip)
+ {
+ RegionIntersect(pPicture->pCompositeClip,
+ pregWin, pPicture->clientClip);
+ if (freeTmpClip)
+ RegionDestroy(pregWin);
+ }
+ else if (freeTmpClip)
+ {
+ RegionIntersect(pregWin, pregWin, pPicture->clientClip);
+ pPicture->pCompositeClip = pregWin;
+ }
+ else
+ {
+ pPicture->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pPicture->pCompositeClip,
+ pregWin, pPicture->clientClip);
+ }
+ pPicture->freeCompClip = TRUE;
+ RegionTranslate(pPicture->clientClip,
+ -(pDrawable->x + pPicture->clipOrigin.x),
+ -(pDrawable->y + pPicture->clipOrigin.y));
+ }
+ } /* end of composite clip for a window */
+ else
+ {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ /* If you want pixmaps in offscreen memory, yes */
+ pixbounds.x1 = pDrawable->x;
+ pixbounds.y1 = pDrawable->y;
+ pixbounds.x2 = pDrawable->x + pDrawable->width;
+ pixbounds.y2 = pDrawable->y + pDrawable->height;
+
+ if (pPicture->freeCompClip)
+ {
+ RegionReset(pPicture->pCompositeClip, &pixbounds);
+ }
+ else
+ {
+ pPicture->freeCompClip = TRUE;
+ pPicture->pCompositeClip = RegionCreate(&pixbounds, 1);
+ }
+
+ if (pPicture->clientClipType == CT_REGION)
+ {
+ if(pDrawable->x || pDrawable->y) {
+ RegionTranslate(pPicture->clientClip,
+ pDrawable->x + pPicture->clipOrigin.x,
+ pDrawable->y + pPicture->clipOrigin.y);
+ RegionIntersect(pPicture->pCompositeClip,
+ pPicture->pCompositeClip, pPicture->clientClip);
+ RegionTranslate(pPicture->clientClip,
+ -(pDrawable->x + pPicture->clipOrigin.x),
+ -(pDrawable->y + pPicture->clipOrigin.y));
+ } else {
+ RegionTranslate(pPicture->pCompositeClip,
+ -pPicture->clipOrigin.x, -pPicture->clipOrigin.y);
+ RegionIntersect(pPicture->pCompositeClip,
+ pPicture->pCompositeClip, pPicture->clientClip);
+ RegionTranslate(pPicture->pCompositeClip,
+ pPicture->clipOrigin.x, pPicture->clipOrigin.y);
+ }
+ }
+ } /* end of composite clip for pixmap */
+ }
+}
+
+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 pixman_bool_t
+miClipPictureReg (pixman_region16_t * pRegion,
+ pixman_region16_t * pClip,
+ int dx,
+ int dy)
+{
+ if (pixman_region_n_rects(pRegion) == 1 &&
+ pixman_region_n_rects(pClip) == 1)
+ {
+ pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
+ pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
+ int v;
+
+ if (pRbox->x1 < (v = pCbox->x1 + dx))
+ pRbox->x1 = BOUND(v);
+ if (pRbox->x2 > (v = pCbox->x2 + dx))
+ pRbox->x2 = BOUND(v);
+ if (pRbox->y1 < (v = pCbox->y1 + dy))
+ pRbox->y1 = BOUND(v);
+ if (pRbox->y2 > (v = pCbox->y2 + dy))
+ pRbox->y2 = BOUND(v);
+ if (pRbox->x1 >= pRbox->x2 ||
+ pRbox->y1 >= pRbox->y2)
+ {
+ pixman_region_init (pRegion);
+ }
+ }
+ else if (!pixman_region_not_empty (pClip))
+ return FALSE;
+ else
+ {
+ if (dx || dy)
+ pixman_region_translate (pRegion, -dx, -dy);
+ if (!pixman_region_intersect (pRegion, pRegion, pClip))
+ return FALSE;
+ if (dx || dy)
+ pixman_region_translate(pRegion, dx, dy);
+ }
+ return pixman_region_not_empty(pRegion);
+}
+
+static inline Bool
+miClipPictureSrc (RegionPtr pRegion,
+ PicturePtr pPicture,
+ int dx,
+ int dy)
+{
+ if (pPicture->clientClipType != CT_NONE)
+ {
+ Bool result;
+
+ pixman_region_translate ( pPicture->clientClip,
+ pPicture->clipOrigin.x + dx,
+ pPicture->clipOrigin.y + dy);
+
+ result = RegionIntersect(pRegion, pRegion, pPicture->clientClip);
+
+ pixman_region_translate ( pPicture->clientClip,
+ - (pPicture->clipOrigin.x + dx),
+ - (pPicture->clipOrigin.y + dy));
+
+ if (!result)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+SourceValidateOnePicture (PicturePtr pPicture)
+{
+ DrawablePtr pDrawable = pPicture->pDrawable;
+ ScreenPtr pScreen;
+
+ if (!pDrawable)
+ return;
+
+ pScreen = pDrawable->pScreen;
+
+ if (pScreen->SourceValidate)
+ {
+ pScreen->SourceValidate (
+ pDrawable, 0, 0, pDrawable->width, pDrawable->height, pPicture->subWindowMode);
+ }
+}
+
+void
+miCompositeSourceValidate (PicturePtr pPicture)
+{
+ SourceValidateOnePicture (pPicture);
+ if (pPicture->alphaMap)
+ SourceValidateOnePicture (pPicture->alphaMap);
+}
+
+/*
+ * returns FALSE if the final region is empty. Indistinguishable from
+ * an allocation failure, but rendering ignores those anyways.
+ */
+
+Bool
+miComputeCompositeRegion (RegionPtr pRegion,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+
+ int v;
+
+ pRegion->extents.x1 = xDst;
+ v = xDst + width;
+ pRegion->extents.x2 = BOUND(v);
+ pRegion->extents.y1 = yDst;
+ v = yDst + height;
+ pRegion->extents.y2 = BOUND(v);
+ pRegion->data = 0;
+ /* Check for empty operation */
+ if (pRegion->extents.x1 >= pRegion->extents.x2 ||
+ pRegion->extents.y1 >= pRegion->extents.y2)
+ {
+ pixman_region_init (pRegion);
+ return FALSE;
+ }
+ /* clip against dst */
+ if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0))
+ {
+ pixman_region_fini (pRegion);
+ return FALSE;
+ }
+ if (pDst->alphaMap)
+ {
+ if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip,
+ -pDst->alphaOrigin.x,
+ -pDst->alphaOrigin.y))
+ {
+ pixman_region_fini (pRegion);
+ return FALSE;
+ }
+ }
+ /* clip against src */
+ if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
+ {
+ pixman_region_fini (pRegion);
+ return FALSE;
+ }
+ if (pSrc->alphaMap)
+ {
+ if (!miClipPictureSrc (pRegion, pSrc->alphaMap,
+ xDst - (xSrc - pSrc->alphaOrigin.x),
+ yDst - (ySrc - pSrc->alphaOrigin.y)))
+ {
+ pixman_region_fini (pRegion);
+ return FALSE;
+ }
+ }
+ /* clip against mask */
+ if (pMask)
+ {
+ if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
+ {
+ pixman_region_fini (pRegion);
+ return FALSE;
+ }
+ if (pMask->alphaMap)
+ {
+ if (!miClipPictureSrc (pRegion, pMask->alphaMap,
+ xDst - (xMask - pMask->alphaOrigin.x),
+ yDst - (yMask - pMask->alphaOrigin.y)))
+ {
+ pixman_region_fini (pRegion);
+ return FALSE;
+ }
+ }
+ }
+
+
+ miCompositeSourceValidate (pSrc);
+ if (pMask)
+ miCompositeSourceValidate (pMask);
+
+ return TRUE;
+}
+
+void
+miRenderColorToPixel (PictFormatPtr format,
+ xRenderColor *color,
+ CARD32 *pixel)
+{
+ CARD32 r, g, b, a;
+ miIndexedPtr pIndexed;
+
+ switch (format->type) {
+ case PictTypeDirect:
+ r = color->red >> (16 - Ones (format->direct.redMask));
+ g = color->green >> (16 - Ones (format->direct.greenMask));
+ b = color->blue >> (16 - Ones (format->direct.blueMask));
+ a = color->alpha >> (16 - Ones (format->direct.alphaMask));
+ r = r << format->direct.red;
+ g = g << format->direct.green;
+ b = b << format->direct.blue;
+ a = a << format->direct.alpha;
+ *pixel = r|g|b|a;
+ break;
+ case PictTypeIndexed:
+ pIndexed = (miIndexedPtr) (format->index.devPrivate);
+ if (pIndexed->color)
+ {
+ r = color->red >> 11;
+ g = color->green >> 11;
+ b = color->blue >> 11;
+ *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b);
+ }
+ else
+ {
+ r = color->red >> 8;
+ g = color->green >> 8;
+ b = color->blue >> 8;
+ *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b);
+ }
+ break;
+ }
+}
+
+static CARD16
+miFillColor (CARD32 pixel, int bits)
+{
+ while (bits < 16)
+ {
+ pixel |= pixel << bits;
+ bits <<= 1;
+ }
+ return (CARD16) pixel;
+}
+
+Bool
+miIsSolidAlpha (PicturePtr pSrc)
+{
+ ScreenPtr pScreen;
+ char line[1];
+
+ if (!pSrc->pDrawable)
+ return FALSE;
+
+ pScreen = pSrc->pDrawable->pScreen;
+
+ /* Alpha-only */
+ if (PICT_FORMAT_TYPE (pSrc->format) != PICT_TYPE_A)
+ return FALSE;
+ /* repeat */
+ if (!pSrc->repeat)
+ return FALSE;
+ /* 1x1 */
+ if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
+ return FALSE;
+ line[0] = 1;
+ (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line);
+ switch (pSrc->pDrawable->bitsPerPixel) {
+ case 1:
+ return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80;
+ case 4:
+ return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
+ case 8:
+ return (CARD8) line[0] == 0xff;
+ default:
+ return FALSE;
+ }
+}
+
+void
+miRenderPixelToColor (PictFormatPtr format,
+ CARD32 pixel,
+ xRenderColor *color)
+{
+ CARD32 r, g, b, a;
+ miIndexedPtr pIndexed;
+
+ switch (format->type) {
+ case PictTypeDirect:
+ r = (pixel >> format->direct.red) & format->direct.redMask;
+ g = (pixel >> format->direct.green) & format->direct.greenMask;
+ b = (pixel >> format->direct.blue) & format->direct.blueMask;
+ a = (pixel >> format->direct.alpha) & format->direct.alphaMask;
+ color->red = miFillColor (r, Ones (format->direct.redMask));
+ color->green = miFillColor (g, Ones (format->direct.greenMask));
+ color->blue = miFillColor (b, Ones (format->direct.blueMask));
+ color->alpha = miFillColor (a, Ones (format->direct.alphaMask));
+ break;
+ case PictTypeIndexed:
+ pIndexed = (miIndexedPtr) (format->index.devPrivate);
+ pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)];
+ r = (pixel >> 16) & 0xff;
+ g = (pixel >> 8) & 0xff;
+ b = (pixel ) & 0xff;
+ color->red = miFillColor (r, 8);
+ color->green = miFillColor (g, 8);
+ color->blue = miFillColor (b, 8);
+ color->alpha = 0xffff;
+ break;
+ }
+}
+
+Bool
+miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
+ PictureScreenPtr ps;
+
+ if (!PictureInit (pScreen, formats, nformats))
+ return FALSE;
+ ps = GetPictureScreen(pScreen);
+ ps->CreatePicture = miCreatePicture;
+ ps->DestroyPicture = miDestroyPicture;
+ ps->ChangePictureClip = miChangePictureClip;
+ ps->DestroyPictureClip = miDestroyPictureClip;
+ ps->ChangePicture = miChangePicture;
+ ps->ValidatePicture = miValidatePicture;
+ ps->InitIndexed = miInitIndexed;
+ ps->CloseIndexed = miCloseIndexed;
+ ps->UpdateIndexed = miUpdateIndexed;
+ ps->ChangePictureTransform = miChangePictureTransform;
+ ps->ChangePictureFilter = miChangePictureFilter;
+ ps->RealizeGlyph = miRealizeGlyph;
+ ps->UnrealizeGlyph = miUnrealizeGlyph;
+
+ /* MI rendering routines */
+ ps->Composite = 0; /* requires DDX support */
+ ps->Glyphs = miGlyphs;
+ ps->CompositeRects = miCompositeRects;
+ ps->Trapezoids = 0;
+ ps->Triangles = 0;
+
+ ps->RasterizeTrapezoid = 0; /* requires DDX support */
+ ps->AddTraps = 0; /* requires DDX support */
+ ps->AddTriangles = 0; /* requires DDX support */
+
+ return TRUE;
+}
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index ebb1d630a..cc13dbc2a 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -276,7 +276,6 @@ ProcRenderQueryVersion (ClientPtr client)
{
RenderClientPtr pRenderClient = GetRenderClient (client);
xRenderQueryVersionReply rep;
- register int n;
REQUEST(xRenderQueryVersionReq);
pRenderClient->major_version = stuff->majorVersion;
@@ -300,10 +299,10 @@ ProcRenderQueryVersion (ClientPtr client)
}
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);
return Success;
@@ -345,7 +344,6 @@ ProcRenderQueryPictFormats (ClientPtr client)
int nvisual;
int rlength;
int s;
- int n;
int numScreens;
int numSubpixel;
/* REQUEST(xRenderQueryPictFormatsReq); */
@@ -432,16 +430,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++;
}
@@ -471,8 +469,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++;
@@ -482,7 +480,7 @@ ProcRenderQueryPictFormats (ClientPtr client)
pictDepth->nPictVisuals = nvisual;
if (client->swapped)
{
- swaps (&pictDepth->nPictVisuals, n);
+ swaps(&pictDepth->nPictVisuals);
}
ndepth++;
pictDepth = (xPictDepth *) pictVisual;
@@ -495,8 +493,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;
}
@@ -512,20 +510,20 @@ 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);
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapl(&reply->numFormats);
+ swapl(&reply->numScreens);
+ swapl(&reply->numDepths);
+ swapl(&reply->numVisuals);
+ swapl(&reply->numSubpixel);
}
WriteToClient(client, rlength, (char *) reply);
free(reply);
@@ -538,7 +536,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
PictFormatPtr pFormat;
int rc, num;
int rlength;
- int i, n;
+ int i;
REQUEST(xRenderQueryPictIndexValuesReq);
xRenderQueryPictIndexValuesReply *reply;
xIndexValue *values;
@@ -575,15 +573,15 @@ 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);
@@ -1822,16 +1820,14 @@ 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);
free(reply);
@@ -2068,31 +2064,28 @@ ProcRenderDispatch (ClientPtr client)
static int
SProcRenderQueryVersion (ClientPtr client)
{
- register int n;
REQUEST(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);
+ 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);
+ swaps(&stuff->length);
+ swapl(&stuff->format);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
@@ -2105,13 +2098,12 @@ 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);
+ swaps(&stuff->length);
+ swapl(&stuff->pid);
+ swapl(&stuff->drawable);
+ swapl(&stuff->format);
+ swapl(&stuff->mask);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
@@ -2119,11 +2111,10 @@ 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);
+ swaps(&stuff->length);
+ swapl(&stuff->picture);
+ swapl(&stuff->mask);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
@@ -2131,12 +2122,11 @@ SProcRenderChangePicture (ClientPtr client)
static int
SProcRenderSetPictureClipRectangles (ClientPtr client)
{
- register int n;
REQUEST(xRenderSetPictureClipRectanglesReq);
- swaps(&stuff->length, n);
- swapl(&stuff->picture, n);
- swaps(&stuff->xOrigin, n);
- swaps(&stuff->yOrigin, n);
+ swaps(&stuff->length);
+ swapl(&stuff->picture);
+ swaps(&stuff->xOrigin);
+ swaps(&stuff->yOrigin);
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
@@ -2144,65 +2134,61 @@ SProcRenderSetPictureClipRectangles (ClientPtr client)
static int
SProcRenderFreePicture (ClientPtr client)
{
- register int n;
REQUEST(xRenderFreePictureReq);
- swaps(&stuff->length, n);
- swapl(&stuff->picture, n);
+ 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);
+ 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);
+ 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);
}
@@ -2210,16 +2196,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);
}
@@ -2227,16 +2212,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);
}
@@ -2244,16 +2228,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);
}
@@ -2279,47 +2262,43 @@ 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);
+ 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);
+ 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);
+ 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);
+ swaps(&stuff->length);
+ swapl(&stuff->glyphset);
+ swapl(&stuff->nglyphs);
if (stuff->nglyphs & 0xe0000000)
return BadLength;
end = (CARD8 *) stuff + (client->req_len << 2);
@@ -2331,13 +2310,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);
}
@@ -2351,10 +2330,9 @@ SProcRenderAddGlyphsFromPicture (ClientPtr client)
static int
SProcRenderFreeGlyphs (ClientPtr client)
{
- register int n;
REQUEST(xRenderFreeGlyphsReq);
- swaps(&stuff->length, n);
- swapl(&stuff->glyphset, n);
+ swaps(&stuff->length);
+ swapl(&stuff->glyphset);
SwapRestL(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
@@ -2362,7 +2340,6 @@ SProcRenderFreeGlyphs (ClientPtr client)
static int
SProcRenderCompositeGlyphs (ClientPtr client)
{
- register int n;
xGlyphElt *elt;
CARD8 *buffer;
CARD8 *end;
@@ -2378,13 +2355,13 @@ SProcRenderCompositeGlyphs (ClientPtr client)
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)
@@ -2392,13 +2369,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
@@ -2411,14 +2388,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;
@@ -2433,16 +2410,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);
}
@@ -2450,73 +2426,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);
}
@@ -2524,14 +2495,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);
}
@@ -2539,32 +2509,31 @@ 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);
for (i = 0; i < 4*num; ++i) {
- swaps(colors, n);
+ swaps(colors);
++colors;
}
}
@@ -2572,18 +2541,17 @@ static void swapStops(void *stuff, int num)
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)))
@@ -2599,20 +2567,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)))
@@ -2628,17 +2595,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)))