aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/render
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/render')
-rw-r--r--xorg-server/render/animcur.c386
-rw-r--r--xorg-server/render/filter.c339
-rw-r--r--xorg-server/render/glyph.c1434
-rw-r--r--xorg-server/render/glyphstr.h91
-rw-r--r--xorg-server/render/matrix.c18
-rw-r--r--xorg-server/render/miindex.c684
-rw-r--r--xorg-server/render/mipict.c786
-rw-r--r--xorg-server/render/mipict.h153
-rw-r--r--xorg-server/render/mirect.c353
-rw-r--r--xorg-server/render/mitrap.c58
-rw-r--r--xorg-server/render/mitri.c135
-rw-r--r--xorg-server/render/picture.c2023
-rw-r--r--xorg-server/render/picturestr.h702
-rw-r--r--xorg-server/render/render.c3784
14 files changed, 5271 insertions, 5675 deletions
diff --git a/xorg-server/render/animcur.c b/xorg-server/render/animcur.c
index 8d4a9c2ef..485c068fe 100644
--- a/xorg-server/render/animcur.c
+++ b/xorg-server/render/animcur.c
@@ -48,35 +48,36 @@
#include "xace.h"
typedef struct _AnimCurElt {
- CursorPtr pCursor; /* cursor to show */
- CARD32 delay; /* in ms */
+ CursorPtr pCursor; /* cursor to show */
+ CARD32 delay; /* in ms */
} AnimCurElt;
typedef struct _AnimCur {
- int nelt; /* number of elements in the elts array */
- AnimCurElt *elts; /* actually allocated right after the structure */
+ int nelt; /* number of elements in the elts array */
+ AnimCurElt *elts; /* actually allocated right after the structure */
} AnimCurRec, *AnimCurPtr;
typedef struct _AnimScrPriv {
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
- ScreenBlockHandlerProcPtr BlockHandler;
+ ScreenBlockHandlerProcPtr BlockHandler;
- CursorLimitsProcPtr CursorLimits;
- DisplayCursorProcPtr DisplayCursor;
- SetCursorPositionProcPtr SetCursorPosition;
- RealizeCursorProcPtr RealizeCursor;
- UnrealizeCursorProcPtr UnrealizeCursor;
- RecolorCursorProcPtr RecolorCursor;
+ CursorLimitsProcPtr CursorLimits;
+ DisplayCursorProcPtr DisplayCursor;
+ SetCursorPositionProcPtr SetCursorPosition;
+ RealizeCursorProcPtr RealizeCursor;
+ UnrealizeCursorProcPtr UnrealizeCursor;
+ RecolorCursorProcPtr RecolorCursor;
} AnimCurScreenRec, *AnimCurScreenPtr;
static unsigned char empty[4];
-static CursorBits animCursorBits = {
+static CursorBits animCursorBits = {
empty, empty, 2, 1, 1, 0, 0, 1
};
static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
+
#define AnimCurScreenPrivateKey (&AnimCurScreenPrivateKeyRec)
#define IsAnimCur(c) ((c) && ((c)->bits == &animCursorBits))
@@ -87,12 +88,11 @@ static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
-
static Bool
-AnimCurCloseScreen (int index, ScreenPtr pScreen)
+AnimCurCloseScreen(int index, ScreenPtr pScreen)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
Unwrap(as, pScreen, CloseScreen);
@@ -102,35 +102,30 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen)
Unwrap(as, pScreen, RealizeCursor);
Unwrap(as, pScreen, UnrealizeCursor);
Unwrap(as, pScreen, RecolorCursor);
- SetAnimCurScreen(pScreen,0);
+ SetAnimCurScreen(pScreen, 0);
ret = (*pScreen->CloseScreen) (index, pScreen);
free(as);
return ret;
}
-static void
-AnimCurCursorLimits (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor,
- BoxPtr pHotBox,
- BoxPtr pTopLeftBox)
+static void
+AnimCurCursorLimits(DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Unwrap (as, pScreen, CursorLimits);
- if (IsAnimCur(pCursor))
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
+ Unwrap(as, pScreen, CursorLimits);
+ if (IsAnimCur(pCursor)) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
- (*pScreen->CursorLimits) (pDev, pScreen, ac->elts[0].pCursor,
- pHotBox, pTopLeftBox);
+ (*pScreen->CursorLimits) (pDev, pScreen, ac->elts[0].pCursor,
+ pHotBox, pTopLeftBox);
}
- else
- {
- (*pScreen->CursorLimits) (pDev, pScreen, pCursor,
- pHotBox, pTopLeftBox);
+ else {
+ (*pScreen->CursorLimits) (pDev, pScreen, pCursor, pHotBox, pTopLeftBox);
}
- Wrap (as, pScreen, CursorLimits, AnimCurCursorLimits);
+ Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
}
/*
@@ -140,209 +135,188 @@ AnimCurCursorLimits (DeviceIntPtr pDev,
*/
static void
-AnimCurScreenBlockHandler (int screenNum,
- pointer blockData,
- pointer pTimeout,
- pointer pReadmask)
+AnimCurScreenBlockHandler(int screenNum,
+ pointer blockData,
+ pointer pTimeout, pointer pReadmask)
{
- ScreenPtr pScreen = screenInfo.screens[screenNum];
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- DeviceIntPtr dev;
- Bool activeDevice = FALSE;
- CARD32 now = 0,
- soonest = ~0; /* earliest time to wakeup again */
-
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen)
- {
- if (!activeDevice) {
- now = GetTimeInMillis ();
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ DeviceIntPtr dev;
+ Bool activeDevice = FALSE;
+ CARD32 now = 0, soonest = ~0; /* earliest time to wakeup again */
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen) {
+ if (!activeDevice) {
+ now = GetTimeInMillis();
activeDevice = TRUE;
}
- if ((INT32) (now - dev->spriteInfo->anim.time) >= 0)
- {
- AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor);
- int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
- DisplayCursorProcPtr DisplayCursor;
-
- /*
- * Not a simple Unwrap/Wrap as this
- * isn't called along the DisplayCursor
- * wrapper chain.
- */
- DisplayCursor = pScreen->DisplayCursor;
- pScreen->DisplayCursor = as->DisplayCursor;
- (void) (*pScreen->DisplayCursor) (dev,
- pScreen,
- ac->elts[elt].pCursor);
- as->DisplayCursor = pScreen->DisplayCursor;
- pScreen->DisplayCursor = DisplayCursor;
-
- dev->spriteInfo->anim.elt = elt;
- dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
- }
-
- if (soonest > dev->spriteInfo->anim.time)
- soonest = dev->spriteInfo->anim.time;
- }
+ if ((INT32) (now - dev->spriteInfo->anim.time) >= 0) {
+ AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor);
+ int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
+ DisplayCursorProcPtr DisplayCursor;
+
+ /*
+ * Not a simple Unwrap/Wrap as this
+ * isn't called along the DisplayCursor
+ * wrapper chain.
+ */
+ DisplayCursor = pScreen->DisplayCursor;
+ pScreen->DisplayCursor = as->DisplayCursor;
+ (void) (*pScreen->DisplayCursor) (dev,
+ pScreen,
+ ac->elts[elt].pCursor);
+ as->DisplayCursor = pScreen->DisplayCursor;
+ pScreen->DisplayCursor = DisplayCursor;
+
+ dev->spriteInfo->anim.elt = elt;
+ dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
+ }
+
+ if (soonest > dev->spriteInfo->anim.time)
+ soonest = dev->spriteInfo->anim.time;
+ }
}
if (activeDevice)
- AdjustWaitForDelay (pTimeout, soonest - now);
+ AdjustWaitForDelay(pTimeout, soonest - now);
- Unwrap (as, pScreen, BlockHandler);
+ Unwrap(as, pScreen, BlockHandler);
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
if (activeDevice)
- Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+ Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
else
as->BlockHandler = NULL;
}
static Bool
-AnimCurDisplayCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
if (IsFloating(pDev))
- return FALSE;
+ return FALSE;
- Unwrap (as, pScreen, DisplayCursor);
- if (IsAnimCur(pCursor))
- {
- if (pCursor != pDev->spriteInfo->anim.pCursor)
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
+ Unwrap(as, pScreen, DisplayCursor);
+ if (IsAnimCur(pCursor)) {
+ if (pCursor != pDev->spriteInfo->anim.pCursor) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
- ret = (*pScreen->DisplayCursor)
+ ret = (*pScreen->DisplayCursor)
(pDev, pScreen, ac->elts[0].pCursor);
- if (ret)
- {
- pDev->spriteInfo->anim.elt = 0;
- pDev->spriteInfo->anim.time = GetTimeInMillis () + ac->elts[0].delay;
- pDev->spriteInfo->anim.pCursor = pCursor;
- pDev->spriteInfo->anim.pScreen = pScreen;
-
- if (!as->BlockHandler)
- Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
- }
- }
- else
- ret = TRUE;
+ if (ret) {
+ pDev->spriteInfo->anim.elt = 0;
+ pDev->spriteInfo->anim.time =
+ GetTimeInMillis() + ac->elts[0].delay;
+ pDev->spriteInfo->anim.pCursor = pCursor;
+ pDev->spriteInfo->anim.pScreen = pScreen;
+
+ if (!as->BlockHandler)
+ Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+ }
+ }
+ else
+ ret = TRUE;
}
- else
- {
- pDev->spriteInfo->anim.pCursor = 0;
- pDev->spriteInfo->anim.pScreen = 0;
- ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
+ else {
+ pDev->spriteInfo->anim.pCursor = 0;
+ pDev->spriteInfo->anim.pScreen = 0;
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
}
- Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor);
+ Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);
return ret;
}
static Bool
-AnimCurSetCursorPosition (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x,
- int y,
- Bool generateEvent)
+AnimCurSetCursorPosition(DeviceIntPtr pDev,
+ ScreenPtr pScreen, int x, int y, Bool generateEvent)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
-
- Unwrap (as, pScreen, SetCursorPosition);
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
+
+ Unwrap(as, pScreen, SetCursorPosition);
if (pDev->spriteInfo->anim.pCursor) {
- pDev->spriteInfo->anim.pScreen = pScreen;
+ pDev->spriteInfo->anim.pScreen = pScreen;
- if (!as->BlockHandler)
- Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
+ if (!as->BlockHandler)
+ Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
}
ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
- Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
+ Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
return ret;
}
-static Bool
-AnimCurRealizeCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+static Bool
+AnimCurRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
-
- Unwrap (as, pScreen, RealizeCursor);
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
+
+ Unwrap(as, pScreen, RealizeCursor);
if (IsAnimCur(pCursor))
- ret = TRUE;
+ ret = TRUE;
else
- ret = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor);
- Wrap (as, pScreen, RealizeCursor, AnimCurRealizeCursor);
+ ret = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor);
+ Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor);
return ret;
}
-static Bool
-AnimCurUnrealizeCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor)
+static Bool
+AnimCurUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- Bool ret;
-
- Unwrap (as, pScreen, UnrealizeCursor);
- if (IsAnimCur(pCursor))
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
- int i;
-
- if (pScreen->myNum == 0)
- for (i = 0; i < ac->nelt; i++)
- FreeCursor (ac->elts[i].pCursor, 0);
- ret = TRUE;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+ Bool ret;
+
+ Unwrap(as, pScreen, UnrealizeCursor);
+ if (IsAnimCur(pCursor)) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
+ int i;
+
+ if (pScreen->myNum == 0)
+ for (i = 0; i < ac->nelt; i++)
+ FreeCursor(ac->elts[i].pCursor, 0);
+ ret = TRUE;
}
else
- ret = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
- Wrap (as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
+ ret = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
+ Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
return ret;
}
static void
-AnimCurRecolorCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor,
- Bool displayed)
+AnimCurRecolorCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
{
- AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
-
- Unwrap (as, pScreen, RecolorCursor);
- if (IsAnimCur(pCursor))
- {
- AnimCurPtr ac = GetAnimCur(pCursor);
- int i;
+ AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
+
+ Unwrap(as, pScreen, RecolorCursor);
+ if (IsAnimCur(pCursor)) {
+ AnimCurPtr ac = GetAnimCur(pCursor);
+ int i;
for (i = 0; i < ac->nelt; i++)
- (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor,
- displayed &&
- pDev->spriteInfo->anim.elt == i);
+ (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor,
+ displayed &&
+ pDev->spriteInfo->anim.elt == i);
}
else
- (*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed);
- Wrap (as, pScreen, RecolorCursor, AnimCurRecolorCursor);
+ (*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed);
+ Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor);
}
Bool
-AnimCurInit (ScreenPtr pScreen)
+AnimCurInit(ScreenPtr pScreen)
{
- AnimCurScreenPtr as;
+ AnimCurScreenPtr as;
if (!dixRegisterPrivateKey(&AnimCurScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
- as = (AnimCurScreenPtr) malloc(sizeof (AnimCurScreenRec));
+ as = (AnimCurScreenPtr) malloc(sizeof(AnimCurScreenRec));
if (!as)
- return FALSE;
+ return FALSE;
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
as->BlockHandler = NULL;
@@ -353,38 +327,39 @@ AnimCurInit (ScreenPtr pScreen)
Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor);
Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor);
- SetAnimCurScreen(pScreen,as);
+ SetAnimCurScreen(pScreen, as);
return TRUE;
}
int
-AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid)
+AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
+ CursorPtr *ppCursor, ClientPtr client, XID cid)
{
- CursorPtr pCursor;
- int rc, i;
- AnimCurPtr ac;
+ CursorPtr pCursor;
+ int rc, i;
+ AnimCurPtr ac;
for (i = 0; i < screenInfo.numScreens; i++)
- if (!GetAnimCurScreen (screenInfo.screens[i]))
- return BadImplementation;
+ if (!GetAnimCurScreen(screenInfo.screens[i]))
+ return BadImplementation;
for (i = 0; i < ncursor; i++)
- if (IsAnimCur (cursors[i]))
- return BadMatch;
-
+ if (IsAnimCur(cursors[i]))
+ return BadMatch;
+
pCursor = (CursorPtr) calloc(CURSOR_REC_SIZE +
- sizeof (AnimCurRec) +
- ncursor * sizeof (AnimCurElt), 1);
+ sizeof(AnimCurRec) +
+ ncursor * sizeof(AnimCurElt), 1);
if (!pCursor)
- return BadAlloc;
+ return BadAlloc;
dixInitPrivates(pCursor, pCursor + 1, PRIVATE_CURSOR);
pCursor->bits = &animCursorBits;
pCursor->refcnt = 1;
-
+
pCursor->foreRed = cursors[0]->foreRed;
pCursor->foreGreen = cursors[0]->foreGreen;
pCursor->foreBlue = cursors[0]->foreBlue;
-
+
pCursor->backRed = cursors[0]->backRed;
pCursor->backGreen = cursors[0]->backGreen;
pCursor->backBlue = cursors[0]->backBlue;
@@ -393,28 +368,27 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor,
- RT_NONE, NULL, DixCreateAccess);
+ RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
- dixFiniPrivates(pCursor, PRIVATE_CURSOR);
- free(pCursor);
- return rc;
+ dixFiniPrivates(pCursor, PRIVATE_CURSOR);
+ free(pCursor);
+ return rc;
}
-
+
/*
* Fill in the AnimCurRec
*/
animCursorBits.refcnt++;
- ac = GetAnimCur (pCursor);
+ ac = GetAnimCur(pCursor);
ac->nelt = ncursor;
ac->elts = (AnimCurElt *) (ac + 1);
-
- for (i = 0; i < ncursor; i++)
- {
- cursors[i]->refcnt++;
- ac->elts[i].pCursor = cursors[i];
- ac->elts[i].delay = deltas[i];
+
+ for (i = 0; i < ncursor; i++) {
+ cursors[i]->refcnt++;
+ ac->elts[i].pCursor = cursors[i];
+ ac->elts[i].delay = deltas[i];
}
-
+
*ppCursor = pCursor;
return Success;
}
diff --git a/xorg-server/render/filter.c b/xorg-server/render/filter.c
index c513ee8f9..8c401ee5d 100644
--- a/xorg-server/render/filter.c
+++ b/xorg-server/render/filter.c
@@ -40,40 +40,39 @@
#include "picturestr.h"
static char **filterNames;
-static int nfilterNames;
+static int nfilterNames;
/*
* standard but not required filters don't have constant indices
*/
int
-PictureGetFilterId (const char *filter, int len, Bool makeit)
+PictureGetFilterId(const char *filter, int len, Bool makeit)
{
- int i;
- char *name;
- char **names;
+ int i;
+ char *name;
+ char **names;
if (len < 0)
- len = strlen (filter);
+ len = strlen(filter);
for (i = 0; i < nfilterNames; i++)
- if (!CompareISOLatin1Lowered ((const unsigned char *) filterNames[i], -1,
- (const unsigned char *) filter, len))
- return i;
+ if (!CompareISOLatin1Lowered((const unsigned char *) filterNames[i], -1,
+ (const unsigned char *) filter, len))
+ return i;
if (!makeit)
- return -1;
+ return -1;
name = malloc(len + 1);
if (!name)
- return -1;
- memcpy (name, filter, len);
+ return -1;
+ memcpy(name, filter, len);
name[len] = '\0';
if (filterNames)
- names = realloc(filterNames, (nfilterNames + 1) * sizeof (char *));
+ names = realloc(filterNames, (nfilterNames + 1) * sizeof(char *));
else
- names = malloc(sizeof (char *));
- if (!names)
- {
- free(name);
- return -1;
+ names = malloc(sizeof(char *));
+ if (!names) {
+ free(name);
+ return -1;
}
filterNames = names;
i = nfilterNames++;
@@ -82,77 +81,78 @@ PictureGetFilterId (const char *filter, int len, Bool makeit)
}
static Bool
-PictureSetDefaultIds (void)
+PictureSetDefaultIds(void)
{
/* careful here -- this list must match the #define values */
- if (PictureGetFilterId (FilterNearest, -1, TRUE) != PictFilterNearest)
- return FALSE;
- if (PictureGetFilterId (FilterBilinear, -1, TRUE) != PictFilterBilinear)
- return FALSE;
+ if (PictureGetFilterId(FilterNearest, -1, TRUE) != PictFilterNearest)
+ return FALSE;
+ if (PictureGetFilterId(FilterBilinear, -1, TRUE) != PictFilterBilinear)
+ return FALSE;
- if (PictureGetFilterId (FilterFast, -1, TRUE) != PictFilterFast)
- return FALSE;
- if (PictureGetFilterId (FilterGood, -1, TRUE) != PictFilterGood)
- return FALSE;
- if (PictureGetFilterId (FilterBest, -1, TRUE) != PictFilterBest)
- return FALSE;
+ if (PictureGetFilterId(FilterFast, -1, TRUE) != PictFilterFast)
+ return FALSE;
+ if (PictureGetFilterId(FilterGood, -1, TRUE) != PictFilterGood)
+ return FALSE;
+ if (PictureGetFilterId(FilterBest, -1, TRUE) != PictFilterBest)
+ return FALSE;
- if (PictureGetFilterId (FilterConvolution, -1, TRUE) != PictFilterConvolution)
- return FALSE;
+ if (PictureGetFilterId(FilterConvolution, -1, TRUE) !=
+ PictFilterConvolution)
+ return FALSE;
return TRUE;
}
char *
-PictureGetFilterName (int id)
+PictureGetFilterName(int id)
{
if (0 <= id && id < nfilterNames)
- return filterNames[id];
+ return filterNames[id];
else
- return 0;
+ return 0;
}
static void
-PictureFreeFilterIds (void)
+PictureFreeFilterIds(void)
{
- int i;
+ int i;
for (i = 0; i < nfilterNames; i++)
- free(filterNames[i]);
+ free(filterNames[i]);
free(filterNames);
nfilterNames = 0;
filterNames = 0;
}
int
-PictureAddFilter (ScreenPtr pScreen,
- const char *filter,
- PictFilterValidateParamsProcPtr ValidateParams,
- int width,
- int height)
+PictureAddFilter(ScreenPtr pScreen,
+ const char *filter,
+ PictFilterValidateParamsProcPtr ValidateParams,
+ int width, int height)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int id = PictureGetFilterId (filter, -1, TRUE);
- int i;
- PictFilterPtr filters;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int id = PictureGetFilterId(filter, -1, TRUE);
+ int i;
+ PictFilterPtr filters;
if (id < 0)
- return -1;
+ return -1;
/*
* It's an error to attempt to reregister a filter
*/
for (i = 0; i < ps->nfilters; i++)
- if (ps->filters[i].id == id)
- return -1;
+ if (ps->filters[i].id == id)
+ return -1;
if (ps->filters)
- filters = realloc(ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec));
+ filters =
+ realloc(ps->filters, (ps->nfilters + 1) * sizeof(PictFilterRec));
else
- filters = malloc(sizeof (PictFilterRec));
+ filters = malloc(sizeof(PictFilterRec));
if (!filters)
- return -1;
+ return -1;
ps->filters = filters;
i = ps->nfilters++;
- ps->filters[i].name = PictureGetFilterName (id);
+ ps->filters[i].name = PictureGetFilterName(id);
ps->filters[i].id = id;
ps->filters[i].ValidateParams = ValidateParams;
ps->filters[i].width = width;
@@ -161,79 +161,76 @@ PictureAddFilter (ScreenPtr pScreen,
}
Bool
-PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias)
+PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int filter_id = PictureGetFilterId (filter, -1, FALSE);
- int alias_id = PictureGetFilterId (alias, -1, TRUE);
- int i;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int filter_id = PictureGetFilterId(filter, -1, FALSE);
+ int alias_id = PictureGetFilterId(alias, -1, TRUE);
+ int i;
if (filter_id < 0 || alias_id < 0)
- return FALSE;
+ return FALSE;
for (i = 0; i < ps->nfilterAliases; i++)
- if (ps->filterAliases[i].alias_id == alias_id)
- break;
- if (i == ps->nfilterAliases)
- {
- PictFilterAliasPtr aliases;
-
- if (ps->filterAliases)
- aliases = realloc(ps->filterAliases,
- (ps->nfilterAliases + 1) *
- sizeof (PictFilterAliasRec));
- else
- aliases = malloc(sizeof (PictFilterAliasRec));
- if (!aliases)
- return FALSE;
- ps->filterAliases = aliases;
- ps->filterAliases[i].alias = PictureGetFilterName (alias_id);
- ps->filterAliases[i].alias_id = alias_id;
- ps->nfilterAliases++;
+ if (ps->filterAliases[i].alias_id == alias_id)
+ break;
+ if (i == ps->nfilterAliases) {
+ PictFilterAliasPtr aliases;
+
+ if (ps->filterAliases)
+ aliases = realloc(ps->filterAliases,
+ (ps->nfilterAliases + 1) *
+ sizeof(PictFilterAliasRec));
+ else
+ aliases = malloc(sizeof(PictFilterAliasRec));
+ if (!aliases)
+ return FALSE;
+ ps->filterAliases = aliases;
+ ps->filterAliases[i].alias = PictureGetFilterName(alias_id);
+ ps->filterAliases[i].alias_id = alias_id;
+ ps->nfilterAliases++;
}
ps->filterAliases[i].filter_id = filter_id;
return TRUE;
}
PictFilterPtr
-PictureFindFilter (ScreenPtr pScreen, char *name, int len)
+PictureFindFilter(ScreenPtr pScreen, char *name, int len)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- int id = PictureGetFilterId (name, len, FALSE);
- int i;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int id = PictureGetFilterId(name, len, FALSE);
+ int i;
if (id < 0)
- return 0;
+ return 0;
/* Check for an alias, allow them to recurse */
for (i = 0; i < ps->nfilterAliases; i++)
- if (ps->filterAliases[i].alias_id == id)
- {
- id = ps->filterAliases[i].filter_id;
- i = 0;
- }
+ if (ps->filterAliases[i].alias_id == id) {
+ id = ps->filterAliases[i].filter_id;
+ i = 0;
+ }
/* find the filter */
for (i = 0; i < ps->nfilters; i++)
- if (ps->filters[i].id == id)
- return &ps->filters[i];
+ if (ps->filters[i].id == id)
+ return &ps->filters[i];
return 0;
}
static Bool
-convolutionFilterValidateParams (ScreenPtr pScreen,
- int filter,
- xFixed *params,
- int nparams,
- int *width,
- int *height)
+convolutionFilterValidateParams(ScreenPtr pScreen,
+ int filter,
+ xFixed * params,
+ int nparams, int *width, int *height)
{
- int w, h;
+ int w, h;
+
if (nparams < 3)
return FALSE;
- if (xFixedFrac (params[0]) || xFixedFrac (params[1]))
+ if (xFixedFrac(params[0]) || xFixedFrac(params[1]))
return FALSE;
- w = xFixedToInt (params[0]);
- h = xFixedToInt (params[1]);
+ w = xFixedToInt(params[0]);
+ h = xFixedToInt(params[1]);
nparams -= 2;
if (w * h > nparams)
@@ -244,117 +241,117 @@ convolutionFilterValidateParams (ScreenPtr pScreen,
return TRUE;
}
-
Bool
-PictureSetDefaultFilters (ScreenPtr pScreen)
+PictureSetDefaultFilters(ScreenPtr pScreen)
{
if (!filterNames)
- if (!PictureSetDefaultIds ())
- return FALSE;
- if (PictureAddFilter (pScreen, FilterNearest, 0, 1, 1) < 0)
- return FALSE;
- if (PictureAddFilter (pScreen, FilterBilinear, 0, 2, 2) < 0)
- return FALSE;
-
- if (!PictureSetFilterAlias (pScreen, FilterNearest, FilterFast))
- return FALSE;
- if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterGood))
- return FALSE;
- if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterBest))
- return FALSE;
-
- if (PictureAddFilter (pScreen, FilterConvolution, convolutionFilterValidateParams, 0, 0) < 0)
+ if (!PictureSetDefaultIds())
+ return FALSE;
+ if (PictureAddFilter(pScreen, FilterNearest, 0, 1, 1) < 0)
+ return FALSE;
+ if (PictureAddFilter(pScreen, FilterBilinear, 0, 2, 2) < 0)
+ return FALSE;
+
+ if (!PictureSetFilterAlias(pScreen, FilterNearest, FilterFast))
+ return FALSE;
+ if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterGood))
+ return FALSE;
+ if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterBest))
+ return FALSE;
+
+ if (PictureAddFilter
+ (pScreen, FilterConvolution, convolutionFilterValidateParams, 0, 0) < 0)
return FALSE;
return TRUE;
}
void
-PictureResetFilters (ScreenPtr pScreen)
+PictureResetFilters(ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
free(ps->filters);
free(ps->filterAliases);
- PictureFreeFilterIds ();
+ PictureFreeFilterIds();
}
int
-SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
+SetPictureFilter(PicturePtr pPicture, char *name, int len, xFixed * params,
+ int nparams)
{
- PictFilterPtr pFilter;
- ScreenPtr pScreen;
+ PictFilterPtr pFilter;
+ ScreenPtr pScreen;
if (pPicture->pDrawable != NULL)
- pScreen = pPicture->pDrawable->pScreen;
+ pScreen = pPicture->pDrawable->pScreen;
else
- pScreen = screenInfo.screens[0];
+ pScreen = screenInfo.screens[0];
- pFilter = PictureFindFilter (pScreen, name, len);
+ pFilter = PictureFindFilter(pScreen, name, len);
if (!pFilter)
- 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;
- }
+ 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;
+ }
}
- return SetPicturePictFilter (pPicture, pFilter, params, nparams);
+ return SetPicturePictFilter(pPicture, pFilter, params, nparams);
}
int
-SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
- xFixed *params, int nparams)
+SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
+ xFixed * params, int nparams)
{
- ScreenPtr pScreen;
- int i;
+ ScreenPtr pScreen;
+ int i;
if (pPicture->pDrawable)
- pScreen = pPicture->pDrawable->pScreen;
+ pScreen = pPicture->pDrawable->pScreen;
else
- pScreen = screenInfo.screens[0];
+ pScreen = screenInfo.screens[0];
+
+ if (pFilter->ValidateParams) {
+ int width, height;
- if (pFilter->ValidateParams)
- {
- int width, height;
- if (!(*pFilter->ValidateParams) (pScreen, pFilter->id, params, nparams, &width, &height))
- return BadMatch;
+ 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;
+ 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;
+ if (pPicture->pDrawable) {
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ int result;
- result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
- params, nparams);
- return result;
+ result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
+ params, nparams);
+ return result;
}
return Success;
}
diff --git a/xorg-server/render/glyph.c b/xorg-server/render/glyph.c
index ab20da625..a143e9eb5 100644
--- a/xorg-server/render/glyph.c
+++ b/xorg-server/render/glyph.c
@@ -1,748 +1,686 @@
-/*
- *
- * 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 "xsha1.h"
-
-#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"
-#include "glyphstr.h"
-#include "mipict.h"
-
-/*
- * From Knuth -- a good choice for hash/rehash values is p, p-2 where
- * p and p-2 are both prime. These tables are sized to have an extra 10%
- * free to avoid exponential performance degradation as the hash table fills
- */
-static GlyphHashSetRec glyphHashSets[] = {
- { 32, 43, 41 },
- { 64, 73, 71 },
- { 128, 151, 149 },
- { 256, 283, 281 },
- { 512, 571, 569 },
- { 1024, 1153, 1151 },
- { 2048, 2269, 2267 },
- { 4096, 4519, 4517 },
- { 8192, 9013, 9011 },
- { 16384, 18043, 18041 },
- { 32768, 36109, 36107 },
- { 65536, 72091, 72089 },
- { 131072, 144409, 144407 },
- { 262144, 288361, 288359 },
- { 524288, 576883, 576881 },
- { 1048576, 1153459, 1153457 },
- { 2097152, 2307163, 2307161 },
- { 4194304, 4613893, 4613891 },
- { 8388608, 9227641, 9227639 },
- { 16777216, 18455029, 18455027 },
- { 33554432, 36911011, 36911009 },
- { 67108864, 73819861, 73819859 },
- { 134217728, 147639589, 147639587 },
- { 268435456, 295279081, 295279079 },
- { 536870912, 590559793, 590559791 }
-};
-
-#define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0]))
-
-static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
-
-static GlyphHashRec globalGlyphs[GlyphFormatNum];
-
-void
-GlyphUninit (ScreenPtr pScreen)
-{
- PictureScreenPtr ps = GetPictureScreen (pScreen);
- GlyphPtr glyph;
- int fdepth, i;
- int scrno = pScreen->myNum;
-
- for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++)
- {
- if (!globalGlyphs[fdepth].hashSet)
- continue;
-
- for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++)
- {
- glyph = globalGlyphs[fdepth].table[i].glyph;
- if (glyph && glyph != DeletedGlyph)
- {
- if (GlyphPicture(glyph)[scrno])
- {
- FreePicture ((pointer) GlyphPicture (glyph)[scrno], 0);
- GlyphPicture(glyph)[scrno] = NULL;
- }
- (*ps->UnrealizeGlyph) (pScreen, glyph);
- }
- }
- }
-}
-
-GlyphHashSetPtr
-FindGlyphHashSet (CARD32 filled)
-{
- int i;
-
- for (i = 0; i < NGLYPHHASHSETS; i++)
- if (glyphHashSets[i].entries >= filled)
- return &glyphHashSets[i];
- return 0;
-}
-
-GlyphRefPtr
-FindGlyphRef (GlyphHashPtr hash,
- CARD32 signature,
- Bool match,
- unsigned char sha1[20])
-{
- CARD32 elt, step, s;
- GlyphPtr glyph;
- GlyphRefPtr table, gr, del;
- CARD32 tableSize = hash->hashSet->size;
-
- table = hash->table;
- elt = signature % tableSize;
- step = 0;
- del = 0;
- for (;;)
- {
- gr = &table[elt];
- s = gr->signature;
- glyph = gr->glyph;
- if (!glyph)
- {
- if (del)
- gr = del;
- break;
- }
- if (glyph == DeletedGlyph)
- {
- if (!del)
- del = gr;
- else if (gr == del)
- break;
- }
- else if (s == signature &&
- (!match ||
- memcmp (glyph->sha1, sha1, 20) == 0))
- {
- break;
- }
- if (!step)
- {
- step = signature % hash->hashSet->rehash;
- if (!step)
- step = 1;
- }
- elt += step;
- if (elt >= tableSize)
- elt -= tableSize;
- }
- return gr;
-}
-
-int
-HashGlyph (xGlyphInfo *gi,
- CARD8 *bits,
- unsigned long size,
- unsigned char sha1[20])
-{
- void *ctx = x_sha1_init();
- int success;
-
- if (!ctx)
- return BadAlloc;
-
- success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo));
- if (!success)
- return BadAlloc;
- success = x_sha1_update(ctx, bits, size);
- if (!success)
- return BadAlloc;
- success = x_sha1_final(ctx, sha1);
- if (!success)
- return BadAlloc;
- return Success;
-}
-
-GlyphPtr
-FindGlyphByHash (unsigned char sha1[20], int format)
-{
- GlyphRefPtr gr;
- CARD32 signature = *(CARD32 *) sha1;
-
- if (!globalGlyphs[format].hashSet)
- return NULL;
-
- gr = FindGlyphRef (&globalGlyphs[format],
- signature, TRUE, sha1);
-
- if (gr->glyph && gr->glyph != DeletedGlyph)
- return gr->glyph;
- else
- return NULL;
-}
-
-#ifdef CHECK_DUPLICATES
-void
-DuplicateRef (GlyphPtr glyph, char *where)
-{
- ErrorF ("Duplicate Glyph 0x%x from %s\n", glyph, where);
-}
-
-void
-CheckDuplicates (GlyphHashPtr hash, char *where)
-{
- GlyphPtr g;
- int i, j;
-
- for (i = 0; i < hash->hashSet->size; i++)
- {
- g = hash->table[i].glyph;
- if (!g || g == DeletedGlyph)
- continue;
- for (j = i + 1; j < hash->hashSet->size; j++)
- if (hash->table[j].glyph == g)
- DuplicateRef (g, where);
- }
-}
-#else
-#define CheckDuplicates(a,b)
-#define DuplicateRef(a,b)
-#endif
-
-static void
-FreeGlyphPicture(GlyphPtr glyph)
-{
- PictureScreenPtr ps;
- int i;
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
-
- if (GlyphPicture(glyph)[i])
- FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
-
- ps = GetPictureScreenIfSet (pScreen);
- if (ps)
- (*ps->UnrealizeGlyph) (pScreen, glyph);
- }
-}
-
-
-void
-FreeGlyph (GlyphPtr glyph, int format)
-{
- CheckDuplicates (&globalGlyphs[format], "FreeGlyph");
- if (--glyph->refcnt == 0)
- {
- GlyphRefPtr gr;
- int i;
- int first;
- CARD32 signature;
-
- first = -1;
- for (i = 0; i < globalGlyphs[format].hashSet->size; i++)
- if (globalGlyphs[format].table[i].glyph == glyph)
- {
- if (first != -1)
- DuplicateRef (glyph, "FreeGlyph check");
- first = i;
- }
-
- signature = *(CARD32 *) glyph->sha1;
- gr = FindGlyphRef (&globalGlyphs[format], signature,
- TRUE, glyph->sha1);
- if (gr - globalGlyphs[format].table != first)
- DuplicateRef (glyph, "Found wrong one");
- if (gr->glyph && gr->glyph != DeletedGlyph)
- {
- gr->glyph = DeletedGlyph;
- gr->signature = 0;
- globalGlyphs[format].tableEntries--;
- }
-
- FreeGlyphPicture(glyph);
- dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
- }
-}
-
-void
-AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
-{
- GlyphRefPtr gr;
- CARD32 signature;
-
- CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph top global");
- /* Locate existing matching glyph */
- signature = *(CARD32 *) glyph->sha1;
- gr = FindGlyphRef (&globalGlyphs[glyphSet->fdepth], signature,
- TRUE, glyph->sha1);
- if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph)
- {
- FreeGlyphPicture(glyph);
- dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
- glyph = gr->glyph;
- }
- else if (gr->glyph != glyph)
- {
- gr->glyph = glyph;
- gr->signature = signature;
- globalGlyphs[glyphSet->fdepth].tableEntries++;
- }
-
- /* Insert/replace glyphset value */
- gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0);
- ++glyph->refcnt;
- if (gr->glyph && gr->glyph != DeletedGlyph)
- FreeGlyph (gr->glyph, glyphSet->fdepth);
- else
- glyphSet->hash.tableEntries++;
- gr->glyph = glyph;
- gr->signature = id;
- CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
-}
-
-Bool
-DeleteGlyph (GlyphSetPtr glyphSet, Glyph id)
-{
- GlyphRefPtr gr;
- GlyphPtr glyph;
-
- gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0);
- glyph = gr->glyph;
- if (glyph && glyph != DeletedGlyph)
- {
- gr->glyph = DeletedGlyph;
- glyphSet->hash.tableEntries--;
- FreeGlyph (glyph, glyphSet->fdepth);
- return TRUE;
- }
- return FALSE;
-}
-
-GlyphPtr
-FindGlyph (GlyphSetPtr glyphSet, Glyph id)
-{
- GlyphPtr glyph;
-
- glyph = FindGlyphRef (&glyphSet->hash, id, FALSE, 0)->glyph;
- if (glyph == DeletedGlyph)
- glyph = 0;
- return glyph;
-}
-
-GlyphPtr
-AllocateGlyph (xGlyphInfo *gi, int fdepth)
-{
- PictureScreenPtr ps;
- int size;
- GlyphPtr glyph;
- int i;
- int head_size;
-
- head_size = sizeof (GlyphRec) + screenInfo.numScreens * sizeof (PicturePtr);
- size = (head_size + dixPrivatesSize(PRIVATE_GLYPH));
- glyph = (GlyphPtr) malloc (size);
- if (!glyph)
- return 0;
- glyph->refcnt = 0;
- glyph->size = size + sizeof (xGlyphInfo);
- glyph->info = *gi;
- dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- GlyphPicture(glyph)[i] = NULL;
- ps = GetPictureScreenIfSet (screenInfo.screens[i]);
-
- if (ps)
- {
- if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph))
- goto bail;
- }
- }
-
- return glyph;
-
-bail:
- while (i--)
- {
- ps = GetPictureScreenIfSet (screenInfo.screens[i]);
- if (ps)
- (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
- }
-
- dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
- return 0;
-}
-
-Bool
-AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet)
-{
- hash->table = calloc(hashSet->size, sizeof (GlyphRefRec));
- if (!hash->table)
- return FALSE;
- hash->hashSet = hashSet;
- hash->tableEntries = 0;
- return TRUE;
-}
-
-Bool
-ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global)
-{
- CARD32 tableEntries;
- GlyphHashSetPtr hashSet;
- GlyphHashRec newHash;
- GlyphRefPtr gr;
- GlyphPtr glyph;
- int i;
- int oldSize;
- CARD32 s;
-
- tableEntries = hash->tableEntries + change;
- hashSet = FindGlyphHashSet (tableEntries);
- if (hashSet == hash->hashSet)
- return TRUE;
- if (global)
- CheckDuplicates (hash, "ResizeGlyphHash top");
- if (!AllocateGlyphHash (&newHash, hashSet))
- return FALSE;
- if (hash->table)
- {
- oldSize = hash->hashSet->size;
- for (i = 0; i < oldSize; i++)
- {
- glyph = hash->table[i].glyph;
- if (glyph && glyph != DeletedGlyph)
- {
- s = hash->table[i].signature;
- gr = FindGlyphRef (&newHash, s, global, glyph->sha1);
- gr->signature = s;
- gr->glyph = glyph;
- ++newHash.tableEntries;
- }
- }
- free(hash->table);
- }
- *hash = newHash;
- if (global)
- CheckDuplicates (hash, "ResizeGlyphHash bottom");
- return TRUE;
-}
-
-Bool
-ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change)
-{
- return (ResizeGlyphHash (&glyphSet->hash, change, FALSE) &&
- ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], change, TRUE));
-}
-
-GlyphSetPtr
-AllocateGlyphSet (int fdepth, PictFormatPtr format)
-{
- GlyphSetPtr glyphSet;
-
- if (!globalGlyphs[fdepth].hashSet)
- {
- if (!AllocateGlyphHash (&globalGlyphs[fdepth], &glyphHashSets[0]))
- return FALSE;
- }
-
- glyphSet = dixAllocateObjectWithPrivates(GlyphSetRec, PRIVATE_GLYPHSET);
- if (!glyphSet)
- return FALSE;
-
- if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
- {
- free(glyphSet);
- return FALSE;
- }
- glyphSet->refcnt = 1;
- glyphSet->fdepth = fdepth;
- glyphSet->format = format;
- return glyphSet;
-}
-
-int
-FreeGlyphSet (pointer value,
- XID gid)
-{
- GlyphSetPtr glyphSet = (GlyphSetPtr) value;
-
- if (--glyphSet->refcnt == 0)
- {
- CARD32 i, tableSize = glyphSet->hash.hashSet->size;
- GlyphRefPtr table = glyphSet->hash.table;
- GlyphPtr glyph;
-
- for (i = 0; i < tableSize; i++)
- {
- glyph = table[i].glyph;
- if (glyph && glyph != DeletedGlyph)
- FreeGlyph (glyph, glyphSet->fdepth);
- }
- if (!globalGlyphs[glyphSet->fdepth].tableEntries)
- {
- free(globalGlyphs[glyphSet->fdepth].table);
- globalGlyphs[glyphSet->fdepth].table = 0;
- globalGlyphs[glyphSet->fdepth].hashSet = 0;
- }
- else
- ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE);
- free(table);
- dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET);
- }
- return Success;
-}
-
-static 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);
-}
-
-Bool
-miRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph)
-{
- return TRUE;
-}
-
-void
-miUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph)
-{
-}
-
-void
-miGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- 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 = {0, 0, 0, 0};
- 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,
- CREATE_PIXMAP_USAGE_SCRATCH);
- 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;
- }
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--)
- {
- glyph = *glyphs++;
- pPicture = GlyphPicture (glyph)[pScreen->myNum];
-
- if (pPicture)
- {
- 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 (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);
- }
-}
+/*
+ *
+ * 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 "xsha1.h"
+
+#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"
+#include "glyphstr.h"
+#include "mipict.h"
+
+/*
+ * From Knuth -- a good choice for hash/rehash values is p, p-2 where
+ * p and p-2 are both prime. These tables are sized to have an extra 10%
+ * free to avoid exponential performance degradation as the hash table fills
+ */
+static GlyphHashSetRec glyphHashSets[] = {
+ {32, 43, 41},
+ {64, 73, 71},
+ {128, 151, 149},
+ {256, 283, 281},
+ {512, 571, 569},
+ {1024, 1153, 1151},
+ {2048, 2269, 2267},
+ {4096, 4519, 4517},
+ {8192, 9013, 9011},
+ {16384, 18043, 18041},
+ {32768, 36109, 36107},
+ {65536, 72091, 72089},
+ {131072, 144409, 144407},
+ {262144, 288361, 288359},
+ {524288, 576883, 576881},
+ {1048576, 1153459, 1153457},
+ {2097152, 2307163, 2307161},
+ {4194304, 4613893, 4613891},
+ {8388608, 9227641, 9227639},
+ {16777216, 18455029, 18455027},
+ {33554432, 36911011, 36911009},
+ {67108864, 73819861, 73819859},
+ {134217728, 147639589, 147639587},
+ {268435456, 295279081, 295279079},
+ {536870912, 590559793, 590559791}
+};
+
+#define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0]))
+
+static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
+
+static GlyphHashRec globalGlyphs[GlyphFormatNum];
+
+void
+GlyphUninit(ScreenPtr pScreen)
+{
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ GlyphPtr glyph;
+ int fdepth, i;
+ int scrno = pScreen->myNum;
+
+ for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) {
+ if (!globalGlyphs[fdepth].hashSet)
+ continue;
+
+ for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) {
+ glyph = globalGlyphs[fdepth].table[i].glyph;
+ if (glyph && glyph != DeletedGlyph) {
+ if (GlyphPicture(glyph)[scrno]) {
+ FreePicture((pointer) GlyphPicture(glyph)[scrno], 0);
+ GlyphPicture(glyph)[scrno] = NULL;
+ }
+ (*ps->UnrealizeGlyph) (pScreen, glyph);
+ }
+ }
+ }
+}
+
+GlyphHashSetPtr
+FindGlyphHashSet(CARD32 filled)
+{
+ int i;
+
+ for (i = 0; i < NGLYPHHASHSETS; i++)
+ if (glyphHashSets[i].entries >= filled)
+ return &glyphHashSets[i];
+ return 0;
+}
+
+GlyphRefPtr
+FindGlyphRef(GlyphHashPtr hash,
+ CARD32 signature, Bool match, unsigned char sha1[20])
+{
+ CARD32 elt, step, s;
+ GlyphPtr glyph;
+ GlyphRefPtr table, gr, del;
+ CARD32 tableSize = hash->hashSet->size;
+
+ table = hash->table;
+ elt = signature % tableSize;
+ step = 0;
+ del = 0;
+ for (;;) {
+ gr = &table[elt];
+ s = gr->signature;
+ glyph = gr->glyph;
+ if (!glyph) {
+ if (del)
+ gr = del;
+ break;
+ }
+ if (glyph == DeletedGlyph) {
+ if (!del)
+ del = gr;
+ else if (gr == del)
+ break;
+ }
+ else if (s == signature &&
+ (!match || memcmp(glyph->sha1, sha1, 20) == 0)) {
+ break;
+ }
+ if (!step) {
+ step = signature % hash->hashSet->rehash;
+ if (!step)
+ step = 1;
+ }
+ elt += step;
+ if (elt >= tableSize)
+ elt -= tableSize;
+ }
+ return gr;
+}
+
+int
+HashGlyph(xGlyphInfo * gi,
+ CARD8 *bits, unsigned long size, unsigned char sha1[20])
+{
+ void *ctx = x_sha1_init();
+ int success;
+
+ if (!ctx)
+ return BadAlloc;
+
+ success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo));
+ if (!success)
+ return BadAlloc;
+ success = x_sha1_update(ctx, bits, size);
+ if (!success)
+ return BadAlloc;
+ success = x_sha1_final(ctx, sha1);
+ if (!success)
+ return BadAlloc;
+ return Success;
+}
+
+GlyphPtr
+FindGlyphByHash(unsigned char sha1[20], int format)
+{
+ GlyphRefPtr gr;
+ CARD32 signature = *(CARD32 *) sha1;
+
+ if (!globalGlyphs[format].hashSet)
+ return NULL;
+
+ gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, sha1);
+
+ if (gr->glyph && gr->glyph != DeletedGlyph)
+ return gr->glyph;
+ else
+ return NULL;
+}
+
+#ifdef CHECK_DUPLICATES
+void
+DuplicateRef(GlyphPtr glyph, char *where)
+{
+ ErrorF("Duplicate Glyph 0x%x from %s\n", glyph, where);
+}
+
+void
+CheckDuplicates(GlyphHashPtr hash, char *where)
+{
+ GlyphPtr g;
+ int i, j;
+
+ for (i = 0; i < hash->hashSet->size; i++) {
+ g = hash->table[i].glyph;
+ if (!g || g == DeletedGlyph)
+ continue;
+ for (j = i + 1; j < hash->hashSet->size; j++)
+ if (hash->table[j].glyph == g)
+ DuplicateRef(g, where);
+ }
+}
+#else
+#define CheckDuplicates(a,b)
+#define DuplicateRef(a,b)
+#endif
+
+static void
+FreeGlyphPicture(GlyphPtr glyph)
+{
+ PictureScreenPtr ps;
+ int i;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (GlyphPicture(glyph)[i])
+ FreePicture((pointer) GlyphPicture(glyph)[i], 0);
+
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ (*ps->UnrealizeGlyph) (pScreen, glyph);
+ }
+}
+
+void
+FreeGlyph(GlyphPtr glyph, int format)
+{
+ CheckDuplicates(&globalGlyphs[format], "FreeGlyph");
+ if (--glyph->refcnt == 0) {
+ GlyphRefPtr gr;
+ int i;
+ int first;
+ CARD32 signature;
+
+ first = -1;
+ for (i = 0; i < globalGlyphs[format].hashSet->size; i++)
+ if (globalGlyphs[format].table[i].glyph == glyph) {
+ if (first != -1)
+ DuplicateRef(glyph, "FreeGlyph check");
+ first = i;
+ }
+
+ signature = *(CARD32 *) glyph->sha1;
+ gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, glyph->sha1);
+ if (gr - globalGlyphs[format].table != first)
+ DuplicateRef(glyph, "Found wrong one");
+ if (gr->glyph && gr->glyph != DeletedGlyph) {
+ gr->glyph = DeletedGlyph;
+ gr->signature = 0;
+ globalGlyphs[format].tableEntries--;
+ }
+
+ FreeGlyphPicture(glyph);
+ dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
+ }
+}
+
+void
+AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
+{
+ GlyphRefPtr gr;
+ CARD32 signature;
+
+ CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph top global");
+ /* Locate existing matching glyph */
+ signature = *(CARD32 *) glyph->sha1;
+ gr = FindGlyphRef(&globalGlyphs[glyphSet->fdepth], signature,
+ TRUE, glyph->sha1);
+ if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) {
+ FreeGlyphPicture(glyph);
+ dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
+ glyph = gr->glyph;
+ }
+ else if (gr->glyph != glyph) {
+ gr->glyph = glyph;
+ gr->signature = signature;
+ globalGlyphs[glyphSet->fdepth].tableEntries++;
+ }
+
+ /* Insert/replace glyphset value */
+ gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
+ ++glyph->refcnt;
+ if (gr->glyph && gr->glyph != DeletedGlyph)
+ FreeGlyph(gr->glyph, glyphSet->fdepth);
+ else
+ glyphSet->hash.tableEntries++;
+ gr->glyph = glyph;
+ gr->signature = id;
+ CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
+}
+
+Bool
+DeleteGlyph(GlyphSetPtr glyphSet, Glyph id)
+{
+ GlyphRefPtr gr;
+ GlyphPtr glyph;
+
+ gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
+ glyph = gr->glyph;
+ if (glyph && glyph != DeletedGlyph) {
+ gr->glyph = DeletedGlyph;
+ glyphSet->hash.tableEntries--;
+ FreeGlyph(glyph, glyphSet->fdepth);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+GlyphPtr
+FindGlyph(GlyphSetPtr glyphSet, Glyph id)
+{
+ GlyphPtr glyph;
+
+ glyph = FindGlyphRef(&glyphSet->hash, id, FALSE, 0)->glyph;
+ if (glyph == DeletedGlyph)
+ glyph = 0;
+ return glyph;
+}
+
+GlyphPtr
+AllocateGlyph(xGlyphInfo * gi, int fdepth)
+{
+ PictureScreenPtr ps;
+ int size;
+ GlyphPtr glyph;
+ int i;
+ int head_size;
+
+ head_size = sizeof(GlyphRec) + screenInfo.numScreens * sizeof(PicturePtr);
+ size = (head_size + dixPrivatesSize(PRIVATE_GLYPH));
+ glyph = (GlyphPtr) malloc(size);
+ if (!glyph)
+ return 0;
+ glyph->refcnt = 0;
+ glyph->size = size + sizeof(xGlyphInfo);
+ glyph->info = *gi;
+ dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ GlyphPicture(glyph)[i] = NULL;
+ ps = GetPictureScreenIfSet(screenInfo.screens[i]);
+
+ if (ps) {
+ if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph))
+ goto bail;
+ }
+ }
+
+ return glyph;
+
+ bail:
+ while (i--) {
+ ps = GetPictureScreenIfSet(screenInfo.screens[i]);
+ if (ps)
+ (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
+ }
+
+ dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
+ return 0;
+}
+
+Bool
+AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet)
+{
+ hash->table = calloc(hashSet->size, sizeof(GlyphRefRec));
+ if (!hash->table)
+ return FALSE;
+ hash->hashSet = hashSet;
+ hash->tableEntries = 0;
+ return TRUE;
+}
+
+Bool
+ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global)
+{
+ CARD32 tableEntries;
+ GlyphHashSetPtr hashSet;
+ GlyphHashRec newHash;
+ GlyphRefPtr gr;
+ GlyphPtr glyph;
+ int i;
+ int oldSize;
+ CARD32 s;
+
+ tableEntries = hash->tableEntries + change;
+ hashSet = FindGlyphHashSet(tableEntries);
+ if (hashSet == hash->hashSet)
+ return TRUE;
+ if (global)
+ CheckDuplicates(hash, "ResizeGlyphHash top");
+ if (!AllocateGlyphHash(&newHash, hashSet))
+ return FALSE;
+ if (hash->table) {
+ oldSize = hash->hashSet->size;
+ for (i = 0; i < oldSize; i++) {
+ glyph = hash->table[i].glyph;
+ if (glyph && glyph != DeletedGlyph) {
+ s = hash->table[i].signature;
+ gr = FindGlyphRef(&newHash, s, global, glyph->sha1);
+
+ gr->signature = s;
+ gr->glyph = glyph;
+ ++newHash.tableEntries;
+ }
+ }
+ free(hash->table);
+ }
+ *hash = newHash;
+ if (global)
+ CheckDuplicates(hash, "ResizeGlyphHash bottom");
+ return TRUE;
+}
+
+Bool
+ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change)
+{
+ return (ResizeGlyphHash(&glyphSet->hash, change, FALSE) &&
+ ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], change, TRUE));
+}
+
+GlyphSetPtr
+AllocateGlyphSet(int fdepth, PictFormatPtr format)
+{
+ GlyphSetPtr glyphSet;
+
+ if (!globalGlyphs[fdepth].hashSet) {
+ if (!AllocateGlyphHash(&globalGlyphs[fdepth], &glyphHashSets[0]))
+ return FALSE;
+ }
+
+ glyphSet = dixAllocateObjectWithPrivates(GlyphSetRec, PRIVATE_GLYPHSET);
+ if (!glyphSet)
+ return FALSE;
+
+ if (!AllocateGlyphHash(&glyphSet->hash, &glyphHashSets[0])) {
+ free(glyphSet);
+ return FALSE;
+ }
+ glyphSet->refcnt = 1;
+ glyphSet->fdepth = fdepth;
+ glyphSet->format = format;
+ return glyphSet;
+}
+
+int
+FreeGlyphSet(pointer value, XID gid)
+{
+ GlyphSetPtr glyphSet = (GlyphSetPtr) value;
+
+ if (--glyphSet->refcnt == 0) {
+ CARD32 i, tableSize = glyphSet->hash.hashSet->size;
+ GlyphRefPtr table = glyphSet->hash.table;
+ GlyphPtr glyph;
+
+ for (i = 0; i < tableSize; i++) {
+ glyph = table[i].glyph;
+ if (glyph && glyph != DeletedGlyph)
+ FreeGlyph(glyph, glyphSet->fdepth);
+ }
+ if (!globalGlyphs[glyphSet->fdepth].tableEntries) {
+ free(globalGlyphs[glyphSet->fdepth].table);
+ globalGlyphs[glyphSet->fdepth].table = 0;
+ globalGlyphs[glyphSet->fdepth].hashSet = 0;
+ }
+ else
+ ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], 0, TRUE);
+ free(table);
+ dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET);
+ }
+ return Success;
+}
+
+static 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);
+}
+
+Bool
+miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph)
+{
+ return TRUE;
+}
+
+void
+miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph)
+{
+}
+
+void
+miGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
+{
+ 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 = { 0, 0, 0, 0 };
+ 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,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ 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;
+ }
+ while (nlist--) {
+ x += list->xOff;
+ y += list->yOff;
+ n = list->len;
+ while (n--) {
+ glyph = *glyphs++;
+ pPicture = GlyphPicture(glyph)[pScreen->myNum];
+
+ if (pPicture) {
+ 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 (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/xorg-server/render/glyphstr.h b/xorg-server/render/glyphstr.h
index 49b4b54dd..cbc4751f0 100644
--- a/xorg-server/render/glyphstr.h
+++ b/xorg-server/render/glyphstr.h
@@ -40,41 +40,41 @@
#define GlyphFormatNum 5
typedef struct _Glyph {
- CARD32 refcnt;
- PrivateRec *devPrivates;
- unsigned char sha1[20];
- CARD32 size; /* info + bitmap */
- xGlyphInfo info;
+ CARD32 refcnt;
+ PrivateRec *devPrivates;
+ unsigned char sha1[20];
+ CARD32 size; /* info + bitmap */
+ xGlyphInfo info;
/* per-screen pixmaps follow */
} GlyphRec, *GlyphPtr;
#define GlyphPicture(glyph) ((PicturePtr *) ((glyph) + 1))
typedef struct _GlyphRef {
- CARD32 signature;
- GlyphPtr glyph;
+ CARD32 signature;
+ GlyphPtr glyph;
} GlyphRefRec, *GlyphRefPtr;
#define DeletedGlyph ((GlyphPtr) 1)
typedef struct _GlyphHashSet {
- CARD32 entries;
- CARD32 size;
- CARD32 rehash;
+ CARD32 entries;
+ CARD32 size;
+ CARD32 rehash;
} GlyphHashSetRec, *GlyphHashSetPtr;
typedef struct _GlyphHash {
- GlyphRefPtr table;
+ GlyphRefPtr table;
GlyphHashSetPtr hashSet;
- CARD32 tableEntries;
+ CARD32 tableEntries;
} GlyphHashRec, *GlyphHashPtr;
typedef struct _GlyphSet {
- CARD32 refcnt;
- int fdepth;
- PictFormatPtr format;
- GlyphHashRec hash;
- PrivateRec *devPrivates;
+ CARD32 refcnt;
+ int fdepth;
+ PictFormatPtr format;
+ GlyphHashRec hash;
+ PrivateRec *devPrivates;
} GlyphSetRec, *GlyphSetPtr;
#define GlyphSetGetPrivate(pGlyphSet,k) \
@@ -84,64 +84,53 @@ typedef struct _GlyphSet {
dixSetPrivate(&(pGlyphSet)->devPrivates, k, ptr)
typedef struct _GlyphList {
- INT16 xOff;
- INT16 yOff;
- CARD8 len;
- PictFormatPtr format;
+ INT16 xOff;
+ INT16 yOff;
+ CARD8 len;
+ PictFormatPtr format;
} GlyphListRec, *GlyphListPtr;
extern _X_EXPORT void
-GlyphUninit (ScreenPtr pScreen);
+ GlyphUninit(ScreenPtr pScreen);
-extern _X_EXPORT GlyphHashSetPtr
-FindGlyphHashSet (CARD32 filled);
+extern _X_EXPORT GlyphHashSetPtr FindGlyphHashSet(CARD32 filled);
extern _X_EXPORT GlyphRefPtr
-FindGlyphRef (GlyphHashPtr hash,
- CARD32 signature,
- Bool match,
- unsigned char sha1[20]);
+FindGlyphRef(GlyphHashPtr hash,
+ CARD32 signature, Bool match, unsigned char sha1[20]);
-extern _X_EXPORT GlyphPtr
-FindGlyphByHash (unsigned char sha1[20], int format);
+extern _X_EXPORT GlyphPtr FindGlyphByHash(unsigned char sha1[20], int format);
extern _X_EXPORT int
-HashGlyph (xGlyphInfo *gi,
- CARD8 *bits,
- unsigned long size,
- unsigned char sha1[20]);
+
+HashGlyph(xGlyphInfo * gi,
+ CARD8 *bits, unsigned long size, unsigned char sha1[20]);
extern _X_EXPORT void
-FreeGlyph (GlyphPtr glyph, int format);
+ FreeGlyph(GlyphPtr glyph, int format);
extern _X_EXPORT void
-AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
+ AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
extern _X_EXPORT Bool
-DeleteGlyph (GlyphSetPtr glyphSet, Glyph id);
+ DeleteGlyph(GlyphSetPtr glyphSet, Glyph id);
-extern _X_EXPORT GlyphPtr
-FindGlyph (GlyphSetPtr glyphSet, Glyph id);
+extern _X_EXPORT GlyphPtr FindGlyph(GlyphSetPtr glyphSet, Glyph id);
-extern _X_EXPORT GlyphPtr
-AllocateGlyph (xGlyphInfo *gi, int format);
+extern _X_EXPORT GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format);
extern _X_EXPORT Bool
-AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet);
+ AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet);
extern _X_EXPORT Bool
-ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global);
+ ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global);
extern _X_EXPORT Bool
-ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change);
+ ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change);
-extern _X_EXPORT GlyphSetPtr
-AllocateGlyphSet (int fdepth, PictFormatPtr format);
+extern _X_EXPORT GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format);
extern _X_EXPORT int
-FreeGlyphSet (pointer value,
- XID gid);
-
-
+ FreeGlyphSet(pointer value, XID gid);
-#endif /* _GLYPHSTR_H_ */
+#endif /* _GLYPHSTR_H_ */
diff --git a/xorg-server/render/matrix.c b/xorg-server/render/matrix.c
index eccb90270..83cd66c43 100644
--- a/xorg-server/render/matrix.c
+++ b/xorg-server/render/matrix.c
@@ -40,8 +40,8 @@
#include "picturestr.h"
void
-PictTransform_from_xRenderTransform (PictTransformPtr pict,
- xRenderTransform *render)
+PictTransform_from_xRenderTransform(PictTransformPtr pict,
+ xRenderTransform * render)
{
pict->matrix[0][0] = render->matrix11;
pict->matrix[0][1] = render->matrix12;
@@ -57,8 +57,8 @@ PictTransform_from_xRenderTransform (PictTransformPtr pict,
}
void
-xRenderTransform_from_PictTransform (xRenderTransform *render,
- PictTransformPtr pict)
+xRenderTransform_from_PictTransform(xRenderTransform * render,
+ PictTransformPtr pict)
{
render->matrix11 = pict->matrix[0][0];
render->matrix12 = pict->matrix[0][1];
@@ -74,15 +74,13 @@ xRenderTransform_from_PictTransform (xRenderTransform *render,
}
Bool
-PictureTransformPoint (PictTransformPtr transform,
- PictVectorPtr vector)
+PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector)
{
- return pixman_transform_point(transform, vector);
+ return pixman_transform_point(transform, vector);
}
Bool
-PictureTransformPoint3d (PictTransformPtr transform,
- PictVectorPtr vector)
+PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector)
{
- return pixman_transform_point_3d(transform, vector);
+ return pixman_transform_point_3d(transform, vector);
}
diff --git a/xorg-server/render/miindex.c b/xorg-server/render/miindex.c
index 23c871ba1..0375e8f88 100644
--- a/xorg-server/render/miindex.c
+++ b/xorg-server/render/miindex.c
@@ -1,352 +1,332 @@
-/*
- *
- * Copyright © 2001 Keith Packard, member of The XFree86 Project, 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 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
-
-#ifndef _MIINDEX_H_
-#define _MIINDEX_H_
-
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "mipict.h"
-#include "colormapst.h"
-
-#define NUM_CUBE_LEVELS 4
-#define NUM_GRAY_LEVELS 13
-
-static Bool
-miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump)
-{
- int r, g, b;
- unsigned short red, green, blue;
- Pixel pixel;
- Bool used[MI_MAX_INDEXED];
- int needed;
- int policy;
- int cube, gray;
- int i, n;
-
- if (pColormap->mid != pColormap->pScreen->defColormap)
- {
- policy = PictureCmapPolicyAll;
- }
- else
- {
- int avail = pColormap->pVisual->ColormapEntries;
- policy = PictureCmapPolicy;
- if (policy == PictureCmapPolicyDefault)
- {
- if (avail >= 256 && (pColormap->pVisual->class|DynamicClass) == PseudoColor)
- policy = PictureCmapPolicyColor;
- else if (avail >= 64)
- policy = PictureCmapPolicyGray;
- else
- policy = PictureCmapPolicyMono;
- }
- }
- /*
- * Make sure enough cells are free for the chosen policy
- */
- for (;;)
- {
- switch (policy) {
- case PictureCmapPolicyAll:
- needed = 0;
- break;
- case PictureCmapPolicyColor:
- needed = 71;
- break;
- case PictureCmapPolicyGray:
- needed = 11;
- break;
- case PictureCmapPolicyMono:
- default:
- needed = 0;
- break;
- }
- if (needed <= pColormap->freeRed)
- break;
- policy--;
- }
-
- /*
- * Compute size of cube and gray ramps
- */
- cube = gray = 0;
- switch (policy) {
- case PictureCmapPolicyAll:
- /*
- * Allocate as big a cube as possible
- */
- if ((pColormap->pVisual->class|DynamicClass) == PseudoColor)
- {
- for (cube = 1; cube * cube * cube < pColormap->pVisual->ColormapEntries; cube++)
- ;
- cube--;
- if (cube == 1)
- cube = 0;
- }
- else
- cube = 0;
- /*
- * Figure out how many gray levels to use so that they
- * line up neatly with the cube
- */
- if (cube)
- {
- needed = pColormap->pVisual->ColormapEntries - (cube*cube*cube);
- /* levels to fill in with */
- gray = needed / (cube - 1);
- /* total levels */
- gray = (gray + 1) * (cube - 1) + 1;
- }
- else
- gray = pColormap->pVisual->ColormapEntries;
- break;
-
- case PictureCmapPolicyColor:
- cube = NUM_CUBE_LEVELS;
- /* fall through ... */
- case PictureCmapPolicyGray:
- gray = NUM_GRAY_LEVELS;
- break;
- case PictureCmapPolicyMono:
- default:
- gray = 2;
- break;
- }
-
- memset (used, '\0', pColormap->pVisual->ColormapEntries * sizeof (Bool));
- for (r = 0; r < cube; r++)
- for (g = 0; g < cube; g++)
- for (b = 0; b < cube; b++)
- {
- pixel = 0;
- red = (r * 65535 + (cube-1)/2) / (cube - 1);
- green = (g * 65535 + (cube-1)/2) / (cube - 1);
- blue = (b * 65535 + (cube-1)/2) / (cube - 1);
- if (AllocColor (pColormap, &red, &green,
- &blue, &pixel, 0) != Success)
- return FALSE;
- used[pixel] = TRUE;
- }
- for (g = 0; g < gray; g++)
- {
- pixel = 0;
- red = green = blue = (g * 65535 + (gray-1)/2) / (gray - 1);
- if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success)
- return FALSE;
- used[pixel] = TRUE;
- }
- n = 0;
- for (i = 0; i < pColormap->pVisual->ColormapEntries; i++)
- if (used[i])
- pixels[n++] = i;
-
- *nump = n;
-
- return TRUE;
-}
-
-/* 0 <= red, green, blue < 32 */
-static Pixel
-FindBestColor (miIndexedPtr pIndexed, Pixel *pixels, int num,
- int red, int green, int blue)
-{
- Pixel best = pixels[0];
- int bestDist = 1 << 30;
- int dist;
- int dr, dg, db;
- while (num--)
- {
- Pixel pixel = *pixels++;
- CARD32 v = pIndexed->rgba[pixel];
-
- dr = ((v >> 19) & 0x1f);
- dg = ((v >> 11) & 0x1f);
- db = ((v >> 3) & 0x1f);
- dr = dr - red;
- dg = dg - green;
- db = db - blue;
- dist = dr * dr + dg * dg + db * db;
- if (dist < bestDist)
- {
- bestDist = dist;
- best = pixel;
- }
- }
- return best;
-}
-
-/* 0 <= gray < 32768 */
-static Pixel
-FindBestGray (miIndexedPtr pIndexed, Pixel *pixels, int num, int gray)
-{
- Pixel best = pixels[0];
- int bestDist = 1 << 30;
- int dist;
- int dr;
- int r;
-
- while (num--)
- {
- Pixel pixel = *pixels++;
- CARD32 v = pIndexed->rgba[pixel];
-
- r = v & 0xff;
- r = r | (r << 8);
- dr = gray - (r >> 1);
- dist = dr * dr;
- if (dist < bestDist)
- {
- bestDist = dist;
- best = pixel;
- }
- }
- return best;
-}
-
-Bool
-miInitIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat)
-{
- ColormapPtr pColormap = pFormat->index.pColormap;
- VisualPtr pVisual = pColormap->pVisual;
- miIndexedPtr pIndexed;
- Pixel pixels[MI_MAX_INDEXED];
- xrgb rgb[MI_MAX_INDEXED];
- int num;
- int i;
- Pixel p, r, g, b;
-
- if (pVisual->ColormapEntries > MI_MAX_INDEXED)
- return FALSE;
-
- if (pVisual->class & DynamicClass)
- {
- if (!miBuildRenderColormap (pColormap, pixels, &num))
- return FALSE;
- }
- else
- {
- num = pVisual->ColormapEntries;
- for (p = 0; p < num; p++)
- pixels[p] = p;
- }
-
- pIndexed = malloc(sizeof (miIndexedRec));
- if (!pIndexed)
- return FALSE;
-
- pFormat->index.nvalues = num;
- pFormat->index.pValues = malloc(num * sizeof (xIndexValue));
- if (!pFormat->index.pValues)
- {
- free(pIndexed);
- return FALSE;
- }
-
-
- /*
- * Build mapping from pixel value to ARGB
- */
- QueryColors (pColormap, num, pixels, rgb, serverClient);
- for (i = 0; i < num; i++)
- {
- p = pixels[i];
- pFormat->index.pValues[i].pixel = p;
- pFormat->index.pValues[i].red = rgb[i].red;
- pFormat->index.pValues[i].green = rgb[i].green;
- pFormat->index.pValues[i].blue = rgb[i].blue;
- pFormat->index.pValues[i].alpha = 0xffff;
- pIndexed->rgba[p] = (0xff000000 |
- ((rgb[i].red & 0xff00) << 8) |
- ((rgb[i].green & 0xff00) ) |
- ((rgb[i].blue & 0xff00) >> 8));
- }
-
- /*
- * Build mapping from RGB to pixel value. This could probably be
- * done a bit quicker...
- */
- switch (pVisual->class | DynamicClass) {
- case GrayScale:
- pIndexed->color = FALSE;
- for (r = 0; r < 32768; r++)
- pIndexed->ent[r] = FindBestGray (pIndexed, pixels, num, r);
- break;
- case PseudoColor:
- pIndexed->color = TRUE;
- p = 0;
- for (r = 0; r < 32; r++)
- for (g = 0; g < 32; g++)
- for (b = 0; b < 32; b++)
- {
- pIndexed->ent[p] = FindBestColor (pIndexed, pixels, num,
- r, g, b);
- p++;
- }
- break;
- }
- pFormat->index.devPrivate = pIndexed;
- return TRUE;
-}
-
-void
-miCloseIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat)
-{
- free(pFormat->index.devPrivate);
- pFormat->index.devPrivate = NULL;
- free(pFormat->index.pValues);
- pFormat->index.pValues = NULL;
-}
-
-void
-miUpdateIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef)
-{
- miIndexedPtr pIndexed = pFormat->index.devPrivate;
-
- if (pIndexed)
- {
- while (ndef--)
- {
- pIndexed->rgba[pdef->pixel] = (0xff000000 |
- ((pdef->red & 0xff00) << 8) |
- ((pdef->green & 0xff00) ) |
- ((pdef->blue & 0xff00) >> 8));
- pdef++;
- }
- }
-}
-
-#endif /* _MIINDEX_H_ */
+/*
+ *
+ * Copyright © 2001 Keith Packard, member of The XFree86 Project, 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 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
+
+#ifndef _MIINDEX_H_
+#define _MIINDEX_H_
+
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "mipict.h"
+#include "colormapst.h"
+
+#define NUM_CUBE_LEVELS 4
+#define NUM_GRAY_LEVELS 13
+
+static Bool
+miBuildRenderColormap(ColormapPtr pColormap, Pixel * pixels, int *nump)
+{
+ int r, g, b;
+ unsigned short red, green, blue;
+ Pixel pixel;
+ Bool used[MI_MAX_INDEXED];
+ int needed;
+ int policy;
+ int cube, gray;
+ int i, n;
+
+ if (pColormap->mid != pColormap->pScreen->defColormap) {
+ policy = PictureCmapPolicyAll;
+ }
+ else {
+ int avail = pColormap->pVisual->ColormapEntries;
+
+ policy = PictureCmapPolicy;
+ if (policy == PictureCmapPolicyDefault) {
+ if (avail >= 256 &&
+ (pColormap->pVisual->class | DynamicClass) == PseudoColor)
+ policy = PictureCmapPolicyColor;
+ else if (avail >= 64)
+ policy = PictureCmapPolicyGray;
+ else
+ policy = PictureCmapPolicyMono;
+ }
+ }
+ /*
+ * Make sure enough cells are free for the chosen policy
+ */
+ for (;;) {
+ switch (policy) {
+ case PictureCmapPolicyAll:
+ needed = 0;
+ break;
+ case PictureCmapPolicyColor:
+ needed = 71;
+ break;
+ case PictureCmapPolicyGray:
+ needed = 11;
+ break;
+ case PictureCmapPolicyMono:
+ default:
+ needed = 0;
+ break;
+ }
+ if (needed <= pColormap->freeRed)
+ break;
+ policy--;
+ }
+
+ /*
+ * Compute size of cube and gray ramps
+ */
+ cube = gray = 0;
+ switch (policy) {
+ case PictureCmapPolicyAll:
+ /*
+ * Allocate as big a cube as possible
+ */
+ if ((pColormap->pVisual->class | DynamicClass) == PseudoColor) {
+ for (cube = 1;
+ cube * cube * cube < pColormap->pVisual->ColormapEntries;
+ cube++);
+ cube--;
+ if (cube == 1)
+ cube = 0;
+ }
+ else
+ cube = 0;
+ /*
+ * Figure out how many gray levels to use so that they
+ * line up neatly with the cube
+ */
+ if (cube) {
+ needed = pColormap->pVisual->ColormapEntries - (cube * cube * cube);
+ /* levels to fill in with */
+ gray = needed / (cube - 1);
+ /* total levels */
+ gray = (gray + 1) * (cube - 1) + 1;
+ }
+ else
+ gray = pColormap->pVisual->ColormapEntries;
+ break;
+
+ case PictureCmapPolicyColor:
+ cube = NUM_CUBE_LEVELS;
+ /* fall through ... */
+ case PictureCmapPolicyGray:
+ gray = NUM_GRAY_LEVELS;
+ break;
+ case PictureCmapPolicyMono:
+ default:
+ gray = 2;
+ break;
+ }
+
+ memset(used, '\0', pColormap->pVisual->ColormapEntries * sizeof(Bool));
+ for (r = 0; r < cube; r++)
+ for (g = 0; g < cube; g++)
+ for (b = 0; b < cube; b++) {
+ pixel = 0;
+ red = (r * 65535 + (cube - 1) / 2) / (cube - 1);
+ green = (g * 65535 + (cube - 1) / 2) / (cube - 1);
+ blue = (b * 65535 + (cube - 1) / 2) / (cube - 1);
+ if (AllocColor(pColormap, &red, &green,
+ &blue, &pixel, 0) != Success)
+ return FALSE;
+ used[pixel] = TRUE;
+ }
+ for (g = 0; g < gray; g++) {
+ pixel = 0;
+ red = green = blue = (g * 65535 + (gray - 1) / 2) / (gray - 1);
+ if (AllocColor(pColormap, &red, &green, &blue, &pixel, 0) != Success)
+ return FALSE;
+ used[pixel] = TRUE;
+ }
+ n = 0;
+ for (i = 0; i < pColormap->pVisual->ColormapEntries; i++)
+ if (used[i])
+ pixels[n++] = i;
+
+ *nump = n;
+
+ return TRUE;
+}
+
+/* 0 <= red, green, blue < 32 */
+static Pixel
+FindBestColor(miIndexedPtr pIndexed, Pixel * pixels, int num,
+ int red, int green, int blue)
+{
+ Pixel best = pixels[0];
+ int bestDist = 1 << 30;
+ int dist;
+ int dr, dg, db;
+
+ while (num--) {
+ Pixel pixel = *pixels++;
+ CARD32 v = pIndexed->rgba[pixel];
+
+ dr = ((v >> 19) & 0x1f);
+ dg = ((v >> 11) & 0x1f);
+ db = ((v >> 3) & 0x1f);
+ dr = dr - red;
+ dg = dg - green;
+ db = db - blue;
+ dist = dr * dr + dg * dg + db * db;
+ if (dist < bestDist) {
+ bestDist = dist;
+ best = pixel;
+ }
+ }
+ return best;
+}
+
+/* 0 <= gray < 32768 */
+static Pixel
+FindBestGray(miIndexedPtr pIndexed, Pixel * pixels, int num, int gray)
+{
+ Pixel best = pixels[0];
+ int bestDist = 1 << 30;
+ int dist;
+ int dr;
+ int r;
+
+ while (num--) {
+ Pixel pixel = *pixels++;
+ CARD32 v = pIndexed->rgba[pixel];
+
+ r = v & 0xff;
+ r = r | (r << 8);
+ dr = gray - (r >> 1);
+ dist = dr * dr;
+ if (dist < bestDist) {
+ bestDist = dist;
+ best = pixel;
+ }
+ }
+ return best;
+}
+
+Bool
+miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ ColormapPtr pColormap = pFormat->index.pColormap;
+ VisualPtr pVisual = pColormap->pVisual;
+ miIndexedPtr pIndexed;
+ Pixel pixels[MI_MAX_INDEXED];
+ xrgb rgb[MI_MAX_INDEXED];
+ int num;
+ int i;
+ Pixel p, r, g, b;
+
+ if (pVisual->ColormapEntries > MI_MAX_INDEXED)
+ return FALSE;
+
+ if (pVisual->class & DynamicClass) {
+ if (!miBuildRenderColormap(pColormap, pixels, &num))
+ return FALSE;
+ }
+ else {
+ num = pVisual->ColormapEntries;
+ for (p = 0; p < num; p++)
+ pixels[p] = p;
+ }
+
+ pIndexed = malloc(sizeof(miIndexedRec));
+ if (!pIndexed)
+ return FALSE;
+
+ pFormat->index.nvalues = num;
+ pFormat->index.pValues = malloc(num * sizeof(xIndexValue));
+ if (!pFormat->index.pValues) {
+ free(pIndexed);
+ return FALSE;
+ }
+
+ /*
+ * Build mapping from pixel value to ARGB
+ */
+ QueryColors(pColormap, num, pixels, rgb, serverClient);
+ for (i = 0; i < num; i++) {
+ p = pixels[i];
+ pFormat->index.pValues[i].pixel = p;
+ pFormat->index.pValues[i].red = rgb[i].red;
+ pFormat->index.pValues[i].green = rgb[i].green;
+ pFormat->index.pValues[i].blue = rgb[i].blue;
+ pFormat->index.pValues[i].alpha = 0xffff;
+ pIndexed->rgba[p] = (0xff000000 |
+ ((rgb[i].red & 0xff00) << 8) |
+ ((rgb[i].green & 0xff00)) |
+ ((rgb[i].blue & 0xff00) >> 8));
+ }
+
+ /*
+ * Build mapping from RGB to pixel value. This could probably be
+ * done a bit quicker...
+ */
+ switch (pVisual->class | DynamicClass) {
+ case GrayScale:
+ pIndexed->color = FALSE;
+ for (r = 0; r < 32768; r++)
+ pIndexed->ent[r] = FindBestGray(pIndexed, pixels, num, r);
+ break;
+ case PseudoColor:
+ pIndexed->color = TRUE;
+ p = 0;
+ for (r = 0; r < 32; r++)
+ for (g = 0; g < 32; g++)
+ for (b = 0; b < 32; b++) {
+ pIndexed->ent[p] = FindBestColor(pIndexed, pixels, num,
+ r, g, b);
+ p++;
+ }
+ break;
+ }
+ pFormat->index.devPrivate = pIndexed;
+ return TRUE;
+}
+
+void
+miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ free(pFormat->index.devPrivate);
+ pFormat->index.devPrivate = NULL;
+ free(pFormat->index.pValues);
+ pFormat->index.pValues = NULL;
+}
+
+void
+miUpdateIndexed(ScreenPtr pScreen,
+ PictFormatPtr pFormat, int ndef, xColorItem * pdef)
+{
+ miIndexedPtr pIndexed = pFormat->index.devPrivate;
+
+ if (pIndexed) {
+ while (ndef--) {
+ pIndexed->rgba[pdef->pixel] = (0xff000000 |
+ ((pdef->red & 0xff00) << 8) |
+ ((pdef->green & 0xff00)) |
+ ((pdef->blue & 0xff00) >> 8));
+ pdef++;
+ }
+ }
+}
+
+#endif /* _MIINDEX_H_ */
diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c
index 0b86bee34..2e64b20ff 100644
--- a/xorg-server/render/mipict.c
+++ b/xorg-server/render/mipict.c
@@ -34,76 +34,72 @@
#include "mipict.h"
int
-miCreatePicture (PicturePtr pPicture)
+miCreatePicture(PicturePtr pPicture)
{
return Success;
}
void
-miDestroyPicture (PicturePtr pPicture)
+miDestroyPicture(PicturePtr pPicture)
{
if (pPicture->freeCompClip)
- RegionDestroy(pPicture->pCompositeClip);
+ RegionDestroy(pPicture->pCompositeClip);
}
void
-miDestroyPictureClip (PicturePtr pPicture)
+miDestroyPictureClip(PicturePtr pPicture)
{
switch (pPicture->clientClipType) {
case CT_NONE:
- return;
+ return;
case CT_PIXMAP:
- (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
- break;
+ (*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;
+ /*
+ * 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)
+miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- pointer clientClip;
- int clientClipType;
-
+ 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;
+ /* 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;
+ clientClip = value;
+ clientClipType = CT_REGION;
+ break;
case CT_NONE:
- clientClip = 0;
- clientClipType = CT_NONE;
- break;
+ clientClip = 0;
+ clientClipType = CT_NONE;
+ break;
default:
- clientClip = (pointer) RegionFromRects(n,
- (xRectangle *) value,
- type);
- if (!clientClip)
- return BadAlloc;
- clientClipType = CT_REGION;
- free(value);
- break;
+ clientClip = (pointer) RegionFromRects(n, (xRectangle *) value, type);
+ if (!clientClip)
+ return BadAlloc;
+ clientClipType = CT_REGION;
+ free(value);
+ break;
}
(*ps->DestroyPictureClip) (pPicture);
pPicture->clientClip = clientClip;
@@ -113,149 +109,137 @@ miChangePictureClip (PicturePtr pPicture,
}
void
-miChangePicture (PicturePtr pPicture,
- Mask mask)
+miChangePicture(PicturePtr pPicture, Mask mask)
{
return;
}
void
-miValidatePicture (PicturePtr pPicture,
- Mask mask)
+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 */
+ 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)
+miChangePictureTransform(PicturePtr pPicture, PictTransform * transform)
{
return Success;
}
int
-miChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams)
+miChangePictureFilter(PicturePtr pPicture,
+ int filter, xFixed * params, int nparams)
{
return Success;
}
@@ -263,96 +247,85 @@ miChangePictureFilter (PicturePtr pPicture,
#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)
+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);
- }
+ 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);
+ 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)
+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;
+ 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)
+SourceValidateOnePicture(PicturePtr pPicture)
{
- DrawablePtr pDrawable = pPicture->pDrawable;
- ScreenPtr pScreen;
+ 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);
+ if (pScreen->SourceValidate) {
+ pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width,
+ pDrawable->height, pPicture->subWindowMode);
}
}
void
-miCompositeSourceValidate (PicturePtr pPicture)
+miCompositeSourceValidate(PicturePtr pPicture)
{
- SourceValidateOnePicture (pPicture);
+ SourceValidateOnePicture(pPicture);
if (pPicture->alphaMap)
- SourceValidateOnePicture (pPicture->alphaMap);
+ SourceValidateOnePicture(pPicture->alphaMap);
}
/*
@@ -361,21 +334,18 @@ miCompositeSourceValidate (PicturePtr pPicture)
*/
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)
+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;
+
+ int v;
pRegion->extents.x1 = xDst;
v = xDst + width;
@@ -386,254 +356,226 @@ miComputeCompositeRegion (RegionPtr pRegion,
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;
+ 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 (!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;
- }
+ 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 (!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;
- }
+ 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;
- }
- }
+ 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);
+ miCompositeSourceValidate(pSrc);
if (pMask)
- miCompositeSourceValidate (pMask);
+ miCompositeSourceValidate(pMask);
return TRUE;
}
void
-miRenderColorToPixel (PictFormatPtr format,
- xRenderColor *color,
- CARD32 *pixel)
+miRenderColorToPixel(PictFormatPtr format, xRenderColor * color, CARD32 *pixel)
{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
+ 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;
+ 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;
+ 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)
+miFillColor(CARD32 pixel, int bits)
{
- while (bits < 16)
- {
- pixel |= pixel << bits;
- bits <<= 1;
+ while (bits < 16) {
+ pixel |= pixel << bits;
+ bits <<= 1;
}
return (CARD16) pixel;
}
Bool
-miIsSolidAlpha (PicturePtr pSrc)
+miIsSolidAlpha(PicturePtr pSrc)
{
- ScreenPtr pScreen;
- char line[1];
+ 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;
+ if (PICT_FORMAT_TYPE(pSrc->format) != PICT_TYPE_A)
+ return FALSE;
/* repeat */
if (!pSrc->repeat)
- return FALSE;
+ return FALSE;
/* 1x1 */
if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1)
- return FALSE;
+ 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;
+ return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80;
case 4:
- return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
+ return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0;
case 8:
- return (CARD8) line[0] == 0xff;
+ return (CARD8) line[0] == 0xff;
default:
- return FALSE;
+ return FALSE;
}
}
void
-miRenderPixelToColor (PictFormatPtr format,
- CARD32 pixel,
- xRenderColor *color)
+miRenderPixelToColor(PictFormatPtr format, CARD32 pixel, xRenderColor * color)
{
- CARD32 r, g, b, a;
- miIndexedPtr pIndexed;
-
+ 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;
+ 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;
+ 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;
}
}
void
-miTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+miTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- xTriangle *tris, *tri;
- int ntri;
+ xTriangle *tris, *tri;
+ int ntri;
ntri = npoints - 2;
- tris = malloc(ntri * sizeof (xTriangle));
+ tris = malloc(ntri * sizeof(xTriangle));
if (!tris)
return;
- for (tri = tris; npoints >= 3; npoints--, points++, tri++)
- {
+ for (tri = tris; npoints >= 3; npoints--, points++, tri++) {
tri->p1 = points[0];
tri->p2 = points[1];
tri->p3 = points[2];
}
- CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
+ CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
free(tris);
}
void
-miTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+miTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- xTriangle *tris, *tri;
- xPointFixed *first;
- int ntri;
+ xTriangle *tris, *tri;
+ xPointFixed *first;
+ int ntri;
ntri = npoints - 2;
- tris = malloc(ntri * sizeof (xTriangle));
+ tris = malloc(ntri * sizeof(xTriangle));
if (!tris)
- return;
+ return;
first = points++;
- for (tri = tris; npoints >= 3; npoints--, points++, tri++)
- {
- tri->p1 = *first;
- tri->p2 = points[0];
- tri->p3 = points[1];
+ for (tri = tris; npoints >= 3; npoints--, points++, tri++) {
+ tri->p1 = *first;
+ tri->p2 = points[0];
+ tri->p3 = points[1];
}
- CompositeTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
+ CompositeTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
free(tris);
}
Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
- PictureScreenPtr ps;
-
- if (!PictureInit (pScreen, formats, nformats))
- return FALSE;
+ PictureScreenPtr ps;
+
+ if (!PictureInit(pScreen, formats, nformats))
+ return FALSE;
ps = GetPictureScreen(pScreen);
ps->CreatePicture = miCreatePicture;
ps->DestroyPicture = miDestroyPicture;
@@ -650,18 +592,18 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
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 */
-
- ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */
- ps->TriFan = miTriFan;
+ 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 */
+
+ ps->TriStrip = miTriStrip; /* converts call to CompositeTriangles */
+ ps->TriFan = miTriFan;
return TRUE;
}
diff --git a/xorg-server/render/mipict.h b/xorg-server/render/mipict.h
index 4399a6fad..943622888 100644
--- a/xorg-server/render/mipict.h
+++ b/xorg-server/render/mipict.h
@@ -27,16 +27,16 @@
#include "picturestr.h"
-#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
+#define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */
#if MI_MAX_INDEXED <= 256
typedef CARD8 miIndexType;
#endif
typedef struct _miIndexed {
- Bool color;
- CARD32 rgba[MI_MAX_INDEXED];
- miIndexType ent[32768];
+ Bool color;
+ CARD32 rgba[MI_MAX_INDEXED];
+ miIndexType ent[32768];
} miIndexedRec, *miIndexedPtr;
#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
@@ -48,138 +48,113 @@ typedef struct _miIndexed {
#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
extern _X_EXPORT int
-miCreatePicture (PicturePtr pPicture);
+ miCreatePicture(PicturePtr pPicture);
extern _X_EXPORT void
-miDestroyPicture (PicturePtr pPicture);
+ miDestroyPicture(PicturePtr pPicture);
extern _X_EXPORT void
-miDestroyPictureClip (PicturePtr pPicture);
+ miDestroyPictureClip(PicturePtr pPicture);
extern _X_EXPORT int
-miChangePictureClip (PicturePtr pPicture,
- int type,
- pointer value,
- int n);
+ miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n);
extern _X_EXPORT void
-miChangePicture (PicturePtr pPicture,
- Mask mask);
+ miChangePicture(PicturePtr pPicture, Mask mask);
extern _X_EXPORT void
-miValidatePicture (PicturePtr pPicture,
- Mask mask);
+ miValidatePicture(PicturePtr pPicture, Mask mask);
extern _X_EXPORT int
-miChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform);
+ miChangePictureTransform(PicturePtr pPicture, PictTransform * transform);
extern _X_EXPORT int
-miChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
+
+miChangePictureFilter(PicturePtr pPicture,
+ int filter, xFixed * params, int nparams);
extern _X_EXPORT void
-miCompositeSourceValidate (PicturePtr pPicture);
+ miCompositeSourceValidate(PicturePtr pPicture);
extern _X_EXPORT 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);
+
+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);
extern _X_EXPORT Bool
-miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
+ miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
extern _X_EXPORT Bool
-miRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph);
+ miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
extern _X_EXPORT void
-miUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr glyph);
+ miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
extern _X_EXPORT void
-miGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
+
+miGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
extern _X_EXPORT void
-miRenderColorToPixel (PictFormatPtr pPict,
- xRenderColor *color,
- CARD32 *pixel);
+ miRenderColorToPixel(PictFormatPtr pPict, xRenderColor * color, CARD32 *pixel);
extern _X_EXPORT void
-miRenderPixelToColor (PictFormatPtr pPict,
- CARD32 pixel,
- xRenderColor *color);
+ miRenderPixelToColor(PictFormatPtr pPict, CARD32 pixel, xRenderColor * color);
extern _X_EXPORT Bool
-miIsSolidAlpha (PicturePtr pSrc);
+ miIsSolidAlpha(PicturePtr pSrc);
extern _X_EXPORT void
-miCompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
+
+miCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
-miTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
+
+miTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
-miTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
+
+miTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box);
+ miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
extern _X_EXPORT void
-miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds);
-
+ miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
+
extern _X_EXPORT void
-miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds);
+ miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds);
extern _X_EXPORT Bool
-miInitIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
+ miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
extern _X_EXPORT void
-miCloseIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat);
+ miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
extern _X_EXPORT void
-miUpdateIndexed (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef);
-#endif /* _MIPICT_H_ */
+miUpdateIndexed(ScreenPtr pScreen,
+ PictFormatPtr pFormat, int ndef, xColorItem * pdef);
+
+#endif /* _MIPICT_H_ */
diff --git a/xorg-server/render/mirect.c b/xorg-server/render/mirect.c
index d0becd578..357d52860 100644
--- a/xorg-server/render/mirect.c
+++ b/xorg-server/render/mirect.c
@@ -1,185 +1,168 @@
-/*
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, 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 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"
-
-static void
-miColorRects (PicturePtr pDst,
- PicturePtr pClipPict,
- xRenderColor *color,
- int nRect,
- xRectangle *rects,
- int xoff,
- int yoff)
-{
- CARD32 pixel;
- GCPtr pGC;
- ChangeGCVal tmpval[5];
- RegionPtr pClip;
- unsigned long mask;
-
- miRenderColorToPixel (pDst->pFormat, color, &pixel);
-
- pGC = GetScratchGC (pDst->pDrawable->depth, pDst->pDrawable->pScreen);
- if (!pGC)
- return;
- tmpval[0].val = GXcopy;
- tmpval[1].val = pixel;
- tmpval[2].val = pDst->subWindowMode;
- mask = GCFunction | GCForeground | GCSubwindowMode;
- if (pClipPict->clientClipType == CT_REGION)
- {
- tmpval[3].val = pDst->clipOrigin.x - xoff;
- tmpval[4].val = pDst->clipOrigin.y - yoff;
- mask |= GCClipXOrigin|GCClipYOrigin;
-
- pClip = RegionCreate(NULL, 1);
- RegionCopy(pClip,
- (RegionPtr) pClipPict->clientClip);
- (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
- }
-
- ChangeGC (NullClient, pGC, mask, tmpval);
- ValidateGC (pDst->pDrawable, pGC);
- if (xoff || yoff)
- {
- int i;
- for (i = 0; i < nRect; i++)
- {
- rects[i].x -= xoff;
- rects[i].y -= yoff;
- }
- }
- (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects);
- if (xoff || yoff)
- {
- int i;
- for (i = 0; i < nRect; i++)
- {
- rects[i].x += xoff;
- rects[i].y += yoff;
- }
- }
- FreeScratchGC (pGC);
-}
-
-void
-miCompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
-
- if (color->alpha == 0xffff)
- {
- if (op == PictOpOver)
- op = PictOpSrc;
- }
- if (op == PictOpClear)
- color->red = color->green = color->blue = color->alpha = 0;
-
- if (op == PictOpSrc || op == PictOpClear)
- {
- miColorRects (pDst, pDst, color, nRect, rects, 0, 0);
- if (pDst->alphaMap)
- miColorRects (pDst->alphaMap, pDst,
- color, nRect, rects,
- pDst->alphaOrigin.x,
- pDst->alphaOrigin.y);
- }
- else
- {
- PictFormatPtr rgbaFormat;
- PixmapPtr pPixmap;
- PicturePtr pSrc;
- xRectangle one;
- int error;
- Pixel pixel;
- GCPtr pGC;
- ChangeGCVal gcvals[2];
- XID tmpval[1];
-
- rgbaFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
- if (!rgbaFormat)
- goto bail1;
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, rgbaFormat->depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- goto bail2;
-
- miRenderColorToPixel (rgbaFormat, color, &pixel);
-
- pGC = GetScratchGC (rgbaFormat->depth, pScreen);
- if (!pGC)
- goto bail3;
- gcvals[0].val = GXcopy;
- gcvals[1].val = pixel;
-
- ChangeGC (NullClient, pGC, GCFunction | GCForeground, gcvals);
- ValidateGC (&pPixmap->drawable, pGC);
- one.x = 0;
- one.y = 0;
- one.width = 1;
- one.height = 1;
- (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
-
- tmpval[0] = xTrue;
- pSrc = CreatePicture (0, &pPixmap->drawable, rgbaFormat,
- CPRepeat, tmpval, serverClient, &error);
-
- if (!pSrc)
- goto bail4;
-
- while (nRect--)
- {
- CompositePicture (op, pSrc, 0, pDst, 0, 0, 0, 0,
- rects->x,
- rects->y,
- rects->width,
- rects->height);
- rects++;
- }
-
- FreePicture ((pointer) pSrc, 0);
-bail4:
- FreeScratchGC (pGC);
-bail3:
- (*pScreen->DestroyPixmap) (pPixmap);
-bail2:
-bail1:
- ;
- }
-}
+/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, 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 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"
+
+static void
+miColorRects(PicturePtr pDst,
+ PicturePtr pClipPict,
+ xRenderColor * color,
+ int nRect, xRectangle *rects, int xoff, int yoff)
+{
+ CARD32 pixel;
+ GCPtr pGC;
+ ChangeGCVal tmpval[5];
+ RegionPtr pClip;
+ unsigned long mask;
+
+ miRenderColorToPixel(pDst->pFormat, color, &pixel);
+
+ pGC = GetScratchGC(pDst->pDrawable->depth, pDst->pDrawable->pScreen);
+ if (!pGC)
+ return;
+ tmpval[0].val = GXcopy;
+ tmpval[1].val = pixel;
+ tmpval[2].val = pDst->subWindowMode;
+ mask = GCFunction | GCForeground | GCSubwindowMode;
+ if (pClipPict->clientClipType == CT_REGION) {
+ tmpval[3].val = pDst->clipOrigin.x - xoff;
+ tmpval[4].val = pDst->clipOrigin.y - yoff;
+ mask |= GCClipXOrigin | GCClipYOrigin;
+
+ pClip = RegionCreate(NULL, 1);
+ RegionCopy(pClip, (RegionPtr) pClipPict->clientClip);
+ (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
+ }
+
+ ChangeGC(NullClient, pGC, mask, tmpval);
+ ValidateGC(pDst->pDrawable, pGC);
+ if (xoff || yoff) {
+ int i;
+
+ for (i = 0; i < nRect; i++) {
+ rects[i].x -= xoff;
+ rects[i].y -= yoff;
+ }
+ }
+ (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects);
+ if (xoff || yoff) {
+ int i;
+
+ for (i = 0; i < nRect; i++) {
+ rects[i].x += xoff;
+ rects[i].y += yoff;
+ }
+ }
+ FreeScratchGC(pGC);
+}
+
+void
+miCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+
+ if (color->alpha == 0xffff) {
+ if (op == PictOpOver)
+ op = PictOpSrc;
+ }
+ if (op == PictOpClear)
+ color->red = color->green = color->blue = color->alpha = 0;
+
+ if (op == PictOpSrc || op == PictOpClear) {
+ miColorRects(pDst, pDst, color, nRect, rects, 0, 0);
+ if (pDst->alphaMap)
+ miColorRects(pDst->alphaMap, pDst,
+ color, nRect, rects,
+ pDst->alphaOrigin.x, pDst->alphaOrigin.y);
+ }
+ else {
+ PictFormatPtr rgbaFormat;
+ PixmapPtr pPixmap;
+ PicturePtr pSrc;
+ xRectangle one;
+ int error;
+ Pixel pixel;
+ GCPtr pGC;
+ ChangeGCVal gcvals[2];
+ XID tmpval[1];
+
+ rgbaFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
+ if (!rgbaFormat)
+ goto bail1;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, rgbaFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap)
+ goto bail2;
+
+ miRenderColorToPixel(rgbaFormat, color, &pixel);
+
+ pGC = GetScratchGC(rgbaFormat->depth, pScreen);
+ if (!pGC)
+ goto bail3;
+ gcvals[0].val = GXcopy;
+ gcvals[1].val = pixel;
+
+ ChangeGC(NullClient, pGC, GCFunction | GCForeground, gcvals);
+ ValidateGC(&pPixmap->drawable, pGC);
+ one.x = 0;
+ one.y = 0;
+ one.width = 1;
+ one.height = 1;
+ (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
+
+ tmpval[0] = xTrue;
+ pSrc = CreatePicture(0, &pPixmap->drawable, rgbaFormat,
+ CPRepeat, tmpval, serverClient, &error);
+
+ if (!pSrc)
+ goto bail4;
+
+ while (nRect--) {
+ CompositePicture(op, pSrc, 0, pDst, 0, 0, 0, 0,
+ rects->x, rects->y, rects->width, rects->height);
+ rects++;
+ }
+
+ FreePicture((pointer) pSrc, 0);
+ bail4:
+ FreeScratchGC(pGC);
+ bail3:
+ (*pScreen->DestroyPixmap) (pPixmap);
+ bail2:
+ bail1:
+ ;
+ }
+}
diff --git a/xorg-server/render/mitrap.c b/xorg-server/render/mitrap.c
index 445f23630..17b6dcd1c 100644
--- a/xorg-server/render/mitrap.c
+++ b/xorg-server/render/mitrap.c
@@ -35,45 +35,47 @@
#include "mipict.h"
static xFixed
-miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
+miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
+ xFixed dx = l->p2.x - l->p1.x;
+ xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
+ xFixed dy = l->p2.y - l->p1.y;
+
if (ceil)
- ex += (dy - 1);
+ ex += (dy - 1);
return l->p1.x + (xFixed) (ex / dy);
}
void
-miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
+miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
{
box->y1 = MAXSHORT;
box->y2 = MINSHORT;
box->x1 = MAXSHORT;
box->x2 = MINSHORT;
- for (; ntrap; ntrap--, traps++)
- {
- INT16 x1, y1, x2, y2;
+ for (; ntrap; ntrap--, traps++) {
+ INT16 x1, y1, x2, y2;
+
+ if (!xTrapezoidValid(traps))
+ continue;
+ y1 = xFixedToInt(traps->top);
+ if (y1 < box->y1)
+ box->y1 = y1;
+
+ y2 = xFixedToInt(xFixedCeil(traps->bottom));
+ if (y2 > box->y2)
+ box->y2 = y2;
+
+ x1 = xFixedToInt(min(miLineFixedX(&traps->left, traps->top, FALSE),
+ miLineFixedX(&traps->left, traps->bottom, FALSE)));
+ if (x1 < box->x1)
+ box->x1 = x1;
- if (!xTrapezoidValid(traps))
- continue;
- y1 = xFixedToInt (traps->top);
- if (y1 < box->y1)
- box->y1 = y1;
-
- y2 = xFixedToInt (xFixedCeil (traps->bottom));
- if (y2 > box->y2)
- box->y2 = y2;
-
- x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE),
- miLineFixedX (&traps->left, traps->bottom, FALSE)));
- if (x1 < box->x1)
- box->x1 = x1;
-
- x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE),
- miLineFixedX (&traps->right, traps->bottom, TRUE))));
- if (x2 > box->x2)
- box->x2 = x2;
+ x2 = xFixedToInt(xFixedCeil
+ (max
+ (miLineFixedX(&traps->right, traps->top, TRUE),
+ miLineFixedX(&traps->right, traps->bottom, TRUE))));
+ if (x2 > box->x2)
+ box->x2 = x2;
}
}
diff --git a/xorg-server/render/mitri.c b/xorg-server/render/mitri.c
index 8c5298e25..922f22a6a 100644
--- a/xorg-server/render/mitri.c
+++ b/xorg-server/render/mitri.c
@@ -1,68 +1,67 @@
-/*
- *
- * Copyright © 2002 Keith Packard, member of The XFree86 Project, 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 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"
-
-void
-miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds)
-{
- bounds->x1 = xFixedToInt (points->x);
- bounds->x2 = xFixedToInt (xFixedCeil (points->x));
- bounds->y1 = xFixedToInt (points->y);
- bounds->y2 = xFixedToInt (xFixedCeil (points->y));
- points++;
- npoint--;
- while (npoint-- > 0)
- {
- INT16 x1 = xFixedToInt (points->x);
- INT16 x2 = xFixedToInt (xFixedCeil (points->x));
- INT16 y1 = xFixedToInt (points->y);
- INT16 y2 = xFixedToInt (xFixedCeil (points->y));
-
- if (x1 < bounds->x1)
- bounds->x1 = x1;
- else if (x2 > bounds->x2)
- bounds->x2 = x2;
- if (y1 < bounds->y1)
- bounds->y1 = y1;
- else if (y2 > bounds->y2)
- bounds->y2 = y2;
- points++;
- }
-}
-
-void
-miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds)
-{
- miPointFixedBounds (ntri * 3, (xPointFixed *) tris, bounds);
-}
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, 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 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"
+
+void
+miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds)
+{
+ bounds->x1 = xFixedToInt(points->x);
+ bounds->x2 = xFixedToInt(xFixedCeil(points->x));
+ bounds->y1 = xFixedToInt(points->y);
+ bounds->y2 = xFixedToInt(xFixedCeil(points->y));
+ points++;
+ npoint--;
+ while (npoint-- > 0) {
+ INT16 x1 = xFixedToInt(points->x);
+ INT16 x2 = xFixedToInt(xFixedCeil(points->x));
+ INT16 y1 = xFixedToInt(points->y);
+ INT16 y2 = xFixedToInt(xFixedCeil(points->y));
+
+ if (x1 < bounds->x1)
+ bounds->x1 = x1;
+ else if (x2 > bounds->x2)
+ bounds->x2 = x2;
+ if (y1 < bounds->y1)
+ bounds->y1 = y1;
+ else if (y2 > bounds->y2)
+ bounds->y2 = y2;
+ points++;
+ }
+}
+
+void
+miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
+{
+ miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
+}
diff --git a/xorg-server/render/picture.c b/xorg-server/render/picture.c
index f13459665..2fd13fc37 100644
--- a/xorg-server/render/picture.c
+++ b/xorg-server/render/picture.c
@@ -44,26 +44,25 @@
DevPrivateKeyRec PictureScreenPrivateKeyRec;
DevPrivateKeyRec PictureWindowPrivateKeyRec;
-static int PictureGeneration;
-RESTYPE PictureType;
-RESTYPE PictFormatType;
-RESTYPE GlyphSetType;
-int PictureCmapPolicy = PictureCmapPolicyDefault;
+static int PictureGeneration;
+RESTYPE PictureType;
+RESTYPE PictFormatType;
+RESTYPE GlyphSetType;
+int PictureCmapPolicy = PictureCmapPolicyDefault;
Bool
-PictureDestroyWindow (WindowPtr pWindow)
+PictureDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- PicturePtr pPicture;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- Bool ret;
-
- while ((pPicture = GetPictureWindow(pWindow)))
- {
- SetPictureWindow(pWindow, pPicture->pNext);
- if (pPicture->id)
- FreeResource (pPicture->id, PictureType);
- FreePicture ((pointer) pPicture, pPicture->id);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ PicturePtr pPicture;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ Bool ret;
+
+ while ((pPicture = GetPictureWindow(pWindow))) {
+ SetPictureWindow(pWindow, pPicture->pNext);
+ if (pPicture->id)
+ FreeResource(pPicture->id, PictureType);
+ FreePicture((pointer) pPicture, pPicture->id);
}
pScreen->DestroyWindow = ps->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWindow);
@@ -73,19 +72,19 @@ PictureDestroyWindow (WindowPtr pWindow)
}
Bool
-PictureCloseScreen (int index, ScreenPtr pScreen)
+PictureCloseScreen(int index, ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- Bool ret;
- int n;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ Bool ret;
+ int n;
pScreen->CloseScreen = ps->CloseScreen;
ret = (*pScreen->CloseScreen) (index, pScreen);
- PictureResetFilters (pScreen);
+ PictureResetFilters(pScreen);
for (n = 0; n < ps->nformats; n++)
- if (ps->formats[n].type == PictTypeIndexed)
- (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
- GlyphUninit (pScreen);
+ if (ps->formats[n].type == PictTypeIndexed)
+ (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
+ GlyphUninit(pScreen);
SetPictureScreen(pScreen, 0);
free(ps->formats);
free(ps);
@@ -93,66 +92,59 @@ PictureCloseScreen (int index, ScreenPtr pScreen)
}
void
-PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef)
+PictureStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef)
{
- ScreenPtr pScreen = pColormap->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
+ ScreenPtr pScreen = pColormap->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
pScreen->StoreColors = ps->StoreColors;
(*pScreen->StoreColors) (pColormap, ndef, pdef);
ps->StoreColors = pScreen->StoreColors;
pScreen->StoreColors = PictureStoreColors;
- if (pColormap->class == PseudoColor || pColormap->class == GrayScale)
- {
- PictFormatPtr format = ps->formats;
- int nformats = ps->nformats;
-
- while (nformats--)
- {
- if (format->type == PictTypeIndexed &&
- format->index.pColormap == pColormap)
- {
- (*ps->UpdateIndexed) (pScreen, format, ndef, pdef);
- break;
- }
- format++;
- }
+ if (pColormap->class == PseudoColor || pColormap->class == GrayScale) {
+ PictFormatPtr format = ps->formats;
+ int nformats = ps->nformats;
+
+ while (nformats--) {
+ if (format->type == PictTypeIndexed &&
+ format->index.pColormap == pColormap) {
+ (*ps->UpdateIndexed) (pScreen, format, ndef, pdef);
+ break;
+ }
+ format++;
+ }
}
}
static int
-visualDepth (ScreenPtr pScreen, VisualPtr pVisual)
+visualDepth(ScreenPtr pScreen, VisualPtr pVisual)
{
- int d, v;
- DepthPtr pDepth;
-
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = &pScreen->allowedDepths[d];
- for (v = 0; v < pDepth->numVids; v++)
- if (pDepth->vids[v] == pVisual->vid)
- return pDepth->depth;
+ int d, v;
+ DepthPtr pDepth;
+
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pDepth = &pScreen->allowedDepths[d];
+ for (v = 0; v < pDepth->numVids; v++)
+ if (pDepth->vids[v] == pVisual->vid)
+ return pDepth->depth;
}
return 0;
}
typedef struct _formatInit {
- CARD32 format;
- CARD8 depth;
+ CARD32 format;
+ CARD8 depth;
} FormatInitRec, *FormatInitPtr;
static int
-addFormat (FormatInitRec formats[256],
- int nformat,
- CARD32 format,
- CARD8 depth)
+addFormat(FormatInitRec formats[256], int nformat, CARD32 format, CARD8 depth)
{
- int n;
+ int n;
for (n = 0; n < nformat; n++)
- if (formats[n].format == format && formats[n].depth == depth)
- return nformat;
+ if (formats[n].format == format && formats[n].depth == depth)
+ return nformat;
formats[nformat].format = format;
formats[nformat].depth = depth;
return ++nformat;
@@ -161,20 +153,20 @@ addFormat (FormatInitRec formats[256],
#define Mask(n) ((1 << (n)) - 1)
PictFormatPtr
-PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
+PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
{
- int nformats, f;
- PictFormatPtr pFormats;
- FormatInitRec formats[1024];
- CARD32 format;
- CARD8 depth;
- VisualPtr pVisual;
- int v;
- int bpp;
- int type;
- int r, g, b;
- int d;
- DepthPtr pDepth;
+ int nformats, f;
+ PictFormatPtr pFormats;
+ FormatInitRec formats[1024];
+ CARD32 format;
+ CARD8 depth;
+ VisualPtr pVisual;
+ int v;
+ int bpp;
+ int type;
+ int r, g, b;
+ int d;
+ DepthPtr pDepth;
nformats = 0;
/* formats required by protocol */
@@ -182,13 +174,11 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
formats[nformats].depth = 1;
nformats++;
formats[nformats].format = PICT_FORMAT(BitsPerPixel(8),
- PICT_TYPE_A,
- 8, 0, 0, 0);
+ PICT_TYPE_A, 8, 0, 0, 0);
formats[nformats].depth = 8;
nformats++;
formats[nformats].format = PICT_FORMAT(BitsPerPixel(4),
- PICT_TYPE_A,
- 4, 0, 0, 0);
+ PICT_TYPE_A, 4, 0, 0, 0);
formats[nformats].depth = 4;
nformats++;
formats[nformats].format = PICT_a8r8g8b8;
@@ -205,233 +195,233 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
nformats++;
/* now look through the depths and visuals adding other formats */
- for (v = 0; v < pScreen->numVisuals; v++)
- {
- pVisual = &pScreen->visuals[v];
- depth = visualDepth (pScreen, pVisual);
- if (!depth)
- continue;
- bpp = BitsPerPixel (depth);
- switch (pVisual->class) {
- case DirectColor:
- case TrueColor:
- r = Ones (pVisual->redMask);
- g = Ones (pVisual->greenMask);
- b = Ones (pVisual->blueMask);
- type = PICT_TYPE_OTHER;
- /*
- * Current rendering code supports only three direct formats,
- * fields must be packed together at the bottom of the pixel
- */
- if (pVisual->offsetBlue == 0 &&
- pVisual->offsetGreen == b &&
- pVisual->offsetRed == b + g)
- {
- type = PICT_TYPE_ARGB;
- }
- else if (pVisual->offsetRed == 0 &&
- pVisual->offsetGreen == r &&
- pVisual->offsetBlue == r + g)
- {
- type = PICT_TYPE_ABGR;
- }
- else if (pVisual->offsetRed == pVisual->offsetGreen - r &&
- pVisual->offsetGreen == pVisual->offsetBlue - g &&
- pVisual->offsetBlue == bpp - b)
- {
- type = PICT_TYPE_BGRA;
- }
- if (type != PICT_TYPE_OTHER)
- {
- format = PICT_FORMAT(bpp, type, 0, r, g, b);
- nformats = addFormat (formats, nformats, format, depth);
- }
- break;
- case StaticColor:
- case PseudoColor:
- format = PICT_VISFORMAT (bpp, PICT_TYPE_COLOR, v);
- nformats = addFormat (formats, nformats, format, depth);
- break;
- case StaticGray:
- case GrayScale:
- format = PICT_VISFORMAT (bpp, PICT_TYPE_GRAY, v);
- nformats = addFormat (formats, nformats, format, depth);
- break;
- }
+ for (v = 0; v < pScreen->numVisuals; v++) {
+ pVisual = &pScreen->visuals[v];
+ depth = visualDepth(pScreen, pVisual);
+ if (!depth)
+ continue;
+ bpp = BitsPerPixel(depth);
+ switch (pVisual->class) {
+ case DirectColor:
+ case TrueColor:
+ r = Ones(pVisual->redMask);
+ g = Ones(pVisual->greenMask);
+ b = Ones(pVisual->blueMask);
+ type = PICT_TYPE_OTHER;
+ /*
+ * Current rendering code supports only three direct formats,
+ * fields must be packed together at the bottom of the pixel
+ */
+ if (pVisual->offsetBlue == 0 &&
+ pVisual->offsetGreen == b && pVisual->offsetRed == b + g) {
+ type = PICT_TYPE_ARGB;
+ }
+ else if (pVisual->offsetRed == 0 &&
+ pVisual->offsetGreen == r &&
+ pVisual->offsetBlue == r + g) {
+ type = PICT_TYPE_ABGR;
+ }
+ else if (pVisual->offsetRed == pVisual->offsetGreen - r &&
+ pVisual->offsetGreen == pVisual->offsetBlue - g &&
+ pVisual->offsetBlue == bpp - b) {
+ type = PICT_TYPE_BGRA;
+ }
+ if (type != PICT_TYPE_OTHER) {
+ format = PICT_FORMAT(bpp, type, 0, r, g, b);
+ nformats = addFormat(formats, nformats, format, depth);
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ format = PICT_VISFORMAT(bpp, PICT_TYPE_COLOR, v);
+ nformats = addFormat(formats, nformats, format, depth);
+ break;
+ case StaticGray:
+ case GrayScale:
+ format = PICT_VISFORMAT(bpp, PICT_TYPE_GRAY, v);
+ nformats = addFormat(formats, nformats, format, depth);
+ break;
+ }
}
/*
* Walk supported depths and add useful Direct formats
*/
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = &pScreen->allowedDepths[d];
- bpp = BitsPerPixel (pDepth->depth);
- format = 0;
- switch (bpp) {
- case 16:
- /* depth 12 formats */
- if (pDepth->depth >= 12)
- {
- nformats = addFormat (formats, nformats,
- PICT_x4r4g4b4, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x4b4g4r4, pDepth->depth);
- }
- /* depth 15 formats */
- if (pDepth->depth >= 15)
- {
- nformats = addFormat (formats, nformats,
- PICT_x1r5g5b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x1b5g5r5, pDepth->depth);
- }
- /* depth 16 formats */
- if (pDepth->depth >= 16)
- {
- nformats = addFormat (formats, nformats,
- PICT_a1r5g5b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a1b5g5r5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_r5g6b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_b5g6r5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a4r4g4b4, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a4b4g4r4, pDepth->depth);
- }
- break;
- case 24:
- if (pDepth->depth >= 24)
- {
- nformats = addFormat (formats, nformats,
- PICT_r8g8b8, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_b8g8r8, pDepth->depth);
- }
- break;
- case 32:
- if (pDepth->depth >= 24)
- {
- nformats = addFormat (formats, nformats,
- PICT_x8r8g8b8, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x8b8g8r8, pDepth->depth);
- }
- if (pDepth->depth >= 30)
- {
- nformats = addFormat (formats, nformats,
- PICT_a2r10g10b10, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x2r10g10b10, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a2b10g10r10, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x2b10g10r10, pDepth->depth);
- }
- break;
- }
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pDepth = &pScreen->allowedDepths[d];
+ bpp = BitsPerPixel(pDepth->depth);
+ format = 0;
+ switch (bpp) {
+ case 16:
+ /* depth 12 formats */
+ if (pDepth->depth >= 12) {
+ nformats = addFormat(formats, nformats,
+ PICT_x4r4g4b4, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x4b4g4r4, pDepth->depth);
+ }
+ /* depth 15 formats */
+ if (pDepth->depth >= 15) {
+ nformats = addFormat(formats, nformats,
+ PICT_x1r5g5b5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x1b5g5r5, pDepth->depth);
+ }
+ /* depth 16 formats */
+ if (pDepth->depth >= 16) {
+ nformats = addFormat(formats, nformats,
+ PICT_a1r5g5b5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a1b5g5r5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_r5g6b5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_b5g6r5, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a4r4g4b4, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a4b4g4r4, pDepth->depth);
+ }
+ break;
+ case 24:
+ if (pDepth->depth >= 24) {
+ nformats = addFormat(formats, nformats,
+ PICT_r8g8b8, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_b8g8r8, pDepth->depth);
+ }
+ break;
+ case 32:
+ if (pDepth->depth >= 24) {
+ nformats = addFormat(formats, nformats,
+ PICT_x8r8g8b8, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x8b8g8r8, pDepth->depth);
+ }
+ if (pDepth->depth >= 30) {
+ nformats = addFormat(formats, nformats,
+ PICT_a2r10g10b10, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x2r10g10b10, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_a2b10g10r10, pDepth->depth);
+ nformats = addFormat(formats, nformats,
+ PICT_x2b10g10r10, pDepth->depth);
+ }
+ break;
+ }
}
-
- pFormats = calloc(nformats, sizeof (PictFormatRec));
+ pFormats = calloc(nformats, sizeof(PictFormatRec));
if (!pFormats)
- return 0;
- for (f = 0; f < nformats; f++)
- {
- pFormats[f].id = FakeClientID (0);
- pFormats[f].depth = formats[f].depth;
- format = formats[f].format;
- pFormats[f].format = format;
- switch (PICT_FORMAT_TYPE(format)) {
- case PICT_TYPE_ARGB:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_R(format) +
- PICT_FORMAT_G(format) +
- PICT_FORMAT_B(format));
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = (PICT_FORMAT_G(format) +
- PICT_FORMAT_B(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = PICT_FORMAT_B(format);
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = 0;
- break;
-
- case PICT_TYPE_ABGR:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- if (pFormats[f].direct.alphaMask)
- pFormats[f].direct.alpha = (PICT_FORMAT_B(format) +
- PICT_FORMAT_G(format) +
- PICT_FORMAT_R(format));
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = (PICT_FORMAT_G(format) +
- PICT_FORMAT_R(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = PICT_FORMAT_R(format);
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = 0;
- break;
-
- case PICT_TYPE_BGRA:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
- pFormats[f].direct.blue = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format));
-
- pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
- pFormats[f].direct.green = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
- PICT_FORMAT_G(format));
-
- pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
- pFormats[f].direct.red = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
- PICT_FORMAT_G(format) - PICT_FORMAT_R(format));
-
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
- pFormats[f].direct.alpha = 0;
- break;
-
- case PICT_TYPE_A:
- pFormats[f].type = PictTypeDirect;
-
- pFormats[f].direct.alpha = 0;
- pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
-
- /* remaining fields already set to zero */
- break;
-
- case PICT_TYPE_COLOR:
- case PICT_TYPE_GRAY:
- pFormats[f].type = PictTypeIndexed;
- pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid;
- break;
- }
+ return 0;
+ for (f = 0; f < nformats; f++) {
+ pFormats[f].id = FakeClientID(0);
+ pFormats[f].depth = formats[f].depth;
+ format = formats[f].format;
+ pFormats[f].format = format;
+ switch (PICT_FORMAT_TYPE(format)) {
+ case PICT_TYPE_ARGB:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ if (pFormats[f].direct.alphaMask)
+ pFormats[f].direct.alpha = (PICT_FORMAT_R(format) +
+ PICT_FORMAT_G(format) +
+ PICT_FORMAT_B(format));
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format));
+
+ pFormats[f].direct.red = (PICT_FORMAT_G(format) +
+ PICT_FORMAT_B(format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format));
+
+ pFormats[f].direct.green = PICT_FORMAT_B(format);
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format));
+
+ pFormats[f].direct.blue = 0;
+ break;
+
+ case PICT_TYPE_ABGR:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ if (pFormats[f].direct.alphaMask)
+ pFormats[f].direct.alpha = (PICT_FORMAT_B(format) +
+ PICT_FORMAT_G(format) +
+ PICT_FORMAT_R(format));
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format));
+
+ pFormats[f].direct.blue = (PICT_FORMAT_G(format) +
+ PICT_FORMAT_R(format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format));
+
+ pFormats[f].direct.green = PICT_FORMAT_R(format);
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format));
+
+ pFormats[f].direct.red = 0;
+ break;
+
+ case PICT_TYPE_BGRA:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B(format));
+
+ pFormats[f].direct.blue =
+ (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G(format));
+
+ pFormats[f].direct.green =
+ (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
+ PICT_FORMAT_G(format));
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R(format));
+
+ pFormats[f].direct.red =
+ (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
+ PICT_FORMAT_G(format) - PICT_FORMAT_R(format));
+
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ pFormats[f].direct.alpha = 0;
+ break;
+
+ case PICT_TYPE_A:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.alpha = 0;
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A(format));
+
+ /* remaining fields already set to zero */
+ break;
+
+ case PICT_TYPE_COLOR:
+ case PICT_TYPE_GRAY:
+ pFormats[f].type = PictTypeIndexed;
+ pFormats[f].index.vid =
+ pScreen->visuals[PICT_FORMAT_VIS(format)].vid;
+ break;
+ }
}
*nformatp = nformats;
return pFormats;
}
static VisualPtr
-PictureFindVisual (ScreenPtr pScreen, VisualID visual)
+PictureFindVisual(ScreenPtr pScreen, VisualID visual)
{
- int i;
- VisualPtr pVisual;
+ int i;
+ VisualPtr pVisual;
+
for (i = 0, pVisual = pScreen->visuals;
- i < pScreen->numVisuals;
- i++, pVisual++)
- {
+ i < pScreen->numVisuals; i++, pVisual++) {
if (pVisual->vid == visual)
return pVisual;
}
@@ -444,88 +434,89 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (format->type != PictTypeIndexed || format->index.pColormap)
- return TRUE;
+ return TRUE;
if (format->index.vid == pScreen->rootVisual) {
- dixLookupResourceByType((pointer *)&format->index.pColormap,
- pScreen->defColormap, RT_COLORMAP,
- serverClient, DixGetAttrAccess);
- } else {
- VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
- if (CreateColormap(FakeClientID (0), pScreen, pVisual,
- &format->index.pColormap, AllocNone, 0)
- != Success)
- return FALSE;
+ dixLookupResourceByType((pointer *) &format->index.pColormap,
+ pScreen->defColormap, RT_COLORMAP,
+ serverClient, DixGetAttrAccess);
+ }
+ else {
+ VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
+
+ if (CreateColormap(FakeClientID(0), pScreen, pVisual,
+ &format->index.pColormap, AllocNone, 0)
+ != Success)
+ return FALSE;
}
if (!ps->InitIndexed(pScreen, format))
- return FALSE;
+ return FALSE;
return TRUE;
}
static Bool
-PictureInitIndexedFormats (ScreenPtr pScreen)
+PictureInitIndexedFormats(ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictFormatPtr format;
+ int nformat;
if (!ps)
- return FALSE;
+ return FALSE;
format = ps->formats;
nformat = ps->nformats;
while (nformat--)
- if (!PictureInitIndexedFormat(pScreen, format++))
- return FALSE;
+ if (!PictureInitIndexedFormat(pScreen, format++))
+ return FALSE;
return TRUE;
}
Bool
-PictureFinishInit (void)
+PictureFinishInit(void)
{
- int s;
+ int s;
- for (s = 0; s < screenInfo.numScreens; s++)
- {
- if (!PictureInitIndexedFormats (screenInfo.screens[s]))
- return FALSE;
- (void) AnimCurInit (screenInfo.screens[s]);
+ for (s = 0; s < screenInfo.numScreens; s++) {
+ if (!PictureInitIndexedFormats(screenInfo.screens[s]))
+ return FALSE;
+ (void) AnimCurInit(screenInfo.screens[s]);
}
return TRUE;
}
Bool
-PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
+PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (!ps)
- return FALSE;
+ return FALSE;
ps->subpixel = subpixel;
return TRUE;
-
+
}
int
-PictureGetSubpixelOrder (ScreenPtr pScreen)
+PictureGetSubpixelOrder(ScreenPtr pScreen)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (!ps)
- return SubPixelUnknown;
+ return SubPixelUnknown;
return ps->subpixel;
}
-
+
PictFormatPtr
-PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
+PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
- int type;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictFormatPtr format;
+ int nformat;
+ int type;
if (!ps)
- return 0;
+ return 0;
format = ps->formats;
nformat = ps->nformats;
switch (pVisual->class) {
@@ -533,158 +524,146 @@ PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
case GrayScale:
case StaticColor:
case PseudoColor:
- type = PictTypeIndexed;
- break;
+ type = PictTypeIndexed;
+ break;
case TrueColor:
case DirectColor:
- type = PictTypeDirect;
- break;
+ type = PictTypeDirect;
+ break;
default:
- return 0;
+ return 0;
}
- while (nformat--)
- {
- if (format->depth == depth && format->type == type)
- {
- if (type == PictTypeIndexed)
- {
- if (format->index.vid == pVisual->vid)
- return format;
- }
- else
- {
- if (format->direct.redMask << format->direct.red ==
- pVisual->redMask &&
- format->direct.greenMask << format->direct.green ==
- pVisual->greenMask &&
- format->direct.blueMask << format->direct.blue ==
- pVisual->blueMask)
- {
- return format;
- }
- }
- }
- format++;
+ while (nformat--) {
+ if (format->depth == depth && format->type == type) {
+ if (type == PictTypeIndexed) {
+ if (format->index.vid == pVisual->vid)
+ return format;
+ }
+ else {
+ if (format->direct.redMask << format->direct.red ==
+ pVisual->redMask &&
+ format->direct.greenMask << format->direct.green ==
+ pVisual->greenMask &&
+ format->direct.blueMask << format->direct.blue ==
+ pVisual->blueMask) {
+ return format;
+ }
+ }
+ }
+ format++;
}
return 0;
}
PictFormatPtr
-PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 f)
+PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 f)
{
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
- PictFormatPtr format;
- int nformat;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+ PictFormatPtr format;
+ int nformat;
if (!ps)
- return 0;
+ return 0;
format = ps->formats;
nformat = ps->nformats;
- while (nformat--)
- {
- if (format->depth == depth && format->format == (f & 0xffffff))
- return format;
- format++;
+ while (nformat--) {
+ if (format->depth == depth && format->format == (f & 0xffffff))
+ return format;
+ format++;
}
return 0;
}
int
-PictureParseCmapPolicy (const char *name)
+PictureParseCmapPolicy(const char *name)
{
- if ( strcmp (name, "default" ) == 0)
- return PictureCmapPolicyDefault;
- else if ( strcmp (name, "mono" ) == 0)
- return PictureCmapPolicyMono;
- else if ( strcmp (name, "gray" ) == 0)
- return PictureCmapPolicyGray;
- else if ( strcmp (name, "color" ) == 0)
- return PictureCmapPolicyColor;
- else if ( strcmp (name, "all" ) == 0)
- return PictureCmapPolicyAll;
+ if (strcmp(name, "default") == 0)
+ return PictureCmapPolicyDefault;
+ else if (strcmp(name, "mono") == 0)
+ return PictureCmapPolicyMono;
+ else if (strcmp(name, "gray") == 0)
+ return PictureCmapPolicyGray;
+ else if (strcmp(name, "color") == 0)
+ return PictureCmapPolicyColor;
+ else if (strcmp(name, "all") == 0)
+ return PictureCmapPolicyAll;
else
- return PictureCmapPolicyInvalid;
+ return PictureCmapPolicyInvalid;
}
Bool
-PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
- PictureScreenPtr ps;
- int n;
- CARD32 type, a, r, g, b;
-
- if (PictureGeneration != serverGeneration)
- {
- PictureType = CreateNewResourceType (FreePicture, "PICTURE");
- if (!PictureType)
- return FALSE;
- PictFormatType = CreateNewResourceType (FreePictFormat, "PICTFORMAT");
- if (!PictFormatType)
- return FALSE;
- GlyphSetType = CreateNewResourceType (FreeGlyphSet, "GLYPHSET");
- if (!GlyphSetType)
- return FALSE;
- PictureGeneration = serverGeneration;
+ PictureScreenPtr ps;
+ int n;
+ CARD32 type, a, r, g, b;
+
+ if (PictureGeneration != serverGeneration) {
+ PictureType = CreateNewResourceType(FreePicture, "PICTURE");
+ if (!PictureType)
+ return FALSE;
+ PictFormatType = CreateNewResourceType(FreePictFormat, "PICTFORMAT");
+ if (!PictFormatType)
+ return FALSE;
+ GlyphSetType = CreateNewResourceType(FreeGlyphSet, "GLYPHSET");
+ if (!GlyphSetType)
+ return FALSE;
+ PictureGeneration = serverGeneration;
}
if (!dixRegisterPrivateKey(&PictureScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
+ return FALSE;
if (!dixRegisterPrivateKey(&PictureWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
- return FALSE;
+ return FALSE;
- if (!formats)
- {
- formats = PictureCreateDefaultFormats (pScreen, &nformats);
- if (!formats)
- return FALSE;
+ if (!formats) {
+ formats = PictureCreateDefaultFormats(pScreen, &nformats);
+ if (!formats)
+ return FALSE;
}
- for (n = 0; n < nformats; n++)
- {
- if (!AddResource (formats[n].id, PictFormatType, (pointer) (formats+n)))
- {
- free(formats);
- return FALSE;
- }
- if (formats[n].type == PictTypeIndexed)
- {
- VisualPtr pVisual = PictureFindVisual (pScreen, formats[n].index.vid);
- if ((pVisual->class | DynamicClass) == PseudoColor)
- type = PICT_TYPE_COLOR;
- else
- type = PICT_TYPE_GRAY;
- a = r = g = b = 0;
- }
- else
- {
- if ((formats[n].direct.redMask|
- formats[n].direct.blueMask|
- formats[n].direct.greenMask) == 0)
- type = PICT_TYPE_A;
- else if (formats[n].direct.red > formats[n].direct.blue)
- type = PICT_TYPE_ARGB;
- else if (formats[n].direct.red == 0)
- type = PICT_TYPE_ABGR;
- else
- type = PICT_TYPE_BGRA;
- a = Ones (formats[n].direct.alphaMask);
- r = Ones (formats[n].direct.redMask);
- g = Ones (formats[n].direct.greenMask);
- b = Ones (formats[n].direct.blueMask);
- }
- formats[n].format = PICT_FORMAT(0,type,a,r,g,b);
+ for (n = 0; n < nformats; n++) {
+ if (!AddResource
+ (formats[n].id, PictFormatType, (pointer) (formats + n))) {
+ free(formats);
+ return FALSE;
+ }
+ if (formats[n].type == PictTypeIndexed) {
+ VisualPtr pVisual =
+ PictureFindVisual(pScreen, formats[n].index.vid);
+ if ((pVisual->class | DynamicClass) == PseudoColor)
+ type = PICT_TYPE_COLOR;
+ else
+ type = PICT_TYPE_GRAY;
+ a = r = g = b = 0;
+ }
+ else {
+ if ((formats[n].direct.redMask |
+ formats[n].direct.blueMask | formats[n].direct.greenMask) == 0)
+ type = PICT_TYPE_A;
+ else if (formats[n].direct.red > formats[n].direct.blue)
+ type = PICT_TYPE_ARGB;
+ else if (formats[n].direct.red == 0)
+ type = PICT_TYPE_ABGR;
+ else
+ type = PICT_TYPE_BGRA;
+ a = Ones(formats[n].direct.alphaMask);
+ r = Ones(formats[n].direct.redMask);
+ g = Ones(formats[n].direct.greenMask);
+ b = Ones(formats[n].direct.blueMask);
+ }
+ formats[n].format = PICT_FORMAT(0, type, a, r, g, b);
}
- ps = (PictureScreenPtr) malloc(sizeof (PictureScreenRec));
- if (!ps)
- {
- free(formats);
- return FALSE;
+ ps = (PictureScreenPtr) malloc(sizeof(PictureScreenRec));
+ if (!ps) {
+ free(formats);
+ return FALSE;
}
SetPictureScreen(pScreen, ps);
ps->formats = formats;
ps->fallback = formats;
ps->nformats = nformats;
-
+
ps->filters = 0;
ps->nfilters = 0;
ps->filterAliases = 0;
@@ -699,20 +678,19 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
pScreen->CloseScreen = PictureCloseScreen;
pScreen->StoreColors = PictureStoreColors;
- if (!PictureSetDefaultFilters (pScreen))
- {
- PictureResetFilters (pScreen);
- SetPictureScreen(pScreen, 0);
- free(formats);
- free(ps);
- return FALSE;
+ if (!PictureSetDefaultFilters(pScreen)) {
+ PictureResetFilters(pScreen);
+ SetPictureScreen(pScreen, 0);
+ free(formats);
+ free(ps);
+ return FALSE;
}
return TRUE;
}
void
-SetPictureToDefaults (PicturePtr pPicture)
+SetPictureToDefaults(PicturePtr pPicture)
{
pPicture->refcnt = 1;
pPicture->repeat = 0;
@@ -735,7 +713,7 @@ SetPictureToDefaults (PicturePtr pPicture)
pPicture->transform = 0;
- pPicture->filter = PictureGetFilterId (FilterNearest, -1, TRUE);
+ pPicture->filter = PictureGetFilterId(FilterNearest, -1, TRUE);
pPicture->filter_params = 0;
pPicture->filter_nparams = 0;
@@ -745,22 +723,18 @@ SetPictureToDefaults (PicturePtr pPicture)
}
PicturePtr
-CreatePicture (Picture pid,
- DrawablePtr pDrawable,
- PictFormatPtr pFormat,
- Mask vmask,
- XID *vlist,
- ClientPtr client,
- int *error)
+CreatePicture(Picture pid,
+ DrawablePtr pDrawable,
+ PictFormatPtr pFormat,
+ Mask vmask, XID *vlist, ClientPtr client, int *error)
{
- PicturePtr pPicture;
- PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen);
+ PicturePtr pPicture;
+ PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen);
pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE);
- if (!pPicture)
- {
- *error = BadAlloc;
- return 0;
+ if (!pPicture) {
+ *error = BadAlloc;
+ return 0;
}
pPicture->id = pid;
@@ -770,49 +744,46 @@ CreatePicture (Picture pid,
/* security creation/labeling check */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,
- RT_PIXMAP, pDrawable, DixCreateAccess|DixSetAttrAccess);
+ RT_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess);
if (*error != Success)
- goto out;
+ goto out;
- if (pDrawable->type == DRAWABLE_PIXMAP)
- {
- ++((PixmapPtr)pDrawable)->refcnt;
- pPicture->pNext = 0;
+ if (pDrawable->type == DRAWABLE_PIXMAP) {
+ ++((PixmapPtr) pDrawable)->refcnt;
+ pPicture->pNext = 0;
}
- else
- {
- pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable));
- SetPictureWindow(((WindowPtr) pDrawable), pPicture);
+ else {
+ pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable));
+ SetPictureWindow(((WindowPtr) pDrawable), pPicture);
}
- SetPictureToDefaults (pPicture);
-
+ SetPictureToDefaults(pPicture);
+
if (vmask)
- *error = ChangePicture (pPicture, vmask, vlist, 0, client);
+ *error = ChangePicture(pPicture, vmask, vlist, 0, client);
else
- *error = Success;
+ *error = Success;
if (*error == Success)
- *error = (*ps->CreatePicture) (pPicture);
-out:
- if (*error != Success)
- {
- FreePicture (pPicture, (XID) 0);
- pPicture = 0;
+ *error = (*ps->CreatePicture) (pPicture);
+ out:
+ if (*error != Success) {
+ FreePicture(pPicture, (XID) 0);
+ pPicture = 0;
}
return pPicture;
}
-static CARD32 xRenderColorToCard32(xRenderColor c)
+static CARD32
+xRenderColorToCard32(xRenderColor c)
{
return
(c.alpha >> 8 << 24) |
- (c.red >> 8 << 16) |
- (c.green & 0xff00) |
- (c.blue >> 8);
+ (c.red >> 8 << 16) | (c.green & 0xff00) | (c.blue >> 8);
}
-static void initGradient(SourcePictPtr pGradient, int stopCount,
- xFixed *stopPoints, xRenderColor *stopColors, int *error)
+static void
+initGradient(SourcePictPtr pGradient, int stopCount,
+ xFixed * stopPoints, xRenderColor * stopColors, int *error)
{
int i;
xFixed dpos;
@@ -824,14 +795,14 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
dpos = -1;
for (i = 0; i < stopCount; ++i) {
- if (stopPoints[i] < dpos || stopPoints[i] > (1<<16)) {
+ if (stopPoints[i] < dpos || stopPoints[i] > (1 << 16)) {
*error = BadValue;
return;
}
dpos = stopPoints[i];
}
- pGradient->gradient.stops = malloc(stopCount*sizeof(PictGradientStop));
+ pGradient->gradient.stops = malloc(stopCount * sizeof(PictGradientStop));
if (!pGradient->gradient.stops) {
*error = BadAlloc;
return;
@@ -845,9 +816,11 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
}
}
-static PicturePtr createSourcePicture(void)
+static PicturePtr
+createSourcePicture(void)
{
PicturePtr pPicture;
+
pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE);
pPicture->pDrawable = 0;
pPicture->pFormat = 0;
@@ -859,9 +832,10 @@ static PicturePtr createSourcePicture(void)
}
PicturePtr
-CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
+CreateSolidPicture(Picture pid, xRenderColor * color, int *error)
{
PicturePtr pPicture;
+
pPicture = createSourcePicture();
if (!pPicture) {
*error = BadAlloc;
@@ -881,8 +855,9 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
}
PicturePtr
-CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
- int nStops, xFixed *stops, xRenderColor *colors, int *error)
+CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2,
+ int nStops, xFixed * stops, xRenderColor * colors,
+ int *error)
{
PicturePtr pPicture;
@@ -918,9 +893,10 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
}
PicturePtr
-CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer,
- xFixed innerRadius, xFixed outerRadius,
- int nStops, xFixed *stops, xRenderColor *colors, int *error)
+CreateRadialGradientPicture(Picture pid, xPointFixed * inner,
+ xPointFixed * outer, xFixed innerRadius,
+ xFixed outerRadius, int nStops, xFixed * stops,
+ xRenderColor * colors, int *error)
{
PicturePtr pPicture;
PictRadialGradient *radial;
@@ -952,7 +928,7 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
radial->c2.x = outer->x;
radial->c2.y = outer->y;
radial->c2.radius = outerRadius;
-
+
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
free(pPicture);
@@ -962,8 +938,9 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
}
PicturePtr
-CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle,
- int nStops, xFixed *stops, xRenderColor *colors, int *error)
+CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
+ int nStops, xFixed * stops, xRenderColor * colors,
+ int *error)
{
PicturePtr pPicture;
@@ -1003,226 +980,214 @@ CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle,
#define NEXT_PTR(_type) ((_type) ulist++->ptr)
int
-ChangePicture (PicturePtr pPicture,
- Mask vmask,
- XID *vlist,
- DevUnion *ulist,
- ClientPtr client)
+ChangePicture(PicturePtr pPicture,
+ Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client)
{
ScreenPtr pScreen = pPicture->pDrawable ? pPicture->pDrawable->pScreen : 0;
PictureScreenPtr ps = pScreen ? GetPictureScreen(pScreen) : 0;
- BITS32 index2;
- int error = 0;
- BITS32 maskQ;
-
+ BITS32 index2;
+ int error = 0;
+ BITS32 maskQ;
+
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
maskQ = vmask;
- while (vmask && !error)
- {
- index2 = (BITS32) lowbit (vmask);
- vmask &= ~index2;
- pPicture->stateChanges |= index2;
- switch (index2)
- {
- case CPRepeat:
- {
- unsigned int newr;
- newr = NEXT_VAL(unsigned int);
- if (newr <= RepeatReflect)
- {
- pPicture->repeat = (newr != RepeatNone);
- pPicture->repeatType = newr;
- }
- else
- {
- client->errorValue = newr;
- error = BadValue;
- }
- }
- break;
- case CPAlphaMap:
- {
- PicturePtr pAlpha;
-
- if (vlist)
- {
- Picture pid = NEXT_VAL(Picture);
-
- if (pid == None)
- pAlpha = 0;
- else
- {
- error = dixLookupResourceByType((pointer *)&pAlpha, pid,
- PictureType, client,
- DixReadAccess);
- if (error != Success)
- {
- client->errorValue = pid;
- break;
- }
- if (pAlpha->pDrawable == NULL ||
- pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
- {
- client->errorValue = pid;
- error = BadMatch;
- break;
- }
- }
- }
- else
- pAlpha = NEXT_PTR(PicturePtr);
- if (!error)
- {
- if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP)
- pAlpha->refcnt++;
- if (pPicture->alphaMap)
- FreePicture ((pointer) pPicture->alphaMap, (XID) 0);
- pPicture->alphaMap = pAlpha;
- }
- }
- break;
- case CPAlphaXOrigin:
- pPicture->alphaOrigin.x = NEXT_VAL(INT16);
- break;
- case CPAlphaYOrigin:
- pPicture->alphaOrigin.y = NEXT_VAL(INT16);
- break;
- case CPClipXOrigin:
- pPicture->clipOrigin.x = NEXT_VAL(INT16);
- break;
- case CPClipYOrigin:
- pPicture->clipOrigin.y = NEXT_VAL(INT16);
- break;
- case CPClipMask:
- {
- Pixmap pid;
- PixmapPtr pPixmap;
- int clipType;
- if (!pScreen)
- return BadDrawable;
-
- if (vlist)
- {
- pid = NEXT_VAL(Pixmap);
- if (pid == None)
- {
- clipType = CT_NONE;
- pPixmap = NullPixmap;
- }
- else
- {
- clipType = CT_PIXMAP;
- error = dixLookupResourceByType((pointer *)&pPixmap, pid,
- RT_PIXMAP, client,
- DixReadAccess);
- if (error != Success)
- {
- client->errorValue = pid;
- break;
- }
- }
- }
- else
- {
- pPixmap = NEXT_PTR(PixmapPtr);
- if (pPixmap)
- clipType = CT_PIXMAP;
- else
- clipType = CT_NONE;
- }
-
- if (pPixmap)
- {
- if ((pPixmap->drawable.depth != 1) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- error = BadMatch;
- break;
- }
- else
- {
- clipType = CT_PIXMAP;
- pPixmap->refcnt++;
- }
- }
- error = (*ps->ChangePictureClip)(pPicture, clipType,
- (pointer)pPixmap, 0);
- break;
- }
- case CPGraphicsExposure:
- {
- unsigned int newe;
- newe = NEXT_VAL(unsigned int);
- if (newe <= xTrue)
- pPicture->graphicsExposures = newe;
- else
- {
- client->errorValue = newe;
- error = BadValue;
- }
- }
- break;
- case CPSubwindowMode:
- {
- unsigned int news;
- news = NEXT_VAL(unsigned int);
- if (news == ClipByChildren || news == IncludeInferiors)
- pPicture->subWindowMode = news;
- else
- {
- client->errorValue = news;
- error = BadValue;
- }
- }
- break;
- case CPPolyEdge:
- {
- unsigned int newe;
- newe = NEXT_VAL(unsigned int);
- if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth)
- pPicture->polyEdge = newe;
- else
- {
- client->errorValue = newe;
- error = BadValue;
- }
- }
- break;
- case CPPolyMode:
- {
- unsigned int newm;
- newm = NEXT_VAL(unsigned int);
- if (newm == PolyModePrecise || newm == PolyModeImprecise)
- pPicture->polyMode = newm;
- else
- {
- client->errorValue = newm;
- error = BadValue;
- }
- }
- break;
- case CPDither:
- (void) NEXT_VAL(Atom); /* unimplemented */
- break;
- case CPComponentAlpha:
- {
- unsigned int newca;
-
- newca = NEXT_VAL (unsigned int);
- if (newca <= xTrue)
- pPicture->componentAlpha = newca;
- else
- {
- client->errorValue = newca;
- error = BadValue;
- }
- }
- break;
- default:
- client->errorValue = maskQ;
- error = BadValue;
- break;
- }
+ while (vmask && !error) {
+ index2 = (BITS32) lowbit(vmask);
+ vmask &= ~index2;
+ pPicture->stateChanges |= index2;
+ switch (index2) {
+ case CPRepeat:
+ {
+ unsigned int newr;
+ newr = NEXT_VAL(unsigned int);
+
+ if (newr <= RepeatReflect) {
+ pPicture->repeat = (newr != RepeatNone);
+ pPicture->repeatType = newr;
+ }
+ else {
+ client->errorValue = newr;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPAlphaMap:
+ {
+ PicturePtr pAlpha;
+
+ if (vlist) {
+ Picture pid = NEXT_VAL(Picture);
+
+ if (pid == None)
+ pAlpha = 0;
+ else {
+ error = dixLookupResourceByType((pointer *) &pAlpha, pid,
+ PictureType, client,
+ DixReadAccess);
+ if (error != Success) {
+ client->errorValue = pid;
+ break;
+ }
+ if (pAlpha->pDrawable == NULL ||
+ pAlpha->pDrawable->type != DRAWABLE_PIXMAP) {
+ client->errorValue = pid;
+ error = BadMatch;
+ break;
+ }
+ }
+ }
+ else
+ pAlpha = NEXT_PTR(PicturePtr);
+ if (!error) {
+ if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP)
+ pAlpha->refcnt++;
+ if (pPicture->alphaMap)
+ FreePicture((pointer) pPicture->alphaMap, (XID) 0);
+ pPicture->alphaMap = pAlpha;
+ }
+ }
+ break;
+ case CPAlphaXOrigin:
+ pPicture->alphaOrigin.x = NEXT_VAL(INT16);
+
+ break;
+ case CPAlphaYOrigin:
+ pPicture->alphaOrigin.y = NEXT_VAL(INT16);
+
+ break;
+ case CPClipXOrigin:
+ pPicture->clipOrigin.x = NEXT_VAL(INT16);
+
+ break;
+ case CPClipYOrigin:
+ pPicture->clipOrigin.y = NEXT_VAL(INT16);
+
+ break;
+ case CPClipMask:
+ {
+ Pixmap pid;
+ PixmapPtr pPixmap;
+ int clipType;
+
+ if (!pScreen)
+ return BadDrawable;
+
+ if (vlist) {
+ pid = NEXT_VAL(Pixmap);
+ if (pid == None) {
+ clipType = CT_NONE;
+ pPixmap = NullPixmap;
+ }
+ else {
+ clipType = CT_PIXMAP;
+ error = dixLookupResourceByType((pointer *) &pPixmap, pid,
+ RT_PIXMAP, client,
+ DixReadAccess);
+ if (error != Success) {
+ client->errorValue = pid;
+ break;
+ }
+ }
+ }
+ else {
+ pPixmap = NEXT_PTR(PixmapPtr);
+
+ if (pPixmap)
+ clipType = CT_PIXMAP;
+ else
+ clipType = CT_NONE;
+ }
+
+ if (pPixmap) {
+ if ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pScreen)) {
+ error = BadMatch;
+ break;
+ }
+ else {
+ clipType = CT_PIXMAP;
+ pPixmap->refcnt++;
+ }
+ }
+ error = (*ps->ChangePictureClip) (pPicture, clipType,
+ (pointer) pPixmap, 0);
+ break;
+ }
+ case CPGraphicsExposure:
+ {
+ unsigned int newe;
+ newe = NEXT_VAL(unsigned int);
+
+ if (newe <= xTrue)
+ pPicture->graphicsExposures = newe;
+ else {
+ client->errorValue = newe;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPSubwindowMode:
+ {
+ unsigned int news;
+ news = NEXT_VAL(unsigned int);
+
+ if (news == ClipByChildren || news == IncludeInferiors)
+ pPicture->subWindowMode = news;
+ else {
+ client->errorValue = news;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPPolyEdge:
+ {
+ unsigned int newe;
+ newe = NEXT_VAL(unsigned int);
+
+ if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth)
+ pPicture->polyEdge = newe;
+ else {
+ client->errorValue = newe;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPPolyMode:
+ {
+ unsigned int newm;
+ newm = NEXT_VAL(unsigned int);
+
+ if (newm == PolyModePrecise || newm == PolyModeImprecise)
+ pPicture->polyMode = newm;
+ else {
+ client->errorValue = newm;
+ error = BadValue;
+ }
+ }
+ break;
+ case CPDither:
+ (void) NEXT_VAL(Atom); /* unimplemented */
+
+ break;
+ case CPComponentAlpha:
+ {
+ unsigned int newca;
+
+ newca = NEXT_VAL(unsigned int);
+
+ if (newca <= xTrue)
+ pPicture->componentAlpha = newca;
+ else {
+ client->errorValue = newca;
+ error = BadValue;
+ }
+ }
+ break;
+ default:
+ client->errorValue = maskQ;
+ error = BadValue;
+ break;
+ }
}
if (ps)
(*ps->ChangePicture) (pPicture, maskQ);
@@ -1230,77 +1195,66 @@ ChangePicture (PicturePtr pPicture,
}
int
-SetPictureClipRects (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- int nRect,
- xRectangle *rects)
+SetPictureClipRects(PicturePtr pPicture,
+ int xOrigin, int yOrigin, int nRect, xRectangle *rects)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- RegionPtr clientClip;
- int result;
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ RegionPtr clientClip;
+ int result;
clientClip = RegionFromRects(nRect, rects, CT_UNSORTED);
if (!clientClip)
- return BadAlloc;
- result =(*ps->ChangePictureClip) (pPicture, CT_REGION,
- (pointer) clientClip, 0);
- if (result == Success)
- {
- pPicture->clipOrigin.x = xOrigin;
- pPicture->clipOrigin.y = yOrigin;
- pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
- pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ return BadAlloc;
+ result = (*ps->ChangePictureClip) (pPicture, CT_REGION,
+ (pointer) clientClip, 0);
+ if (result == Success) {
+ pPicture->clipOrigin.x = xOrigin;
+ pPicture->clipOrigin.y = yOrigin;
+ pPicture->stateChanges |= CPClipXOrigin | CPClipYOrigin | CPClipMask;
+ pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
}
return result;
}
int
-SetPictureClipRegion (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- RegionPtr pRegion)
+SetPictureClipRegion(PicturePtr pPicture,
+ int xOrigin, int yOrigin, RegionPtr pRegion)
{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- RegionPtr clientClip;
- int result;
- int type;
-
- if (pRegion)
- {
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ RegionPtr clientClip;
+ int result;
+ int type;
+
+ if (pRegion) {
type = CT_REGION;
clientClip = RegionCreate(RegionExtents(pRegion),
RegionNumRects(pRegion));
if (!clientClip)
return BadAlloc;
- if (!RegionCopy(clientClip, pRegion))
- {
+ if (!RegionCopy(clientClip, pRegion)) {
RegionDestroy(clientClip);
return BadAlloc;
}
}
- else
- {
+ else {
type = CT_NONE;
clientClip = 0;
}
- result =(*ps->ChangePictureClip) (pPicture, type,
- (pointer) clientClip, 0);
- if (result == Success)
- {
+ result = (*ps->ChangePictureClip) (pPicture, type, (pointer) clientClip, 0);
+ if (result == Success) {
pPicture->clipOrigin.x = xOrigin;
pPicture->clipOrigin.y = yOrigin;
- pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
+ pPicture->stateChanges |= CPClipXOrigin | CPClipYOrigin | CPClipMask;
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
}
return result;
}
static Bool
-transformIsIdentity(PictTransform *t)
+transformIsIdentity(PictTransform * t)
{
return ((t->matrix[0][0] == t->matrix[1][1]) &&
(t->matrix[0][0] == t->matrix[2][2]) &&
@@ -1309,50 +1263,44 @@ transformIsIdentity(PictTransform *t)
(t->matrix[0][2] == 0) &&
(t->matrix[1][0] == 0) &&
(t->matrix[1][2] == 0) &&
- (t->matrix[2][0] == 0) &&
- (t->matrix[2][1] == 0));
+ (t->matrix[2][0] == 0) && (t->matrix[2][1] == 0));
}
int
-SetPictureTransform (PicturePtr pPicture,
- PictTransform *transform)
+SetPictureTransform(PicturePtr pPicture, PictTransform * transform)
{
- if (transform && transformIsIdentity (transform))
- transform = 0;
-
- if (transform)
- {
- if (!pPicture->transform)
- {
- pPicture->transform = (PictTransform *) malloc(sizeof (PictTransform));
- if (!pPicture->transform)
- return BadAlloc;
- }
- *pPicture->transform = *transform;
+ if (transform && transformIsIdentity(transform))
+ transform = 0;
+
+ if (transform) {
+ if (!pPicture->transform) {
+ pPicture->transform =
+ (PictTransform *) malloc(sizeof(PictTransform));
+ if (!pPicture->transform)
+ return BadAlloc;
+ }
+ *pPicture->transform = *transform;
}
- else
- {
- free(pPicture->transform);
- pPicture->transform = NULL;
+ else {
+ free(pPicture->transform);
+ pPicture->transform = NULL;
}
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
if (pPicture->pDrawable != NULL) {
- int result;
- PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
+ int result;
+ PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
- result = (*ps->ChangePictureTransform) (pPicture, transform);
+ result = (*ps->ChangePictureTransform) (pPicture, transform);
- return result;
+ return result;
}
return Success;
}
void
-CopyPicture (PicturePtr pSrc,
- Mask mask,
- PicturePtr pDst)
+CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst)
{
PictureScreenPtr ps = GetPictureScreen(pSrc->pDrawable->pScreen);
Mask origMask = mask;
@@ -1361,155 +1309,145 @@ CopyPicture (PicturePtr pSrc,
pDst->stateChanges |= mask;
while (mask) {
- Mask bit = lowbit(mask);
-
- switch (bit)
- {
- case CPRepeat:
- pDst->repeat = pSrc->repeat;
- pDst->repeatType = pSrc->repeatType;
- break;
- case CPAlphaMap:
- if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)
- pSrc->alphaMap->refcnt++;
- if (pDst->alphaMap)
- FreePicture ((pointer) pDst->alphaMap, (XID) 0);
- pDst->alphaMap = pSrc->alphaMap;
- break;
- case CPAlphaXOrigin:
- pDst->alphaOrigin.x = pSrc->alphaOrigin.x;
- break;
- case CPAlphaYOrigin:
- pDst->alphaOrigin.y = pSrc->alphaOrigin.y;
- break;
- case CPClipXOrigin:
- pDst->clipOrigin.x = pSrc->clipOrigin.x;
- break;
- case CPClipYOrigin:
- pDst->clipOrigin.y = pSrc->clipOrigin.y;
- break;
- case CPClipMask:
- switch (pSrc->clientClipType) {
- case CT_NONE:
- (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0);
- break;
- case CT_REGION:
- if (!pSrc->clientClip) {
- (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0);
- } else {
- RegionPtr clientClip;
- RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip;
-
- clientClip = RegionCreate(
- RegionExtents(srcClientClip),
- RegionNumRects(srcClientClip));
- (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0);
- }
- break;
- default:
- /* XXX: CT_PIXMAP unimplemented */
- break;
- }
- break;
- case CPGraphicsExposure:
- pDst->graphicsExposures = pSrc->graphicsExposures;
- break;
- case CPPolyEdge:
- pDst->polyEdge = pSrc->polyEdge;
- break;
- case CPPolyMode:
- pDst->polyMode = pSrc->polyMode;
- break;
- case CPDither:
- break;
- case CPComponentAlpha:
- pDst->componentAlpha = pSrc->componentAlpha;
- break;
- }
- mask &= ~bit;
+ Mask bit = lowbit(mask);
+
+ switch (bit) {
+ case CPRepeat:
+ pDst->repeat = pSrc->repeat;
+ pDst->repeatType = pSrc->repeatType;
+ break;
+ case CPAlphaMap:
+ if (pSrc->alphaMap &&
+ pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)
+ pSrc->alphaMap->refcnt++;
+ if (pDst->alphaMap)
+ FreePicture((pointer) pDst->alphaMap, (XID) 0);
+ pDst->alphaMap = pSrc->alphaMap;
+ break;
+ case CPAlphaXOrigin:
+ pDst->alphaOrigin.x = pSrc->alphaOrigin.x;
+ break;
+ case CPAlphaYOrigin:
+ pDst->alphaOrigin.y = pSrc->alphaOrigin.y;
+ break;
+ case CPClipXOrigin:
+ pDst->clipOrigin.x = pSrc->clipOrigin.x;
+ break;
+ case CPClipYOrigin:
+ pDst->clipOrigin.y = pSrc->clipOrigin.y;
+ break;
+ case CPClipMask:
+ switch (pSrc->clientClipType) {
+ case CT_NONE:
+ (*ps->ChangePictureClip) (pDst, CT_NONE, NULL, 0);
+ break;
+ case CT_REGION:
+ if (!pSrc->clientClip) {
+ (*ps->ChangePictureClip) (pDst, CT_NONE, NULL, 0);
+ }
+ else {
+ RegionPtr clientClip;
+ RegionPtr srcClientClip = (RegionPtr) pSrc->clientClip;
+
+ clientClip = RegionCreate(RegionExtents(srcClientClip),
+ RegionNumRects(srcClientClip));
+ (*ps->ChangePictureClip) (pDst, CT_REGION, clientClip, 0);
+ }
+ break;
+ default:
+ /* XXX: CT_PIXMAP unimplemented */
+ break;
+ }
+ break;
+ case CPGraphicsExposure:
+ pDst->graphicsExposures = pSrc->graphicsExposures;
+ break;
+ case CPPolyEdge:
+ pDst->polyEdge = pSrc->polyEdge;
+ break;
+ case CPPolyMode:
+ pDst->polyMode = pSrc->polyMode;
+ break;
+ case CPDither:
+ break;
+ case CPComponentAlpha:
+ pDst->componentAlpha = pSrc->componentAlpha;
+ break;
+ }
+ mask &= ~bit;
}
- (*ps->ChangePicture)(pDst, origMask);
+ (*ps->ChangePicture) (pDst, origMask);
}
static void
-ValidateOnePicture (PicturePtr pPicture)
+ValidateOnePicture(PicturePtr pPicture)
{
- if (pPicture->pDrawable && pPicture->serialNumber != pPicture->pDrawable->serialNumber)
- {
- PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
+ if (pPicture->pDrawable &&
+ pPicture->serialNumber != pPicture->pDrawable->serialNumber) {
+ PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
- (*ps->ValidatePicture) (pPicture, pPicture->stateChanges);
- pPicture->stateChanges = 0;
- pPicture->serialNumber = pPicture->pDrawable->serialNumber;
+ (*ps->ValidatePicture) (pPicture, pPicture->stateChanges);
+ pPicture->stateChanges = 0;
+ pPicture->serialNumber = pPicture->pDrawable->serialNumber;
}
}
void
ValidatePicture(PicturePtr pPicture)
{
- ValidateOnePicture (pPicture);
+ ValidateOnePicture(pPicture);
if (pPicture->alphaMap)
- ValidateOnePicture (pPicture->alphaMap);
+ ValidateOnePicture(pPicture->alphaMap);
}
int
-FreePicture (pointer value,
- XID pid)
+FreePicture(pointer value, XID pid)
{
- PicturePtr pPicture = (PicturePtr) value;
+ PicturePtr pPicture = (PicturePtr) value;
- if (--pPicture->refcnt == 0)
- {
- free(pPicture->transform);
+ if (--pPicture->refcnt == 0) {
+ free(pPicture->transform);
- if (pPicture->pSourcePict)
- {
- if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
- free(pPicture->pSourcePict->linear.stops);
+ if (pPicture->pSourcePict) {
+ if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
+ free(pPicture->pSourcePict->linear.stops);
- free(pPicture->pSourcePict);
- }
+ free(pPicture->pSourcePict);
+ }
+
+ if (pPicture->pDrawable) {
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
- if (pPicture->pDrawable)
- {
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
if (pPicture->alphaMap)
- FreePicture ((pointer) pPicture->alphaMap, (XID) 0);
+ FreePicture((pointer) pPicture->alphaMap, (XID) 0);
(*ps->DestroyPicture) (pPicture);
(*ps->DestroyPictureClip) (pPicture);
- if (pPicture->pDrawable->type == DRAWABLE_WINDOW)
- {
- WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
- PicturePtr *pPrev;
-
- for (pPrev = (PicturePtr *)dixLookupPrivateAddr
- (&pWindow->devPrivates, PictureWindowPrivateKey);
- *pPrev;
- pPrev = &(*pPrev)->pNext)
- {
- if (*pPrev == pPicture)
- {
+ if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
+ PicturePtr *pPrev;
+
+ for (pPrev = (PicturePtr *) dixLookupPrivateAddr
+ (&pWindow->devPrivates, PictureWindowPrivateKey);
+ *pPrev; pPrev = &(*pPrev)->pNext) {
+ if (*pPrev == pPicture) {
*pPrev = pPicture->pNext;
break;
}
}
}
- else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP)
- {
- (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable);
+ else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) {
+ (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable);
}
}
- dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE);
+ dixFreeObjectWithPrivates(pPicture, PRIVATE_PICTURE);
}
return Success;
}
int
-FreePictFormat (pointer pPictFormat,
- XID pid)
+FreePictFormat(pointer pPictFormat, XID pid)
{
return Success;
}
@@ -1521,8 +1459,8 @@ FreePictFormat (pointer pPictFormat,
* being careful to avoid these cases.
*/
static CARD8
-ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height)
+ReduceCompositeOp(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height)
{
Bool no_src_alpha, no_dst_alpha;
@@ -1533,228 +1471,197 @@ ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
* picture.
*/
no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
- PICT_FORMAT_A(pSrc->format) == 0 &&
- (pSrc->repeatType != RepeatNone ||
- (!pSrc->transform &&
- xSrc >= 0 && ySrc >= 0 &&
- xSrc + width <= pSrc->pDrawable->width &&
- ySrc + height <= pSrc->pDrawable->height)) &&
- pSrc->alphaMap == NULL &&
- pMask == NULL;
+ PICT_FORMAT_A(pSrc->format) == 0 &&
+ (pSrc->repeatType != RepeatNone ||
+ (!pSrc->transform &&
+ xSrc >= 0 && ySrc >= 0 &&
+ xSrc + width <= pSrc->pDrawable->width &&
+ ySrc + height <= pSrc->pDrawable->height)) &&
+ pSrc->alphaMap == NULL && pMask == NULL;
no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
- PICT_FORMAT_A(pDst->format) == 0 &&
- pDst->alphaMap == NULL;
+ 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;
- }
+ 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;
- }
+ 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;
+ op = PictOpClear;
+ break;
case PictOpDisjointSrc:
case PictOpConjointSrc:
- op = PictOpSrc;
- break;
+ op = PictOpSrc;
+ break;
case PictOpDisjointDst:
case PictOpConjointDst:
- op = PictOpDst;
- break;
+ op = PictOpDst;
+ break;
default:
- break;
+ break;
}
return op;
}
void
-CompositePicture (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+CompositePicture(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
if (pMask)
- ValidatePicture (pMask);
- ValidatePicture (pDst);
+ ValidatePicture(pMask);
+ ValidatePicture(pDst);
- op = ReduceCompositeOp (op, pSrc, pMask, pDst, xSrc, ySrc, width, height);
+ op = ReduceCompositeOp(op, pSrc, pMask, pDst, xSrc, ySrc, width, height);
if (op == PictOpDst)
- return;
+ return;
(*ps->Composite) (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
+ pSrc,
+ pMask,
+ pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
}
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);
-
- ValidatePicture (pDst);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pDst);
(*ps->CompositeRects) (op, pDst, color, nRect, rects);
}
void
-CompositeTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps)
+CompositeTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
(*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps);
}
void
-CompositeTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntriangles,
- xTriangle *triangles)
+CompositeTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntriangles, xTriangle * triangles)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
-
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
- (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles, triangles);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
+ (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles,
+ triangles);
}
void
-CompositeTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+CompositeTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
if (npoints < 3)
return;
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
(*ps->TriStrip) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points);
}
void
-CompositeTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points)
+CompositeTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points)
{
- PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
if (npoints < 3)
- return;
+ return;
- ValidatePicture (pSrc);
- ValidatePicture (pDst);
+ ValidatePicture(pSrc);
+ ValidatePicture(pDst);
(*ps->TriFan) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points);
}
void
-AddTraps (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntrap,
- xTrap *traps)
+AddTraps(PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap * traps)
{
- PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
-
- ValidatePicture (pPicture);
+ PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
+
+ ValidatePicture(pPicture);
(*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps);
}
-
diff --git a/xorg-server/render/picturestr.h b/xorg-server/render/picturestr.h
index 9b376710e..cd4ec498c 100644
--- a/xorg-server/render/picturestr.h
+++ b/xorg-server/render/picturestr.h
@@ -30,27 +30,27 @@
#include "privates.h"
typedef struct _DirectFormat {
- CARD16 red, redMask;
- CARD16 green, greenMask;
- CARD16 blue, blueMask;
- CARD16 alpha, alphaMask;
+ CARD16 red, redMask;
+ CARD16 green, greenMask;
+ CARD16 blue, blueMask;
+ CARD16 alpha, alphaMask;
} DirectFormatRec;
typedef struct _IndexFormat {
- VisualID vid;
- ColormapPtr pColormap;
- int nvalues;
- xIndexValue *pValues;
- void *devPrivate;
+ VisualID vid;
+ ColormapPtr pColormap;
+ int nvalues;
+ xIndexValue *pValues;
+ void *devPrivate;
} IndexFormatRec;
typedef struct _PictFormat {
- CARD32 id;
- CARD32 format; /* except bpp */
- unsigned char type;
- unsigned char depth;
+ CARD32 id;
+ CARD32 format; /* except bpp */
+ unsigned char type;
+ unsigned char depth;
DirectFormatRec direct;
- IndexFormatRec index;
+ IndexFormatRec index;
} PictFormatRec;
typedef struct pixman_vector PictVector, *PictVectorPtr;
@@ -121,53 +121,53 @@ typedef union _SourcePict {
} SourcePict, *SourcePictPtr;
typedef struct _Picture {
- DrawablePtr pDrawable;
- PictFormatPtr pFormat;
- PictFormatShort format; /* PICT_FORMAT */
- int refcnt;
- CARD32 id;
- unsigned int repeat : 1;
- unsigned int graphicsExposures : 1;
- unsigned int subWindowMode : 1;
- unsigned int polyEdge : 1;
- unsigned int polyMode : 1;
- unsigned int freeCompClip : 1;
- unsigned int clientClipType : 2;
- unsigned int componentAlpha : 1;
- unsigned int repeatType : 2;
- unsigned int filter : 3;
- unsigned int stateChanges : CPLastBit;
- unsigned int unused : 18 - CPLastBit;
-
- PicturePtr pNext; /* chain on same drawable */
-
- PicturePtr alphaMap;
- DDXPointRec alphaOrigin;
-
- DDXPointRec clipOrigin;
- pointer clientClip;
-
- unsigned long serialNumber;
-
- RegionPtr pCompositeClip;
-
- PrivateRec *devPrivates;
-
- PictTransform *transform;
-
- SourcePictPtr pSourcePict;
- xFixed *filter_params;
- int filter_nparams;
+ DrawablePtr pDrawable;
+ PictFormatPtr pFormat;
+ PictFormatShort format; /* PICT_FORMAT */
+ int refcnt;
+ CARD32 id;
+ unsigned int repeat:1;
+ unsigned int graphicsExposures:1;
+ unsigned int subWindowMode:1;
+ unsigned int polyEdge:1;
+ unsigned int polyMode:1;
+ unsigned int freeCompClip:1;
+ unsigned int clientClipType:2;
+ unsigned int componentAlpha:1;
+ unsigned int repeatType:2;
+ unsigned int filter:3;
+ unsigned int stateChanges:CPLastBit;
+ unsigned int unused:18 - CPLastBit;
+
+ PicturePtr pNext; /* chain on same drawable */
+
+ PicturePtr alphaMap;
+ DDXPointRec alphaOrigin;
+
+ DDXPointRec clipOrigin;
+ pointer clientClip;
+
+ unsigned long serialNumber;
+
+ RegionPtr pCompositeClip;
+
+ PrivateRec *devPrivates;
+
+ PictTransform *transform;
+
+ SourcePictPtr pSourcePict;
+ xFixed *filter_params;
+ int filter_nparams;
} PictureRec;
typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
- xFixed *params, int nparams,
- int *width, int *height);
+ xFixed * params, int nparams,
+ int *width, int *height);
typedef struct {
- char *name;
- int id;
+ char *name;
+ int id;
PictFilterValidateParamsProcPtr ValidateParams;
- int width, height;
+ int width, height;
} PictFilterRec, *PictFilterPtr;
#define PictFilterNearest 0
@@ -181,205 +181,180 @@ typedef struct {
/* if you add an 8th filter, expand the filter bitfield above */
typedef struct {
- char *alias;
- int alias_id;
- int filter_id;
+ char *alias;
+ int alias_id;
+ int filter_id;
} PictFilterAliasRec, *PictFilterAliasPtr;
-typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
-typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
-typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
- int clipType,
- pointer value,
- int n);
-typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture);
-
-typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
- PictTransform *transform);
-
-typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
-
-typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
-
-typedef void (*ChangePictureProcPtr) (PicturePtr pPicture,
- Mask mask);
-typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture,
- Mask mask);
-typedef void (*CompositeProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-typedef void (*GlyphsProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlists,
- GlyphListPtr lists,
- GlyphPtr *glyphs);
-
-typedef void (*CompositeRectsProcPtr) (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
-
-typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask,
- xTrapezoid *trap,
- int x_off,
- int y_off);
-
-typedef void (*TrapezoidsProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
-
-typedef void (*TrianglesProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntri,
- xTriangle *tris);
-
-typedef void (*TriStripProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-typedef void (*TriFanProcPtr) (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoint,
- xPointFixed *points);
-
-typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen,
- PictFormatPtr pFormat);
-
-typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
- PictFormatPtr pFormat,
- int ndef,
- xColorItem *pdef);
-
-typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntrap,
- xTrap *traps);
-
-typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris);
-
-typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen,
- GlyphPtr glyph);
-
-typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen,
- GlyphPtr glyph);
+typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
+typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
+typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
+ int clipType, pointer value, int n);
+typedef void (*DestroyPictureClipProcPtr) (PicturePtr pPicture);
+
+typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
+ PictTransform * transform);
+
+typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
+ int filter,
+ xFixed * params, int nparams);
+
+typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
+
+typedef void (*ChangePictureProcPtr) (PicturePtr pPicture, Mask mask);
+typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture, Mask mask);
+typedef void (*CompositeProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+
+typedef void (*GlyphsProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlists,
+ GlyphListPtr lists, GlyphPtr * glyphs);
+
+typedef void (*CompositeRectsProcPtr) (CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color,
+ int nRect, xRectangle *rects);
+
+typedef void (*RasterizeTrapezoidProcPtr) (PicturePtr pMask,
+ xTrapezoid * trap,
+ int x_off, int y_off);
+
+typedef void (*TrapezoidsProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntrap, xTrapezoid * traps);
+
+typedef void (*TrianglesProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntri, xTriangle * tris);
+
+typedef void (*TriStripProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int npoint, xPointFixed * points);
+
+typedef void (*TriFanProcPtr) (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int npoint, xPointFixed * points);
+
+typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat);
+
+typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat);
+
+typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
+ PictFormatPtr pFormat,
+ int ndef, xColorItem * pdef);
+
+typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
+ INT16 xOff,
+ INT16 yOff, int ntrap, xTrap * traps);
+
+typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
+ INT16 xOff,
+ INT16 yOff, int ntri, xTriangle * tris);
+
+typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph);
+
+typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph);
typedef struct _PictureScreen {
- PictFormatPtr formats;
- PictFormatPtr fallback;
- int nformats;
+ PictFormatPtr formats;
+ PictFormatPtr fallback;
+ int nformats;
- CreatePictureProcPtr CreatePicture;
- DestroyPictureProcPtr DestroyPicture;
- ChangePictureClipProcPtr ChangePictureClip;
- DestroyPictureClipProcPtr DestroyPictureClip;
+ CreatePictureProcPtr CreatePicture;
+ DestroyPictureProcPtr DestroyPicture;
+ ChangePictureClipProcPtr ChangePictureClip;
+ DestroyPictureClipProcPtr DestroyPictureClip;
- ChangePictureProcPtr ChangePicture;
- ValidatePictureProcPtr ValidatePicture;
+ ChangePictureProcPtr ChangePicture;
+ ValidatePictureProcPtr ValidatePicture;
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs; /* unused */
- CompositeRectsProcPtr CompositeRects;
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs; /* unused */
+ CompositeRectsProcPtr CompositeRects;
- DestroyWindowProcPtr DestroyWindow;
- CloseScreenProcPtr CloseScreen;
+ DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
- StoreColorsProcPtr StoreColors;
+ StoreColorsProcPtr StoreColors;
- InitIndexedProcPtr InitIndexed;
- CloseIndexedProcPtr CloseIndexed;
- UpdateIndexedProcPtr UpdateIndexed;
+ InitIndexedProcPtr InitIndexed;
+ CloseIndexedProcPtr CloseIndexed;
+ UpdateIndexedProcPtr UpdateIndexed;
- int subpixel;
+ int subpixel;
- PictFilterPtr filters;
- int nfilters;
- PictFilterAliasPtr filterAliases;
- int nfilterAliases;
+ PictFilterPtr filters;
+ int nfilters;
+ PictFilterAliasPtr filterAliases;
+ int nfilterAliases;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureTransform request. Not called for source-only pictures.
*/
- ChangePictureTransformProcPtr ChangePictureTransform;
+ ChangePictureTransformProcPtr ChangePictureTransform;
/**
* Called immediately after a picture's transform is changed through the
* SetPictureFilter request. Not called for source-only pictures.
*/
- ChangePictureFilterProcPtr ChangePictureFilter;
+ ChangePictureFilterProcPtr ChangePictureFilter;
- DestroyPictureFilterProcPtr DestroyPictureFilter;
+ DestroyPictureFilterProcPtr DestroyPictureFilter;
- TrapezoidsProcPtr Trapezoids;
- TrianglesProcPtr Triangles;
+ TrapezoidsProcPtr Trapezoids;
+ TrianglesProcPtr Triangles;
- RasterizeTrapezoidProcPtr RasterizeTrapezoid;
+ RasterizeTrapezoidProcPtr RasterizeTrapezoid;
- AddTrianglesProcPtr AddTriangles;
+ AddTrianglesProcPtr AddTriangles;
- AddTrapsProcPtr AddTraps;
+ AddTrapsProcPtr AddTraps;
- RealizeGlyphProcPtr RealizeGlyph;
- UnrealizeGlyphProcPtr UnrealizeGlyph;
+ RealizeGlyphProcPtr RealizeGlyph;
+ UnrealizeGlyphProcPtr UnrealizeGlyph;
#define PICTURE_SCREEN_VERSION 2
- TriStripProcPtr TriStrip;
- TriFanProcPtr TriFan;
+ TriStripProcPtr TriStrip;
+ TriFanProcPtr TriFan;
} PictureScreenRec, *PictureScreenPtr;
extern _X_EXPORT DevPrivateKeyRec PictureScreenPrivateKeyRec;
+
#define PictureScreenPrivateKey (&PictureScreenPrivateKeyRec)
extern _X_EXPORT DevPrivateKeyRec PictureWindowPrivateKeyRec;
+
#define PictureWindowPrivateKey (&PictureWindowPrivateKeyRec)
-extern _X_EXPORT RESTYPE PictureType;
-extern _X_EXPORT RESTYPE PictFormatType;
-extern _X_EXPORT RESTYPE GlyphSetType;
+extern _X_EXPORT RESTYPE PictureType;
+extern _X_EXPORT RESTYPE PictFormatType;
+extern _X_EXPORT RESTYPE GlyphSetType;
#define GetPictureScreen(s) ((PictureScreenPtr)dixLookupPrivate(&(s)->devPrivates, PictureScreenPrivateKey))
#define GetPictureScreenIfSet(s) (dixPrivateKeyRegistered(PictureScreenPrivateKey) ? GetPictureScreen(s) : NULL)
@@ -403,247 +378,216 @@ extern _X_EXPORT RESTYPE GlyphSetType;
} \
extern _X_EXPORT Bool
-PictureDestroyWindow (WindowPtr pWindow);
+ PictureDestroyWindow(WindowPtr pWindow);
extern _X_EXPORT Bool
-PictureCloseScreen (int Index, ScreenPtr pScreen);
+ PictureCloseScreen(int Index, ScreenPtr pScreen);
extern _X_EXPORT void
-PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
+ PictureStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef);
extern _X_EXPORT Bool
-PictureInitIndexedFormat (ScreenPtr pScreen, PictFormatPtr format);
+ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format);
extern _X_EXPORT Bool
-PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
+ PictureSetSubpixelOrder(ScreenPtr pScreen, int subpixel);
extern _X_EXPORT int
-PictureGetSubpixelOrder (ScreenPtr pScreen);
+ PictureGetSubpixelOrder(ScreenPtr pScreen);
extern _X_EXPORT PictFormatPtr
-PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
+PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp);
extern _X_EXPORT PictFormatPtr
-PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual);
+PictureMatchVisual(ScreenPtr pScreen, int depth, VisualPtr pVisual);
extern _X_EXPORT PictFormatPtr
-PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format);
+PictureMatchFormat(ScreenPtr pScreen, int depth, CARD32 format);
extern _X_EXPORT Bool
-PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
+ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
extern _X_EXPORT int
-PictureGetFilterId (const char *filter, int len, Bool makeit);
+ PictureGetFilterId(const char *filter, int len, Bool makeit);
-extern _X_EXPORT char *
-PictureGetFilterName (int id);
+extern _X_EXPORT char *PictureGetFilterName(int id);
extern _X_EXPORT int
-PictureAddFilter (ScreenPtr pScreen,
- const char *filter,
- PictFilterValidateParamsProcPtr ValidateParams,
- int width,
- int height);
+
+PictureAddFilter(ScreenPtr pScreen,
+ const char *filter,
+ PictFilterValidateParamsProcPtr ValidateParams,
+ int width, int height);
extern _X_EXPORT Bool
-PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias);
+
+PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias);
extern _X_EXPORT Bool
-PictureSetDefaultFilters (ScreenPtr pScreen);
+ PictureSetDefaultFilters(ScreenPtr pScreen);
extern _X_EXPORT void
-PictureResetFilters (ScreenPtr pScreen);
+ PictureResetFilters(ScreenPtr pScreen);
extern _X_EXPORT PictFilterPtr
-PictureFindFilter (ScreenPtr pScreen, char *name, int len);
+PictureFindFilter(ScreenPtr pScreen, char *name, int len);
extern _X_EXPORT int
-SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
- xFixed *params, int nparams);
+
+SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
+ xFixed * params, int nparams);
extern _X_EXPORT int
-SetPictureFilter (PicturePtr pPicture, char *name, int len,
- xFixed *params, int nparams);
+
+SetPictureFilter(PicturePtr pPicture, char *name, int len,
+ xFixed * params, int nparams);
extern _X_EXPORT Bool
-PictureFinishInit (void);
+ PictureFinishInit(void);
extern _X_EXPORT void
-SetPictureToDefaults (PicturePtr pPicture);
+ SetPictureToDefaults(PicturePtr pPicture);
extern _X_EXPORT PicturePtr
-CreatePicture (Picture pid,
- DrawablePtr pDrawable,
- PictFormatPtr pFormat,
- Mask mask,
- XID *list,
- ClientPtr client,
- int *error);
+CreatePicture(Picture pid,
+ DrawablePtr pDrawable,
+ PictFormatPtr pFormat,
+ Mask mask, XID *list, ClientPtr client, int *error);
extern _X_EXPORT int
-ChangePicture (PicturePtr pPicture,
- Mask vmask,
- XID *vlist,
- DevUnion *ulist,
- ClientPtr client);
+
+ChangePicture(PicturePtr pPicture,
+ Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client);
extern _X_EXPORT int
-SetPictureClipRects (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- int nRect,
- xRectangle *rects);
+
+SetPictureClipRects(PicturePtr pPicture,
+ int xOrigin, int yOrigin, int nRect, xRectangle *rects);
extern _X_EXPORT int
-SetPictureClipRegion (PicturePtr pPicture,
- int xOrigin,
- int yOrigin,
- RegionPtr pRegion);
+
+SetPictureClipRegion(PicturePtr pPicture,
+ int xOrigin, int yOrigin, RegionPtr pRegion);
extern _X_EXPORT int
-SetPictureTransform (PicturePtr pPicture,
- PictTransform *transform);
+ SetPictureTransform(PicturePtr pPicture, PictTransform * transform);
extern _X_EXPORT void
-CopyPicture (PicturePtr pSrc,
- Mask mask,
- PicturePtr pDst);
+ CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst);
extern _X_EXPORT void
-ValidatePicture(PicturePtr pPicture);
+ ValidatePicture(PicturePtr pPicture);
extern _X_EXPORT int
-FreePicture (pointer pPicture,
- XID pid);
+ FreePicture(pointer pPicture, XID pid);
extern _X_EXPORT int
-FreePictFormat (pointer pPictFormat,
- XID pid);
+ FreePictFormat(pointer pPictFormat, XID pid);
extern _X_EXPORT void
-CompositePicture (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
+
+CompositePicture(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
extern _X_EXPORT void
-CompositeGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr lists,
- GlyphPtr *glyphs);
+
+CompositeGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs);
extern _X_EXPORT void
-CompositeRects (CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect,
- xRectangle *rects);
+
+CompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects);
extern _X_EXPORT void
-CompositeTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntrap,
- xTrapezoid *traps);
+
+CompositeTrapezoids(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
-CompositeTriangles (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int ntriangles,
- xTriangle *triangles);
+
+CompositeTriangles(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int ntriangles, xTriangle * triangles);
extern _X_EXPORT void
-CompositeTriStrip (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
+
+CompositeTriStrip(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
extern _X_EXPORT void
-CompositeTriFan (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int npoints,
- xPointFixed *points);
-extern _X_EXPORT void RenderExtensionInit (void);
+CompositeTriFan(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
+
+extern _X_EXPORT void RenderExtensionInit(void);
Bool
-AnimCurInit (ScreenPtr pScreen);
+ AnimCurInit(ScreenPtr pScreen);
int
-AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid);
+
+AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
+ CursorPtr *ppCursor, ClientPtr client, XID cid);
extern _X_EXPORT void
-AddTraps (PicturePtr pPicture,
- INT16 xOff,
- INT16 yOff,
- int ntraps,
- xTrap *traps);
+
+AddTraps(PicturePtr pPicture,
+ INT16 xOff, INT16 yOff, int ntraps, xTrap * traps);
extern _X_EXPORT PicturePtr
-CreateSolidPicture (Picture pid,
- xRenderColor *color,
- int *error);
+CreateSolidPicture(Picture pid, xRenderColor * color, int *error);
extern _X_EXPORT PicturePtr
-CreateLinearGradientPicture (Picture pid,
- xPointFixed *p1,
- xPointFixed *p2,
- int nStops,
- xFixed *stops,
- xRenderColor *colors,
- int *error);
+CreateLinearGradientPicture(Picture pid,
+ xPointFixed * p1,
+ xPointFixed * p2,
+ int nStops,
+ xFixed * stops, xRenderColor * colors, int *error);
extern _X_EXPORT PicturePtr
-CreateRadialGradientPicture (Picture pid,
- xPointFixed *inner,
- xPointFixed *outer,
- xFixed innerRadius,
- xFixed outerRadius,
- int nStops,
- xFixed *stops,
- xRenderColor *colors,
- int *error);
+CreateRadialGradientPicture(Picture pid,
+ xPointFixed * inner,
+ xPointFixed * outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed * stops, xRenderColor * colors, int *error);
extern _X_EXPORT PicturePtr
-CreateConicalGradientPicture (Picture pid,
- xPointFixed *center,
- xFixed angle,
- int nStops,
- xFixed *stops,
- xRenderColor *colors,
- int *error);
+CreateConicalGradientPicture(Picture pid,
+ xPointFixed * center,
+ xFixed angle,
+ int nStops,
+ xFixed * stops, xRenderColor * colors, int *error);
#ifdef PANORAMIX
-extern _X_EXPORT void PanoramiXRenderInit (void);
-extern _X_EXPORT void PanoramiXRenderReset (void);
+extern _X_EXPORT void PanoramiXRenderInit(void);
+extern _X_EXPORT void PanoramiXRenderReset(void);
#endif
/*
@@ -651,19 +595,19 @@ extern _X_EXPORT void PanoramiXRenderReset (void);
*/
extern _X_EXPORT void
-PictTransform_from_xRenderTransform (PictTransformPtr pict,
- xRenderTransform *render);
+
+PictTransform_from_xRenderTransform(PictTransformPtr pict,
+ xRenderTransform * render);
extern _X_EXPORT void
-xRenderTransform_from_PictTransform (xRenderTransform *render,
- PictTransformPtr pict);
+
+xRenderTransform_from_PictTransform(xRenderTransform * render,
+ PictTransformPtr pict);
extern _X_EXPORT Bool
-PictureTransformPoint (PictTransformPtr transform,
- PictVectorPtr vector);
+ PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector);
extern _X_EXPORT Bool
-PictureTransformPoint3d (PictTransformPtr transform,
- PictVectorPtr vector);
+ PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector);
-#endif /* _PICTURESTR_H_ */
+#endif /* _PICTURESTR_H_ */
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index d82e09959..344ca75e2 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -54,213 +54,209 @@
#include <stdint.h>
-static int ProcRenderQueryVersion (ClientPtr pClient);
-static int ProcRenderQueryPictFormats (ClientPtr pClient);
-static int ProcRenderQueryPictIndexValues (ClientPtr pClient);
-static int ProcRenderQueryDithers (ClientPtr pClient);
-static int ProcRenderCreatePicture (ClientPtr pClient);
-static int ProcRenderChangePicture (ClientPtr pClient);
-static int ProcRenderSetPictureClipRectangles (ClientPtr pClient);
-static int ProcRenderFreePicture (ClientPtr pClient);
-static int ProcRenderComposite (ClientPtr pClient);
-static int ProcRenderScale (ClientPtr pClient);
-static int ProcRenderTrapezoids (ClientPtr pClient);
-static int ProcRenderTriangles (ClientPtr pClient);
-static int ProcRenderTriStrip (ClientPtr pClient);
-static int ProcRenderTriFan (ClientPtr pClient);
-static int ProcRenderColorTrapezoids (ClientPtr pClient);
-static int ProcRenderColorTriangles (ClientPtr pClient);
-static int ProcRenderTransform (ClientPtr pClient);
-static int ProcRenderCreateGlyphSet (ClientPtr pClient);
-static int ProcRenderReferenceGlyphSet (ClientPtr pClient);
-static int ProcRenderFreeGlyphSet (ClientPtr pClient);
-static int ProcRenderAddGlyphs (ClientPtr pClient);
-static int ProcRenderAddGlyphsFromPicture (ClientPtr pClient);
-static int ProcRenderFreeGlyphs (ClientPtr pClient);
-static int ProcRenderCompositeGlyphs (ClientPtr pClient);
-static int ProcRenderFillRectangles (ClientPtr pClient);
-static int ProcRenderCreateCursor (ClientPtr pClient);
-static int ProcRenderSetPictureTransform (ClientPtr pClient);
-static int ProcRenderQueryFilters (ClientPtr pClient);
-static int ProcRenderSetPictureFilter (ClientPtr pClient);
-static int ProcRenderCreateAnimCursor (ClientPtr pClient);
-static int ProcRenderAddTraps (ClientPtr pClient);
-static int ProcRenderCreateSolidFill (ClientPtr pClient);
-static int ProcRenderCreateLinearGradient (ClientPtr pClient);
-static int ProcRenderCreateRadialGradient (ClientPtr pClient);
-static int ProcRenderCreateConicalGradient (ClientPtr pClient);
-
-static int ProcRenderDispatch (ClientPtr pClient);
-
-static int SProcRenderQueryVersion (ClientPtr pClient);
-static int SProcRenderQueryPictFormats (ClientPtr pClient);
-static int SProcRenderQueryPictIndexValues (ClientPtr pClient);
-static int SProcRenderQueryDithers (ClientPtr pClient);
-static int SProcRenderCreatePicture (ClientPtr pClient);
-static int SProcRenderChangePicture (ClientPtr pClient);
-static int SProcRenderSetPictureClipRectangles (ClientPtr pClient);
-static int SProcRenderFreePicture (ClientPtr pClient);
-static int SProcRenderComposite (ClientPtr pClient);
-static int SProcRenderScale (ClientPtr pClient);
-static int SProcRenderTrapezoids (ClientPtr pClient);
-static int SProcRenderTriangles (ClientPtr pClient);
-static int SProcRenderTriStrip (ClientPtr pClient);
-static int SProcRenderTriFan (ClientPtr pClient);
-static int SProcRenderColorTrapezoids (ClientPtr pClient);
-static int SProcRenderColorTriangles (ClientPtr pClient);
-static int SProcRenderTransform (ClientPtr pClient);
-static int SProcRenderCreateGlyphSet (ClientPtr pClient);
-static int SProcRenderReferenceGlyphSet (ClientPtr pClient);
-static int SProcRenderFreeGlyphSet (ClientPtr pClient);
-static int SProcRenderAddGlyphs (ClientPtr pClient);
-static int SProcRenderAddGlyphsFromPicture (ClientPtr pClient);
-static int SProcRenderFreeGlyphs (ClientPtr pClient);
-static int SProcRenderCompositeGlyphs (ClientPtr pClient);
-static int SProcRenderFillRectangles (ClientPtr pClient);
-static int SProcRenderCreateCursor (ClientPtr pClient);
-static int SProcRenderSetPictureTransform (ClientPtr pClient);
-static int SProcRenderQueryFilters (ClientPtr pClient);
-static int SProcRenderSetPictureFilter (ClientPtr pClient);
-static int SProcRenderCreateAnimCursor (ClientPtr pClient);
-static int SProcRenderAddTraps (ClientPtr pClient);
-static int SProcRenderCreateSolidFill (ClientPtr pClient);
-static int SProcRenderCreateLinearGradient (ClientPtr pClient);
-static int SProcRenderCreateRadialGradient (ClientPtr pClient);
-static int SProcRenderCreateConicalGradient (ClientPtr pClient);
-
-static int SProcRenderDispatch (ClientPtr pClient);
-
-int (*ProcRenderVector[RenderNumberRequests])(ClientPtr) = {
- ProcRenderQueryVersion,
- ProcRenderQueryPictFormats,
- ProcRenderQueryPictIndexValues,
- ProcRenderQueryDithers,
- ProcRenderCreatePicture,
- ProcRenderChangePicture,
- ProcRenderSetPictureClipRectangles,
- ProcRenderFreePicture,
- ProcRenderComposite,
- ProcRenderScale,
- ProcRenderTrapezoids,
- ProcRenderTriangles,
- ProcRenderTriStrip,
- ProcRenderTriFan,
- ProcRenderColorTrapezoids,
- ProcRenderColorTriangles,
- ProcRenderTransform,
- ProcRenderCreateGlyphSet,
- ProcRenderReferenceGlyphSet,
- ProcRenderFreeGlyphSet,
- ProcRenderAddGlyphs,
- ProcRenderAddGlyphsFromPicture,
- ProcRenderFreeGlyphs,
- ProcRenderCompositeGlyphs,
- ProcRenderCompositeGlyphs,
- ProcRenderCompositeGlyphs,
- ProcRenderFillRectangles,
- ProcRenderCreateCursor,
- ProcRenderSetPictureTransform,
- ProcRenderQueryFilters,
- ProcRenderSetPictureFilter,
- ProcRenderCreateAnimCursor,
- ProcRenderAddTraps,
- ProcRenderCreateSolidFill,
- ProcRenderCreateLinearGradient,
- ProcRenderCreateRadialGradient,
- ProcRenderCreateConicalGradient
-};
-
-int (*SProcRenderVector[RenderNumberRequests])(ClientPtr) = {
- SProcRenderQueryVersion,
- SProcRenderQueryPictFormats,
- SProcRenderQueryPictIndexValues,
- SProcRenderQueryDithers,
- SProcRenderCreatePicture,
- SProcRenderChangePicture,
- SProcRenderSetPictureClipRectangles,
- SProcRenderFreePicture,
- SProcRenderComposite,
- SProcRenderScale,
- SProcRenderTrapezoids,
- SProcRenderTriangles,
- SProcRenderTriStrip,
- SProcRenderTriFan,
- SProcRenderColorTrapezoids,
- SProcRenderColorTriangles,
- SProcRenderTransform,
- SProcRenderCreateGlyphSet,
- SProcRenderReferenceGlyphSet,
- SProcRenderFreeGlyphSet,
- SProcRenderAddGlyphs,
- SProcRenderAddGlyphsFromPicture,
- SProcRenderFreeGlyphs,
- SProcRenderCompositeGlyphs,
- SProcRenderCompositeGlyphs,
- SProcRenderCompositeGlyphs,
- SProcRenderFillRectangles,
- SProcRenderCreateCursor,
- SProcRenderSetPictureTransform,
- SProcRenderQueryFilters,
- SProcRenderSetPictureFilter,
- SProcRenderCreateAnimCursor,
- SProcRenderAddTraps,
- SProcRenderCreateSolidFill,
- SProcRenderCreateLinearGradient,
- SProcRenderCreateRadialGradient,
- SProcRenderCreateConicalGradient
-};
-
-int RenderErrBase;
+static int ProcRenderQueryVersion(ClientPtr pClient);
+static int ProcRenderQueryPictFormats(ClientPtr pClient);
+static int ProcRenderQueryPictIndexValues(ClientPtr pClient);
+static int ProcRenderQueryDithers(ClientPtr pClient);
+static int ProcRenderCreatePicture(ClientPtr pClient);
+static int ProcRenderChangePicture(ClientPtr pClient);
+static int ProcRenderSetPictureClipRectangles(ClientPtr pClient);
+static int ProcRenderFreePicture(ClientPtr pClient);
+static int ProcRenderComposite(ClientPtr pClient);
+static int ProcRenderScale(ClientPtr pClient);
+static int ProcRenderTrapezoids(ClientPtr pClient);
+static int ProcRenderTriangles(ClientPtr pClient);
+static int ProcRenderTriStrip(ClientPtr pClient);
+static int ProcRenderTriFan(ClientPtr pClient);
+static int ProcRenderColorTrapezoids(ClientPtr pClient);
+static int ProcRenderColorTriangles(ClientPtr pClient);
+static int ProcRenderTransform(ClientPtr pClient);
+static int ProcRenderCreateGlyphSet(ClientPtr pClient);
+static int ProcRenderReferenceGlyphSet(ClientPtr pClient);
+static int ProcRenderFreeGlyphSet(ClientPtr pClient);
+static int ProcRenderAddGlyphs(ClientPtr pClient);
+static int ProcRenderAddGlyphsFromPicture(ClientPtr pClient);
+static int ProcRenderFreeGlyphs(ClientPtr pClient);
+static int ProcRenderCompositeGlyphs(ClientPtr pClient);
+static int ProcRenderFillRectangles(ClientPtr pClient);
+static int ProcRenderCreateCursor(ClientPtr pClient);
+static int ProcRenderSetPictureTransform(ClientPtr pClient);
+static int ProcRenderQueryFilters(ClientPtr pClient);
+static int ProcRenderSetPictureFilter(ClientPtr pClient);
+static int ProcRenderCreateAnimCursor(ClientPtr pClient);
+static int ProcRenderAddTraps(ClientPtr pClient);
+static int ProcRenderCreateSolidFill(ClientPtr pClient);
+static int ProcRenderCreateLinearGradient(ClientPtr pClient);
+static int ProcRenderCreateRadialGradient(ClientPtr pClient);
+static int ProcRenderCreateConicalGradient(ClientPtr pClient);
+
+static int ProcRenderDispatch(ClientPtr pClient);
+
+static int SProcRenderQueryVersion(ClientPtr pClient);
+static int SProcRenderQueryPictFormats(ClientPtr pClient);
+static int SProcRenderQueryPictIndexValues(ClientPtr pClient);
+static int SProcRenderQueryDithers(ClientPtr pClient);
+static int SProcRenderCreatePicture(ClientPtr pClient);
+static int SProcRenderChangePicture(ClientPtr pClient);
+static int SProcRenderSetPictureClipRectangles(ClientPtr pClient);
+static int SProcRenderFreePicture(ClientPtr pClient);
+static int SProcRenderComposite(ClientPtr pClient);
+static int SProcRenderScale(ClientPtr pClient);
+static int SProcRenderTrapezoids(ClientPtr pClient);
+static int SProcRenderTriangles(ClientPtr pClient);
+static int SProcRenderTriStrip(ClientPtr pClient);
+static int SProcRenderTriFan(ClientPtr pClient);
+static int SProcRenderColorTrapezoids(ClientPtr pClient);
+static int SProcRenderColorTriangles(ClientPtr pClient);
+static int SProcRenderTransform(ClientPtr pClient);
+static int SProcRenderCreateGlyphSet(ClientPtr pClient);
+static int SProcRenderReferenceGlyphSet(ClientPtr pClient);
+static int SProcRenderFreeGlyphSet(ClientPtr pClient);
+static int SProcRenderAddGlyphs(ClientPtr pClient);
+static int SProcRenderAddGlyphsFromPicture(ClientPtr pClient);
+static int SProcRenderFreeGlyphs(ClientPtr pClient);
+static int SProcRenderCompositeGlyphs(ClientPtr pClient);
+static int SProcRenderFillRectangles(ClientPtr pClient);
+static int SProcRenderCreateCursor(ClientPtr pClient);
+static int SProcRenderSetPictureTransform(ClientPtr pClient);
+static int SProcRenderQueryFilters(ClientPtr pClient);
+static int SProcRenderSetPictureFilter(ClientPtr pClient);
+static int SProcRenderCreateAnimCursor(ClientPtr pClient);
+static int SProcRenderAddTraps(ClientPtr pClient);
+static int SProcRenderCreateSolidFill(ClientPtr pClient);
+static int SProcRenderCreateLinearGradient(ClientPtr pClient);
+static int SProcRenderCreateRadialGradient(ClientPtr pClient);
+static int SProcRenderCreateConicalGradient(ClientPtr pClient);
+
+static int SProcRenderDispatch(ClientPtr pClient);
+
+int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr) = {
+ProcRenderQueryVersion,
+ ProcRenderQueryPictFormats,
+ ProcRenderQueryPictIndexValues,
+ ProcRenderQueryDithers,
+ ProcRenderCreatePicture,
+ ProcRenderChangePicture,
+ ProcRenderSetPictureClipRectangles,
+ ProcRenderFreePicture,
+ ProcRenderComposite,
+ ProcRenderScale,
+ ProcRenderTrapezoids,
+ ProcRenderTriangles,
+ ProcRenderTriStrip,
+ ProcRenderTriFan,
+ ProcRenderColorTrapezoids,
+ ProcRenderColorTriangles,
+ ProcRenderTransform,
+ ProcRenderCreateGlyphSet,
+ ProcRenderReferenceGlyphSet,
+ ProcRenderFreeGlyphSet,
+ ProcRenderAddGlyphs,
+ ProcRenderAddGlyphsFromPicture,
+ ProcRenderFreeGlyphs,
+ ProcRenderCompositeGlyphs,
+ ProcRenderCompositeGlyphs,
+ ProcRenderCompositeGlyphs,
+ ProcRenderFillRectangles,
+ ProcRenderCreateCursor,
+ ProcRenderSetPictureTransform,
+ ProcRenderQueryFilters,
+ ProcRenderSetPictureFilter,
+ ProcRenderCreateAnimCursor,
+ ProcRenderAddTraps,
+ ProcRenderCreateSolidFill,
+ ProcRenderCreateLinearGradient,
+ ProcRenderCreateRadialGradient, ProcRenderCreateConicalGradient};
+
+int (*SProcRenderVector[RenderNumberRequests]) (ClientPtr) = {
+SProcRenderQueryVersion,
+ SProcRenderQueryPictFormats,
+ SProcRenderQueryPictIndexValues,
+ SProcRenderQueryDithers,
+ SProcRenderCreatePicture,
+ SProcRenderChangePicture,
+ SProcRenderSetPictureClipRectangles,
+ SProcRenderFreePicture,
+ SProcRenderComposite,
+ SProcRenderScale,
+ SProcRenderTrapezoids,
+ SProcRenderTriangles,
+ SProcRenderTriStrip,
+ SProcRenderTriFan,
+ SProcRenderColorTrapezoids,
+ SProcRenderColorTriangles,
+ SProcRenderTransform,
+ SProcRenderCreateGlyphSet,
+ SProcRenderReferenceGlyphSet,
+ SProcRenderFreeGlyphSet,
+ SProcRenderAddGlyphs,
+ SProcRenderAddGlyphsFromPicture,
+ SProcRenderFreeGlyphs,
+ SProcRenderCompositeGlyphs,
+ SProcRenderCompositeGlyphs,
+ SProcRenderCompositeGlyphs,
+ SProcRenderFillRectangles,
+ SProcRenderCreateCursor,
+ SProcRenderSetPictureTransform,
+ SProcRenderQueryFilters,
+ SProcRenderSetPictureFilter,
+ SProcRenderCreateAnimCursor,
+ SProcRenderAddTraps,
+ SProcRenderCreateSolidFill,
+ SProcRenderCreateLinearGradient,
+ SProcRenderCreateRadialGradient, SProcRenderCreateConicalGradient};
+
+int RenderErrBase;
static DevPrivateKeyRec RenderClientPrivateKeyRec;
+
#define RenderClientPrivateKey (&RenderClientPrivateKeyRec )
typedef struct _RenderClient {
- int major_version;
- int minor_version;
+ int major_version;
+ int minor_version;
} RenderClientRec, *RenderClientPtr;
#define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey))
static void
-RenderClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
+RenderClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- RenderClientPtr pRenderClient = GetRenderClient (pClient);
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ RenderClientPtr pRenderClient = GetRenderClient(pClient);
pRenderClient->major_version = 0;
pRenderClient->minor_version = 0;
}
#ifdef PANORAMIX
-RESTYPE XRT_PICTURE;
+RESTYPE XRT_PICTURE;
#endif
void
-RenderExtensionInit (void)
+RenderExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!PictureType)
- return;
- if (!PictureFinishInit ())
- return;
- if (!dixRegisterPrivateKey(&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec)))
- return;
- if (!AddCallback (&ClientStateCallback, RenderClientCallback, 0))
- return;
-
- extEntry = AddExtension (RENDER_NAME, 0, RenderNumberErrors,
- ProcRenderDispatch, SProcRenderDispatch,
- NULL, StandardMinorOpcode);
+ return;
+ if (!PictureFinishInit())
+ return;
+ if (!dixRegisterPrivateKey
+ (&RenderClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RenderClientRec)))
+ return;
+ if (!AddCallback(&ClientStateCallback, RenderClientCallback, 0))
+ return;
+
+ extEntry = AddExtension(RENDER_NAME, 0, RenderNumberErrors,
+ ProcRenderDispatch, SProcRenderDispatch,
+ NULL, StandardMinorOpcode);
if (!extEntry)
- return;
+ return;
RenderErrBase = extEntry->errorBase;
#ifdef PANORAMIX
if (XRT_PICTURE)
- SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
+ SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
#endif
SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture);
SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat);
@@ -268,10 +264,11 @@ RenderExtensionInit (void)
}
static int
-ProcRenderQueryVersion (ClientPtr client)
+ProcRenderQueryVersion(ClientPtr client)
{
- RenderClientPtr pRenderClient = GetRenderClient (client);
+ RenderClientPtr pRenderClient = GetRenderClient(client);
xRenderQueryVersionReply rep;
+
REQUEST(xRenderQueryVersionReq);
pRenderClient->major_version = stuff->majorVersion;
@@ -284,110 +281,106 @@ ProcRenderQueryVersion (ClientPtr client)
rep.sequenceNumber = client->sequence;
if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
- (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION))
- {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else
- {
- rep.majorVersion = SERVER_RENDER_MAJOR_VERSION;
- rep.minorVersion = SERVER_RENDER_MINOR_VERSION;
+ (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION)) {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+ else {
+ rep.majorVersion = SERVER_RENDER_MAJOR_VERSION;
+ rep.minorVersion = SERVER_RENDER_MINOR_VERSION;
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xRenderQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xRenderQueryVersionReply), (char *) &rep);
return Success;
}
static VisualPtr
-findVisual (ScreenPtr pScreen, VisualID vid)
+findVisual(ScreenPtr pScreen, VisualID vid)
{
- VisualPtr pVisual;
- int v;
+ VisualPtr pVisual;
+ int v;
- for (v = 0; v < pScreen->numVisuals; v++)
- {
- pVisual = pScreen->visuals + v;
- if (pVisual->vid == vid)
- return pVisual;
+ for (v = 0; v < pScreen->numVisuals; v++) {
+ pVisual = pScreen->visuals + v;
+ if (pVisual->vid == vid)
+ return pVisual;
}
return 0;
}
static int
-ProcRenderQueryPictFormats (ClientPtr client)
-{
- RenderClientPtr pRenderClient = GetRenderClient (client);
- xRenderQueryPictFormatsReply *reply;
- xPictScreen *pictScreen;
- xPictDepth *pictDepth;
- xPictVisual *pictVisual;
- xPictFormInfo *pictForm;
- CARD32 *pictSubpixel;
- ScreenPtr pScreen;
- VisualPtr pVisual;
- DepthPtr pDepth;
- int v, d;
- PictureScreenPtr ps;
- PictFormatPtr pFormat;
- int nformat;
- int ndepth;
- int nvisual;
- int rlength;
- int s;
- int numScreens;
- int numSubpixel;
+ProcRenderQueryPictFormats(ClientPtr client)
+{
+ RenderClientPtr pRenderClient = GetRenderClient(client);
+ xRenderQueryPictFormatsReply *reply;
+ xPictScreen *pictScreen;
+ xPictDepth *pictDepth;
+ xPictVisual *pictVisual;
+ xPictFormInfo *pictForm;
+ CARD32 *pictSubpixel;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ DepthPtr pDepth;
+ int v, d;
+ PictureScreenPtr ps;
+ PictFormatPtr pFormat;
+ int nformat;
+ int ndepth;
+ int nvisual;
+ int rlength;
+ int s;
+ int numScreens;
+ int numSubpixel;
+
/* REQUEST(xRenderQueryPictFormatsReq); */
REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq);
#ifdef PANORAMIX
if (noPanoramiXExtension)
- numScreens = screenInfo.numScreens;
- else
- numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
#else
numScreens = screenInfo.numScreens;
#endif
ndepth = nformat = nvisual = 0;
- for (s = 0; s < numScreens; s++)
- {
- pScreen = screenInfo.screens[s];
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pDepth = pScreen->allowedDepths + d;
- ++ndepth;
-
- for (v = 0; v < pDepth->numVids; v++)
- {
- pVisual = findVisual (pScreen, pDepth->vids[v]);
- if (pVisual && PictureMatchVisual (pScreen, pDepth->depth, pVisual))
- ++nvisual;
- }
- }
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- nformat += ps->nformats;
+ for (s = 0; s < numScreens; s++) {
+ pScreen = screenInfo.screens[s];
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pDepth = pScreen->allowedDepths + d;
+ ++ndepth;
+
+ for (v = 0; v < pDepth->numVids; v++) {
+ pVisual = findVisual(pScreen, pDepth->vids[v]);
+ if (pVisual &&
+ PictureMatchVisual(pScreen, pDepth->depth, pVisual))
+ ++nvisual;
+ }
+ }
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ nformat += ps->nformats;
}
if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6)
- numSubpixel = 0;
+ numSubpixel = 0;
else
- numSubpixel = numScreens;
-
- rlength = (sizeof (xRenderQueryPictFormatsReply) +
- nformat * sizeof (xPictFormInfo) +
- numScreens * sizeof (xPictScreen) +
- ndepth * sizeof (xPictDepth) +
- nvisual * sizeof (xPictVisual) +
- numSubpixel * sizeof (CARD32));
+ numSubpixel = numScreens;
+
+ rlength = (sizeof(xRenderQueryPictFormatsReply) +
+ nformat * sizeof(xPictFormInfo) +
+ numScreens * sizeof(xPictScreen) +
+ ndepth * sizeof(xPictDepth) +
+ nvisual * sizeof(xPictVisual) + numSubpixel * sizeof(CARD32));
reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
@@ -396,130 +389,116 @@ ProcRenderQueryPictFormats (ClientPtr client)
reply->numDepths = ndepth;
reply->numVisuals = nvisual;
reply->numSubpixel = numSubpixel;
-
+
pictForm = (xPictFormInfo *) (reply + 1);
-
- for (s = 0; s < numScreens; s++)
- {
- pScreen = screenInfo.screens[s];
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- {
- for (nformat = 0, pFormat = ps->formats;
- nformat < ps->nformats;
- nformat++, pFormat++)
- {
- pictForm->id = pFormat->id;
- pictForm->type = pFormat->type;
- pictForm->depth = pFormat->depth;
- pictForm->direct.red = pFormat->direct.red;
- pictForm->direct.redMask = pFormat->direct.redMask;
- pictForm->direct.green = pFormat->direct.green;
- pictForm->direct.greenMask = pFormat->direct.greenMask;
- pictForm->direct.blue = pFormat->direct.blue;
- pictForm->direct.blueMask = pFormat->direct.blueMask;
- pictForm->direct.alpha = pFormat->direct.alpha;
- pictForm->direct.alphaMask = pFormat->direct.alphaMask;
- if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap)
- pictForm->colormap = pFormat->index.pColormap->mid;
- else
- pictForm->colormap = None;
- if (client->swapped)
- {
- 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++;
- }
- }
- }
-
+
+ for (s = 0; s < numScreens; s++) {
+ pScreen = screenInfo.screens[s];
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps) {
+ for (nformat = 0, pFormat = ps->formats;
+ nformat < ps->nformats; nformat++, pFormat++) {
+ pictForm->id = pFormat->id;
+ pictForm->type = pFormat->type;
+ pictForm->depth = pFormat->depth;
+ pictForm->direct.red = pFormat->direct.red;
+ pictForm->direct.redMask = pFormat->direct.redMask;
+ pictForm->direct.green = pFormat->direct.green;
+ pictForm->direct.greenMask = pFormat->direct.greenMask;
+ pictForm->direct.blue = pFormat->direct.blue;
+ pictForm->direct.blueMask = pFormat->direct.blueMask;
+ pictForm->direct.alpha = pFormat->direct.alpha;
+ pictForm->direct.alphaMask = pFormat->direct.alphaMask;
+ if (pFormat->type == PictTypeIndexed &&
+ pFormat->index.pColormap)
+ pictForm->colormap = pFormat->index.pColormap->mid;
+ else
+ pictForm->colormap = None;
+ if (client->swapped) {
+ 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++;
+ }
+ }
+ }
+
pictScreen = (xPictScreen *) pictForm;
- for (s = 0; s < numScreens; s++)
- {
- pScreen = screenInfo.screens[s];
- pictDepth = (xPictDepth *) (pictScreen + 1);
- ndepth = 0;
- for (d = 0; d < pScreen->numDepths; d++)
- {
- pictVisual = (xPictVisual *) (pictDepth + 1);
- pDepth = pScreen->allowedDepths + d;
-
- nvisual = 0;
- for (v = 0; v < pDepth->numVids; v++)
- {
- pVisual = findVisual (pScreen, pDepth->vids[v]);
- if (pVisual && (pFormat = PictureMatchVisual (pScreen,
- pDepth->depth,
- pVisual)))
- {
- pictVisual->visual = pVisual->vid;
- pictVisual->format = pFormat->id;
- if (client->swapped)
- {
- swapl(&pictVisual->visual);
- swapl(&pictVisual->format);
- }
- pictVisual++;
- nvisual++;
- }
- }
- pictDepth->depth = pDepth->depth;
- pictDepth->nPictVisuals = nvisual;
- if (client->swapped)
- {
- swaps(&pictDepth->nPictVisuals);
- }
- ndepth++;
- pictDepth = (xPictDepth *) pictVisual;
- }
- pictScreen->nDepth = ndepth;
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- pictScreen->fallback = ps->fallback->id;
- else
- pictScreen->fallback = 0;
- if (client->swapped)
- {
- swapl(&pictScreen->nDepth);
- swapl(&pictScreen->fallback);
- }
- pictScreen = (xPictScreen *) pictDepth;
+ for (s = 0; s < numScreens; s++) {
+ pScreen = screenInfo.screens[s];
+ pictDepth = (xPictDepth *) (pictScreen + 1);
+ ndepth = 0;
+ for (d = 0; d < pScreen->numDepths; d++) {
+ pictVisual = (xPictVisual *) (pictDepth + 1);
+ pDepth = pScreen->allowedDepths + d;
+
+ nvisual = 0;
+ for (v = 0; v < pDepth->numVids; v++) {
+ pVisual = findVisual(pScreen, pDepth->vids[v]);
+ if (pVisual && (pFormat = PictureMatchVisual(pScreen,
+ pDepth->depth,
+ pVisual))) {
+ pictVisual->visual = pVisual->vid;
+ pictVisual->format = pFormat->id;
+ if (client->swapped) {
+ swapl(&pictVisual->visual);
+ swapl(&pictVisual->format);
+ }
+ pictVisual++;
+ nvisual++;
+ }
+ }
+ pictDepth->depth = pDepth->depth;
+ pictDepth->nPictVisuals = nvisual;
+ if (client->swapped) {
+ swaps(&pictDepth->nPictVisuals);
+ }
+ ndepth++;
+ pictDepth = (xPictDepth *) pictVisual;
+ }
+ pictScreen->nDepth = ndepth;
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ pictScreen->fallback = ps->fallback->id;
+ else
+ pictScreen->fallback = 0;
+ if (client->swapped) {
+ swapl(&pictScreen->nDepth);
+ swapl(&pictScreen->fallback);
+ }
+ pictScreen = (xPictScreen *) pictDepth;
}
pictSubpixel = (CARD32 *) pictScreen;
-
- for (s = 0; s < numSubpixel; s++)
- {
- pScreen = screenInfo.screens[s];
- ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- *pictSubpixel = ps->subpixel;
- else
- *pictSubpixel = SubPixelUnknown;
- if (client->swapped)
- {
- swapl(pictSubpixel);
- }
- ++pictSubpixel;
- }
-
- if (client->swapped)
- {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapl(&reply->numFormats);
- swapl(&reply->numScreens);
- swapl(&reply->numDepths);
- swapl(&reply->numVisuals);
- swapl(&reply->numSubpixel);
+
+ for (s = 0; s < numSubpixel; s++) {
+ pScreen = screenInfo.screens[s];
+ ps = GetPictureScreenIfSet(pScreen);
+ if (ps)
+ *pictSubpixel = ps->subpixel;
+ else
+ *pictSubpixel = SubPixelUnknown;
+ if (client->swapped) {
+ swapl(pictSubpixel);
+ }
+ ++pictSubpixel;
+ }
+
+ if (client->swapped) {
+ 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);
@@ -527,34 +506,34 @@ ProcRenderQueryPictFormats (ClientPtr client)
}
static int
-ProcRenderQueryPictIndexValues (ClientPtr client)
+ProcRenderQueryPictIndexValues(ClientPtr client)
{
- PictFormatPtr pFormat;
- int rc, num;
- int rlength;
- int i;
+ PictFormatPtr pFormat;
+ int rc, num;
+ int rlength;
+ int i;
+
REQUEST(xRenderQueryPictIndexValuesReq);
xRenderQueryPictIndexValuesReply *reply;
- xIndexValue *values;
+ xIndexValue *values;
REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq);
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
- PictFormatType, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format,
+ PictFormatType, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
- if (pFormat->type != PictTypeIndexed)
- {
- client->errorValue = stuff->format;
- return BadMatch;
+ if (pFormat->type != PictTypeIndexed) {
+ client->errorValue = stuff->format;
+ return BadMatch;
}
num = pFormat->index.nvalues;
- rlength = (sizeof (xRenderQueryPictIndexValuesReply) +
- num * sizeof(xIndexValue));
+ rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
+ num * sizeof(xIndexValue));
reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
@@ -562,22 +541,20 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
reply->numIndexValues = num;
values = (xIndexValue *) (reply + 1);
-
- memcpy (reply + 1, pFormat->index.pValues, num * sizeof (xIndexValue));
-
- if (client->swapped)
- {
- for (i = 0; i < num; i++)
- {
- swapl(&values[i].pixel);
- swaps(&values[i].red);
- swaps(&values[i].green);
- swaps(&values[i].blue);
- swaps(&values[i].alpha);
- }
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapl(&reply->numIndexValues);
+
+ memcpy(reply + 1, pFormat->index.pValues, num * sizeof(xIndexValue));
+
+ if (client->swapped) {
+ for (i = 0; i < num; i++) {
+ swapl(&values[i].pixel);
+ swaps(&values[i].red);
+ swaps(&values[i].green);
+ swaps(&values[i].blue);
+ swaps(&values[i].alpha);
+ }
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapl(&reply->numIndexValues);
}
WriteToClient(client, rlength, (char *) reply);
@@ -586,409 +563,411 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
}
static int
-ProcRenderQueryDithers (ClientPtr client)
+ProcRenderQueryDithers(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderCreatePicture (ClientPtr client)
+ProcRenderCreatePicture(ClientPtr client)
{
- PicturePtr pPicture;
- DrawablePtr pDrawable;
- PictFormatPtr pFormat;
- int len, error, rc;
+ PicturePtr pPicture;
+ DrawablePtr pDrawable;
+ PictFormatPtr pFormat;
+ int len, error, rc;
+
REQUEST(xRenderCreatePictureReq);
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess|DixAddAccess);
+ DixReadAccess | DixAddAccess);
if (rc != Success)
- return rc;
+ return rc;
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
- PictFormatType, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format,
+ PictFormatType, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
if (pFormat->depth != pDrawable->depth)
- return BadMatch;
+ return BadMatch;
len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq));
if (Ones(stuff->mask) != len)
- return BadLength;
-
- pPicture = CreatePicture (stuff->pid,
- pDrawable,
- pFormat,
- stuff->mask,
- (XID *) (stuff + 1),
- client,
- &error);
+ return BadLength;
+
+ pPicture = CreatePicture(stuff->pid,
+ pDrawable,
+ pFormat,
+ stuff->mask, (XID *) (stuff + 1), client, &error);
if (!pPicture)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
static int
-ProcRenderChangePicture (ClientPtr client)
+ProcRenderChangePicture(ClientPtr client)
{
- PicturePtr pPicture;
+ PicturePtr pPicture;
+
REQUEST(xRenderChangePictureReq);
int len;
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
if (Ones(stuff->mask) != len)
- return BadLength;
-
- return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1),
- (DevUnion *) 0, client);
+ return BadLength;
+
+ return ChangePicture(pPicture, stuff->mask, (XID *) (stuff + 1),
+ (DevUnion *) 0, client);
}
static int
-ProcRenderSetPictureClipRectangles (ClientPtr client)
+ProcRenderSetPictureClipRectangles(ClientPtr client)
{
REQUEST(xRenderSetPictureClipRectanglesReq);
- PicturePtr pPicture;
- int nr;
+ PicturePtr pPicture;
+ int nr;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
if (!pPicture->pDrawable)
return BadDrawable;
nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
if (nr & 4)
- return BadLength;
+ return BadLength;
nr >>= 3;
- return SetPictureClipRects (pPicture,
- stuff->xOrigin, stuff->yOrigin,
- nr, (xRectangle *) &stuff[1]);
+ return SetPictureClipRects(pPicture,
+ stuff->xOrigin, stuff->yOrigin,
+ nr, (xRectangle *) &stuff[1]);
}
static int
-ProcRenderFreePicture (ClientPtr client)
+ProcRenderFreePicture(ClientPtr client)
{
- PicturePtr pPicture;
+ PicturePtr pPicture;
+
REQUEST(xRenderFreePictureReq);
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess);
- FreeResource (stuff->picture, RT_NONE);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess);
+ FreeResource(stuff->picture, RT_NONE);
return Success;
}
static Bool
-PictOpValid (CARD8 op)
+PictOpValid(CARD8 op)
{
- if (/*PictOpMinimum <= op && */ op <= PictOpMaximum)
- return TRUE;
+ if ( /*PictOpMinimum <= op && */ op <= PictOpMaximum)
+ return TRUE;
if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum)
- return TRUE;
+ return TRUE;
if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum)
- return TRUE;
+ return TRUE;
if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum)
- return TRUE;
+ return TRUE;
return FALSE;
}
static int
-ProcRenderComposite (ClientPtr client)
+ProcRenderComposite(ClientPtr client)
{
- PicturePtr pSrc, pMask, pDst;
+ PicturePtr pSrc, pMask, pDst;
+
REQUEST(xRenderCompositeReq);
REQUEST_SIZE_MATCH(xRenderCompositeReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess);
- if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
- (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
- return BadMatch;
- CompositePicture (stuff->op,
- pSrc,
- pMask,
- pDst,
- stuff->xSrc,
- stuff->ySrc,
- stuff->xMask,
- stuff->yMask,
- stuff->xDst,
- stuff->yDst,
- stuff->width,
- stuff->height);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_ALPHA(pMask, stuff->mask, client, DixReadAccess);
+ if ((pSrc->pDrawable &&
+ pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask &&
+ pMask->
+ pDrawable &&
+ pDst->
+ pDrawable->
+ pScreen !=
+ pMask->
+ pDrawable->
+ pScreen))
+ return BadMatch;
+ CompositePicture(stuff->op,
+ pSrc,
+ pMask,
+ pDst,
+ stuff->xSrc,
+ stuff->ySrc,
+ stuff->xMask,
+ stuff->yMask,
+ stuff->xDst, stuff->yDst, stuff->width, stuff->height);
return Success;
}
static int
-ProcRenderScale (ClientPtr client)
+ProcRenderScale(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderTrapezoids (ClientPtr client)
+ProcRenderTrapezoids(ClientPtr client)
{
- int rc, ntraps;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, ntraps;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrapezoidsReq);
REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- ntraps = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
- if (ntraps % sizeof (xTrapezoid))
- return BadLength;
- ntraps /= sizeof (xTrapezoid);
+ pFormat = 0;
+ ntraps = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
+ if (ntraps % sizeof(xTrapezoid))
+ return BadLength;
+ ntraps /= sizeof(xTrapezoid);
if (ntraps)
- CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- ntraps, (xTrapezoid *) &stuff[1]);
+ CompositeTrapezoids(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ ntraps, (xTrapezoid *) &stuff[1]);
return Success;
}
static int
-ProcRenderTriangles (ClientPtr client)
+ProcRenderTriangles(ClientPtr client)
{
- int rc, ntris;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, ntris;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- ntris = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
- if (ntris % sizeof (xTriangle))
- return BadLength;
- ntris /= sizeof (xTriangle);
+ pFormat = 0;
+ ntris = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
+ if (ntris % sizeof(xTriangle))
+ return BadLength;
+ ntris /= sizeof(xTriangle);
if (ntris)
- CompositeTriangles (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- ntris, (xTriangle *) &stuff[1]);
+ CompositeTriangles(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ ntris, (xTriangle *) &stuff[1]);
return Success;
}
static int
-ProcRenderTriStrip (ClientPtr client)
+ProcRenderTriStrip(ClientPtr client)
{
- int rc, npoints;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, npoints;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq));
+ pFormat = 0;
+ npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
if (npoints & 4)
- return BadLength;
+ return BadLength;
npoints >>= 3;
if (npoints >= 3)
- CompositeTriStrip (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- npoints, (xPointFixed *) &stuff[1]);
+ CompositeTriStrip(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ npoints, (xPointFixed *) &stuff[1]);
return Success;
}
static int
-ProcRenderTriFan (ClientPtr client)
+ProcRenderTriFan(ClientPtr client)
{
- int rc, npoints;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
+ int rc, npoints;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
}
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
- npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq));
+ pFormat = 0;
+ npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
if (npoints & 4)
- return BadLength;
+ return BadLength;
npoints >>= 3;
if (npoints >= 3)
- CompositeTriFan (stuff->op, pSrc, pDst, pFormat,
- stuff->xSrc, stuff->ySrc,
- npoints, (xPointFixed *) &stuff[1]);
+ CompositeTriFan(stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ npoints, (xPointFixed *) &stuff[1]);
return Success;
}
static int
-ProcRenderColorTrapezoids (ClientPtr client)
+ProcRenderColorTrapezoids(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderColorTriangles (ClientPtr client)
+ProcRenderColorTriangles(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderTransform (ClientPtr client)
+ProcRenderTransform(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderCreateGlyphSet (ClientPtr client)
+ProcRenderCreateGlyphSet(ClientPtr client)
{
- GlyphSetPtr glyphSet;
- PictFormatPtr format;
- int rc, f;
+ GlyphSetPtr glyphSet;
+ PictFormatPtr format;
+ int rc, f;
+
REQUEST(xRenderCreateGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
LEGAL_NEW_RESOURCE(stuff->gsid, client);
- rc = dixLookupResourceByType((pointer *)&format, stuff->format,
- PictFormatType, client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &format, stuff->format,
+ PictFormatType, client, DixReadAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (format->depth) {
case 1:
- f = GlyphFormat1;
- break;
+ f = GlyphFormat1;
+ break;
case 4:
- f = GlyphFormat4;
- break;
+ f = GlyphFormat4;
+ break;
case 8:
- f = GlyphFormat8;
- break;
+ f = GlyphFormat8;
+ break;
case 16:
- f = GlyphFormat16;
- break;
+ f = GlyphFormat16;
+ break;
case 32:
- f = GlyphFormat32;
- break;
+ f = GlyphFormat32;
+ break;
default:
- return BadMatch;
+ return BadMatch;
}
if (format->type != PictTypeDirect)
- return BadMatch;
- glyphSet = AllocateGlyphSet (f, format);
+ return BadMatch;
+ glyphSet = AllocateGlyphSet(f, format);
if (!glyphSet)
- return BadAlloc;
+ return BadAlloc;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType,
- glyphSet, RT_NONE, NULL, DixCreateAccess);
+ glyphSet, RT_NONE, NULL, DixCreateAccess);
if (rc != Success)
- return rc;
- if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
- return BadAlloc;
+ return rc;
+ if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet))
+ return BadAlloc;
return Success;
}
static int
-ProcRenderReferenceGlyphSet (ClientPtr client)
+ProcRenderReferenceGlyphSet(ClientPtr client)
{
- GlyphSetPtr glyphSet;
+ GlyphSetPtr glyphSet;
int rc;
+
REQUEST(xRenderReferenceGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq);
LEGAL_NEW_RESOURCE(stuff->gsid, client);
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->existing, GlyphSetType,
- client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->existing;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->existing,
+ GlyphSetType, client, DixGetAttrAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->existing;
+ return rc;
}
glyphSet->refcnt++;
- if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
- return BadAlloc;
+ if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet))
+ return BadAlloc;
return Success;
}
@@ -996,616 +975,576 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
#define NLOCALGLYPH 256
static int
-ProcRenderFreeGlyphSet (ClientPtr client)
+ProcRenderFreeGlyphSet(ClientPtr client)
{
- GlyphSetPtr glyphSet;
+ GlyphSetPtr glyphSet;
int rc;
+
REQUEST(xRenderFreeGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
- client, DixDestroyAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->glyphset;
- return rc;
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixDestroyAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->glyphset;
+ return rc;
}
- FreeResource (stuff->glyphset, RT_NONE);
+ FreeResource(stuff->glyphset, RT_NONE);
return Success;
}
typedef struct _GlyphNew {
- Glyph id;
- GlyphPtr glyph;
- Bool found;
- unsigned char sha1[20];
+ Glyph id;
+ GlyphPtr glyph;
+ Bool found;
+ unsigned char sha1[20];
} GlyphNewRec, *GlyphNewPtr;
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
static int
-ProcRenderAddGlyphs (ClientPtr client)
+ProcRenderAddGlyphs(ClientPtr client)
{
- GlyphSetPtr glyphSet;
+ GlyphSetPtr glyphSet;
+
REQUEST(xRenderAddGlyphsReq);
- GlyphNewRec glyphsLocal[NLOCALGLYPH];
- GlyphNewPtr glyphsBase, glyphs, glyph_new;
- int remain, nglyphs;
- CARD32 *gids;
- xGlyphInfo *gi;
- CARD8 *bits;
- unsigned int size;
- int err;
- int i, screen;
- PicturePtr pSrc = NULL, pDst = NULL;
- PixmapPtr pSrcPix = NULL, pDstPix = NULL;
- CARD32 component_alpha;
+ GlyphNewRec glyphsLocal[NLOCALGLYPH];
+ GlyphNewPtr glyphsBase, glyphs, glyph_new;
+ int remain, nglyphs;
+ CARD32 *gids;
+ xGlyphInfo *gi;
+ CARD8 *bits;
+ unsigned int size;
+ int err;
+ int i, screen;
+ PicturePtr pSrc = NULL, pDst = NULL;
+ PixmapPtr pSrcPix = NULL, pDstPix = NULL;
+ CARD32 component_alpha;
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
- err = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
- client, DixAddAccess);
- if (err != Success)
- {
- client->errorValue = stuff->glyphset;
- return err;
+ err =
+ dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixAddAccess);
+ if (err != Success) {
+ client->errorValue = stuff->glyphset;
+ return err;
}
err = BadAlloc;
nglyphs = stuff->nglyphs;
if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec))
- return BadAlloc;
+ return BadAlloc;
- component_alpha = NeedsComponent (glyphSet->format->format);
+ component_alpha = NeedsComponent(glyphSet->format->format);
if (nglyphs <= NLOCALGLYPH) {
- memset (glyphsLocal, 0, sizeof (glyphsLocal));
- glyphsBase = glyphsLocal;
+ memset(glyphsLocal, 0, sizeof(glyphsLocal));
+ glyphsBase = glyphsLocal;
}
- else
- {
- glyphsBase = (GlyphNewPtr)calloc(nglyphs, sizeof (GlyphNewRec));
- if (!glyphsBase)
- return BadAlloc;
+ else {
+ glyphsBase = (GlyphNewPtr) calloc(nglyphs, sizeof(GlyphNewRec));
+ if (!glyphsBase)
+ return BadAlloc;
}
- remain = (client->req_len << 2) - sizeof (xRenderAddGlyphsReq);
+ remain = (client->req_len << 2) - sizeof(xRenderAddGlyphsReq);
glyphs = glyphsBase;
gids = (CARD32 *) (stuff + 1);
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
- remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+ remain -= (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs;
/* protect against bad nglyphs */
- if (gi < ((xGlyphInfo *)stuff) ||
- gi > ((xGlyphInfo *)((CARD32 *)stuff + client->req_len)) ||
- bits < ((CARD8 *)stuff) ||
- bits > ((CARD8 *)((CARD32 *)stuff + client->req_len))) {
+ if (gi < ((xGlyphInfo *) stuff) ||
+ gi > ((xGlyphInfo *) ((CARD32 *) stuff + client->req_len)) ||
+ bits < ((CARD8 *) stuff) ||
+ bits > ((CARD8 *) ((CARD32 *) stuff + client->req_len))) {
err = BadLength;
goto bail;
}
- for (i = 0; i < nglyphs; i++)
- {
- size_t padded_width;
- glyph_new = &glyphs[i];
-
- padded_width = PixmapBytePad (gi[i].width,
- glyphSet->format->depth);
-
- if (gi[i].height && padded_width > (UINT32_MAX - sizeof(GlyphRec))/gi[i].height)
- break;
-
- size = gi[i].height * padded_width;
- if (remain < size)
- break;
-
- err = HashGlyph (&gi[i], bits, size, glyph_new->sha1);
- if (err)
- goto bail;
-
- glyph_new->glyph = FindGlyphByHash (glyph_new->sha1,
- glyphSet->fdepth);
-
- if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph)
- {
- glyph_new->found = TRUE;
- }
- else
- {
- GlyphPtr glyph;
-
- glyph_new->found = FALSE;
- glyph_new->glyph = glyph = AllocateGlyph (&gi[i], glyphSet->fdepth);
- if (! glyph)
- {
- err = BadAlloc;
- goto bail;
- }
-
- for (screen = 0; screen < screenInfo.numScreens; screen++)
- {
- int width = gi[i].width;
- int height = gi[i].height;
- int depth = glyphSet->format->depth;
- ScreenPtr pScreen;
- int error;
-
- /* Skip work if it's invisibly small anyway */
- if (!width || !height)
- break;
-
- pScreen = screenInfo.screens[screen];
- pSrcPix = GetScratchPixmapHeader (pScreen,
- width, height,
- depth, depth,
- -1, bits);
- if (! pSrcPix)
- {
- err = BadAlloc;
- goto bail;
- }
-
- pSrc = CreatePicture (0, &pSrcPix->drawable,
- glyphSet->format, 0, NULL,
- serverClient, &error);
- if (! pSrc)
- {
- err = BadAlloc;
- goto bail;
- }
-
- pDstPix = (pScreen->CreatePixmap) (pScreen,
- width, height, depth,
- CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
-
- if (!pDstPix)
- {
- err = BadAlloc;
- goto bail;
- }
-
- GlyphPicture (glyph)[screen] = pDst =
- CreatePicture (0, &pDstPix->drawable,
- glyphSet->format,
- CPComponentAlpha, &component_alpha,
- serverClient, &error);
-
- /* The picture takes a reference to the pixmap, so we
- drop ours. */
- (pScreen->DestroyPixmap) (pDstPix);
- pDstPix = NULL;
-
- if (! pDst)
- {
- err = BadAlloc;
- goto bail;
- }
-
- CompositePicture (PictOpSrc,
- pSrc,
- None,
- pDst,
- 0, 0,
- 0, 0,
- 0, 0,
- width, height);
-
- FreePicture ((pointer) pSrc, 0);
- pSrc = NULL;
- FreeScratchPixmapHeader (pSrcPix);
- pSrcPix = NULL;
- }
-
- memcpy (glyph_new->glyph->sha1, glyph_new->sha1, 20);
- }
-
- glyph_new->id = gids[i];
-
- if (size & 3)
- size += 4 - (size & 3);
- bits += size;
- remain -= size;
- }
- if (remain || i < nglyphs)
- {
- err = BadLength;
- goto bail;
- }
- if (!ResizeGlyphSet (glyphSet, nglyphs))
- {
- err = BadAlloc;
- goto bail;
+ for (i = 0; i < nglyphs; i++) {
+ size_t padded_width;
+
+ glyph_new = &glyphs[i];
+
+ padded_width = PixmapBytePad(gi[i].width, glyphSet->format->depth);
+
+ if (gi[i].height &&
+ padded_width > (UINT32_MAX - sizeof(GlyphRec)) / gi[i].height)
+ break;
+
+ size = gi[i].height * padded_width;
+ if (remain < size)
+ break;
+
+ err = HashGlyph(&gi[i], bits, size, glyph_new->sha1);
+ if (err)
+ goto bail;
+
+ glyph_new->glyph = FindGlyphByHash(glyph_new->sha1, glyphSet->fdepth);
+
+ if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph) {
+ glyph_new->found = TRUE;
+ }
+ else {
+ GlyphPtr glyph;
+
+ glyph_new->found = FALSE;
+ glyph_new->glyph = glyph = AllocateGlyph(&gi[i], glyphSet->fdepth);
+ if (!glyph) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ for (screen = 0; screen < screenInfo.numScreens; screen++) {
+ int width = gi[i].width;
+ int height = gi[i].height;
+ int depth = glyphSet->format->depth;
+ ScreenPtr pScreen;
+ int error;
+
+ /* Skip work if it's invisibly small anyway */
+ if (!width || !height)
+ break;
+
+ pScreen = screenInfo.screens[screen];
+ pSrcPix = GetScratchPixmapHeader(pScreen,
+ width, height,
+ depth, depth, -1, bits);
+ if (!pSrcPix) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ pSrc = CreatePicture(0, &pSrcPix->drawable,
+ glyphSet->format, 0, NULL,
+ serverClient, &error);
+ if (!pSrc) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ pDstPix = (pScreen->CreatePixmap) (pScreen,
+ width, height, depth,
+ CREATE_PIXMAP_USAGE_GLYPH_PICTURE);
+
+ if (!pDstPix) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ GlyphPicture(glyph)[screen] = pDst =
+ CreatePicture(0, &pDstPix->drawable,
+ glyphSet->format,
+ CPComponentAlpha, &component_alpha,
+ serverClient, &error);
+
+ /* The picture takes a reference to the pixmap, so we
+ drop ours. */
+ (pScreen->DestroyPixmap) (pDstPix);
+ pDstPix = NULL;
+
+ if (!pDst) {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ CompositePicture(PictOpSrc,
+ pSrc,
+ None, pDst, 0, 0, 0, 0, 0, 0, width, height);
+
+ FreePicture((pointer) pSrc, 0);
+ pSrc = NULL;
+ FreeScratchPixmapHeader(pSrcPix);
+ pSrcPix = NULL;
+ }
+
+ memcpy(glyph_new->glyph->sha1, glyph_new->sha1, 20);
+ }
+
+ glyph_new->id = gids[i];
+
+ if (size & 3)
+ size += 4 - (size & 3);
+ bits += size;
+ remain -= size;
+ }
+ if (remain || i < nglyphs) {
+ err = BadLength;
+ goto bail;
+ }
+ if (!ResizeGlyphSet(glyphSet, nglyphs)) {
+ err = BadAlloc;
+ goto bail;
}
for (i = 0; i < nglyphs; i++)
- AddGlyph (glyphSet, glyphs[i].glyph, glyphs[i].id);
+ AddGlyph(glyphSet, glyphs[i].glyph, glyphs[i].id);
if (glyphsBase != glyphsLocal)
- free(glyphsBase);
+ free(glyphsBase);
return Success;
-bail:
+ bail:
if (pSrc)
- FreePicture ((pointer) pSrc, 0);
+ FreePicture((pointer) pSrc, 0);
if (pSrcPix)
- FreeScratchPixmapHeader (pSrcPix);
+ FreeScratchPixmapHeader(pSrcPix);
for (i = 0; i < nglyphs; i++)
- if (glyphs[i].glyph && ! glyphs[i].found)
- free(glyphs[i].glyph);
+ if (glyphs[i].glyph && !glyphs[i].found)
+ free(glyphs[i].glyph);
if (glyphsBase != glyphsLocal)
- free(glyphsBase);
+ free(glyphsBase);
return err;
}
static int
-ProcRenderAddGlyphsFromPicture (ClientPtr client)
+ProcRenderAddGlyphsFromPicture(ClientPtr client)
{
return BadImplementation;
}
static int
-ProcRenderFreeGlyphs (ClientPtr client)
+ProcRenderFreeGlyphs(ClientPtr client)
{
REQUEST(xRenderFreeGlyphsReq);
- GlyphSetPtr glyphSet;
- int rc, nglyph;
- CARD32 *gids;
- CARD32 glyph;
+ GlyphSetPtr glyphSet;
+ int rc, nglyph;
+ CARD32 *gids;
+ CARD32 glyph;
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
- client, DixRemoveAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->glyphset;
- return rc;
- }
- nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq));
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixRemoveAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->glyphset;
+ return rc;
+ }
+ nglyph =
+ bytes_to_int32((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq));
gids = (CARD32 *) (stuff + 1);
- while (nglyph-- > 0)
- {
- glyph = *gids++;
- if (!DeleteGlyph (glyphSet, glyph))
- {
- client->errorValue = glyph;
- return RenderErrBase + BadGlyph;
- }
+ while (nglyph-- > 0) {
+ glyph = *gids++;
+ if (!DeleteGlyph(glyphSet, glyph)) {
+ client->errorValue = glyph;
+ return RenderErrBase + BadGlyph;
+ }
}
return Success;
}
static int
-ProcRenderCompositeGlyphs (ClientPtr client)
-{
- GlyphSetPtr glyphSet;
- GlyphSet gs;
- PicturePtr pSrc, pDst;
- PictFormatPtr pFormat;
- GlyphListRec listsLocal[NLOCALDELTA];
- GlyphListPtr lists, listsBase;
- GlyphPtr glyphsLocal[NLOCALGLYPH];
- Glyph glyph;
- GlyphPtr *glyphs, *glyphsBase;
- xGlyphElt *elt;
- CARD8 *buffer, *end;
- int nglyph;
- int nlist;
- int space;
- int size;
- int rc, n;
-
+ProcRenderCompositeGlyphs(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+ GlyphSet gs;
+ PicturePtr pSrc, pDst;
+ PictFormatPtr pFormat;
+ GlyphListRec listsLocal[NLOCALDELTA];
+ GlyphListPtr lists, listsBase;
+ GlyphPtr glyphsLocal[NLOCALGLYPH];
+ Glyph glyph;
+ GlyphPtr *glyphs, *glyphsBase;
+ xGlyphElt *elt;
+ CARD8 *buffer, *end;
+ int nglyph;
+ int nlist;
+ int space;
+ int size;
+ int rc, n;
+
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;
- }
-
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
- }
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+ default:
+ size = 1;
+ break;
+ case X_RenderCompositeGlyphs16:
+ size = 2;
+ break;
+ case X_RenderCompositeGlyphs32:
+ size = 4;
+ break;
+ }
+
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
+ }
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
- return BadMatch;
- if (stuff->maskFormat)
- {
- rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
- PictFormatType, client, DixReadAccess);
- if (rc != Success)
- return rc;
+ return BadMatch;
+ if (stuff->maskFormat) {
+ rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+ PictFormatType, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
- pFormat = 0;
+ pFormat = 0;
- rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset,
- GlyphSetType, client, DixUseAccess);
+ rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+ GlyphSetType, client, DixUseAccess);
if (rc != Success)
- return rc;
+ return rc;
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
nglyph = 0;
nlist = 0;
- while (buffer + sizeof (xGlyphElt) < end)
- {
- elt = (xGlyphElt *) buffer;
- buffer += sizeof (xGlyphElt);
-
- if (elt->len == 0xff)
- {
- buffer += 4;
- }
- else
- {
- nlist++;
- nglyph += elt->len;
- space = size * elt->len;
- if (space & 3)
- space += 4 - (space & 3);
- buffer += space;
- }
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ buffer += 4;
+ }
+ else {
+ nlist++;
+ nglyph += elt->len;
+ space = size * elt->len;
+ if (space & 3)
+ space += 4 - (space & 3);
+ buffer += space;
+ }
}
if (nglyph <= NLOCALGLYPH)
- glyphsBase = glyphsLocal;
- else
- {
- glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof (GlyphPtr));
- if (!glyphsBase)
- return BadAlloc;
+ glyphsBase = glyphsLocal;
+ else {
+ glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof(GlyphPtr));
+ if (!glyphsBase)
+ return BadAlloc;
}
if (nlist <= NLOCALDELTA)
- listsBase = listsLocal;
- else
- {
- listsBase = (GlyphListPtr) malloc(nlist * sizeof (GlyphListRec));
- if (!listsBase) {
- rc = BadAlloc;
- goto bail;
- }
+ listsBase = listsLocal;
+ else {
+ listsBase = (GlyphListPtr) malloc(nlist * sizeof(GlyphListRec));
+ if (!listsBase) {
+ rc = BadAlloc;
+ goto bail;
+ }
}
buffer = (CARD8 *) (stuff + 1);
glyphs = glyphsBase;
lists = listsBase;
- while (buffer + sizeof (xGlyphElt) < end)
- {
- elt = (xGlyphElt *) buffer;
- buffer += sizeof (xGlyphElt);
-
- if (elt->len == 0xff)
- {
- if (buffer + sizeof (GlyphSet) < end)
- {
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ if (buffer + sizeof(GlyphSet) < end) {
memcpy(&gs, buffer, sizeof(GlyphSet));
- rc = dixLookupResourceByType((pointer *)&glyphSet, gs,
- GlyphSetType, client,
- DixUseAccess);
- if (rc != Success)
- goto bail;
- }
- buffer += 4;
- }
- else
- {
- lists->xOff = elt->deltax;
- lists->yOff = elt->deltay;
- lists->format = glyphSet->format;
- lists->len = 0;
- n = elt->len;
- while (n--)
- {
- if (buffer + size <= end)
- {
- switch (size) {
- case 1:
- glyph = *((CARD8 *)buffer); break;
- case 2:
- glyph = *((CARD16 *)buffer); break;
- case 4:
- default:
- glyph = *((CARD32 *)buffer); break;
- }
- if ((*glyphs = FindGlyph (glyphSet, glyph)))
- {
- lists->len++;
- glyphs++;
- }
- }
- buffer += size;
- }
- space = size * elt->len;
- if (space & 3)
- buffer += 4 - (space & 3);
- lists++;
- }
+ rc = dixLookupResourceByType((pointer *) &glyphSet, gs,
+ GlyphSetType, client,
+ DixUseAccess);
+ if (rc != Success)
+ goto bail;
+ }
+ buffer += 4;
+ }
+ else {
+ lists->xOff = elt->deltax;
+ lists->yOff = elt->deltay;
+ lists->format = glyphSet->format;
+ lists->len = 0;
+ n = elt->len;
+ while (n--) {
+ if (buffer + size <= end) {
+ switch (size) {
+ case 1:
+ glyph = *((CARD8 *) buffer);
+ break;
+ case 2:
+ glyph = *((CARD16 *) buffer);
+ break;
+ case 4:
+ default:
+ glyph = *((CARD32 *) buffer);
+ break;
+ }
+ if ((*glyphs = FindGlyph(glyphSet, glyph))) {
+ lists->len++;
+ glyphs++;
+ }
+ }
+ buffer += size;
+ }
+ space = size * elt->len;
+ if (space & 3)
+ buffer += 4 - (space & 3);
+ lists++;
+ }
}
if (buffer > end) {
- rc = BadLength;
- goto bail;
- }
-
- CompositeGlyphs (stuff->op,
- pSrc,
- pDst,
- pFormat,
- stuff->xSrc,
- stuff->ySrc,
- nlist,
- listsBase,
- glyphsBase);
+ rc = BadLength;
+ goto bail;
+ }
+
+ CompositeGlyphs(stuff->op,
+ pSrc,
+ pDst,
+ pFormat,
+ stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase);
rc = Success;
-bail:
+ bail:
if (glyphsBase != glyphsLocal)
- free(glyphsBase);
+ free(glyphsBase);
if (listsBase != listsLocal)
- free(listsBase);
+ free(listsBase);
return rc;
}
static int
-ProcRenderFillRectangles (ClientPtr client)
+ProcRenderFillRectangles(ClientPtr client)
{
- PicturePtr pDst;
- int things;
+ PicturePtr pDst;
+ int things;
+
REQUEST(xRenderFillRectanglesReq);
-
- REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
- if (!PictOpValid (stuff->op))
- {
- client->errorValue = stuff->op;
- return BadValue;
- }
- VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
+
+ REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
+ if (!PictOpValid(stuff->op)) {
+ client->errorValue = stuff->op;
+ return BadValue;
+ }
+ VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
-
+
things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
if (things & 4)
- return BadLength;
+ return BadLength;
things >>= 3;
-
- CompositeRects (stuff->op,
- pDst,
- &stuff->color,
- things,
- (xRectangle *) &stuff[1]);
-
+
+ CompositeRects(stuff->op,
+ pDst, &stuff->color, things, (xRectangle *) &stuff[1]);
+
return Success;
}
static void
-RenderSetBit (unsigned char *line, int x, int bit)
+RenderSetBit(unsigned char *line, int x, int bit)
{
- unsigned char mask;
-
+ unsigned char mask;
+
if (screenInfo.bitmapBitOrder == LSBFirst)
- mask = (1 << (x & 7));
+ mask = (1 << (x & 7));
else
- mask = (0x80 >> (x & 7));
+ mask = (0x80 >> (x & 7));
/* XXX assumes byte order is host byte order */
line += (x >> 3);
if (bit)
- *line |= mask;
+ *line |= mask;
else
- *line &= ~mask;
+ *line &= ~mask;
}
#define DITHER_DIM 2
static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = {
- { 1, 3, },
- { 4, 2, },
+ {1, 3,},
+ {4, 2,},
};
#define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1)
static int
-ProcRenderCreateCursor (ClientPtr client)
+ProcRenderCreateCursor(ClientPtr client)
{
REQUEST(xRenderCreateCursorReq);
- PicturePtr pSrc;
- ScreenPtr pScreen;
- unsigned short width, height;
- CARD32 *argbbits, *argb;
- unsigned char *srcbits, *srcline;
- unsigned char *mskbits, *mskline;
- int stride;
- int x, y;
- int nbytes_mono;
+ PicturePtr pSrc;
+ ScreenPtr pScreen;
+ unsigned short width, height;
+ CARD32 *argbbits, *argb;
+ unsigned char *srcbits, *srcline;
+ unsigned char *mskbits, *mskline;
+ int stride;
+ int x, y;
+ int nbytes_mono;
CursorMetricRec cm;
- CursorPtr pCursor;
- CARD32 twocolor[3];
- int rc, ncolor;
+ CursorPtr pCursor;
+ CARD32 twocolor[3];
+ int rc, ncolor;
- REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
+ REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
-
- VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+
+ VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
if (!pSrc->pDrawable)
return BadDrawable;
pScreen = pSrc->pDrawable->pScreen;
width = pSrc->pDrawable->width;
height = pSrc->pDrawable->height;
- if (height && width > UINT32_MAX/(height*sizeof(CARD32)))
- return BadAlloc;
- if ( stuff->x > width
- || stuff->y > height )
- return BadMatch;
- argbbits = malloc(width * height * sizeof (CARD32));
+ if (height && width > UINT32_MAX / (height * sizeof(CARD32)))
+ return BadAlloc;
+ if (stuff->x > width || stuff->y > height)
+ return BadMatch;
+ argbbits = malloc(width * height * sizeof(CARD32));
if (!argbbits)
- return BadAlloc;
-
+ return BadAlloc;
+
stride = BitmapBytePad(width);
- nbytes_mono = stride*height;
+ nbytes_mono = stride * height;
srcbits = calloc(1, nbytes_mono);
- if (!srcbits)
- {
- free(argbbits);
- return BadAlloc;
+ if (!srcbits) {
+ free(argbbits);
+ return BadAlloc;
}
mskbits = calloc(1, nbytes_mono);
- if (!mskbits)
- {
- free(argbbits);
- free(srcbits);
- return BadAlloc;
- }
-
- if (pSrc->format == PICT_a8r8g8b8)
- {
- (*pScreen->GetImage) (pSrc->pDrawable,
- 0, 0, width, height, ZPixmap,
- 0xffffffff, (pointer) argbbits);
- }
- else
- {
- PixmapPtr pPixmap;
- PicturePtr pPicture;
- PictFormatPtr pFormat;
- int error;
-
- pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
- if (!pFormat)
- {
- free(argbbits);
- free(srcbits);
- free(mskbits);
- return BadImplementation;
- }
- pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- {
- free(argbbits);
- free(srcbits);
- free(mskbits);
- return BadAlloc;
- }
- pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0,
- client, &error);
- if (!pPicture)
- {
- free(argbbits);
- free(srcbits);
- free(mskbits);
- return error;
- }
- (*pScreen->DestroyPixmap) (pPixmap);
- CompositePicture (PictOpSrc,
- pSrc, 0, pPicture,
- 0, 0, 0, 0, 0, 0, width, height);
- (*pScreen->GetImage) (pPicture->pDrawable,
- 0, 0, width, height, ZPixmap,
- 0xffffffff, (pointer) argbbits);
- FreePicture (pPicture, 0);
+ if (!mskbits) {
+ free(argbbits);
+ free(srcbits);
+ return BadAlloc;
+ }
+
+ if (pSrc->format == PICT_a8r8g8b8) {
+ (*pScreen->GetImage) (pSrc->pDrawable,
+ 0, 0, width, height, ZPixmap,
+ 0xffffffff, (pointer) argbbits);
+ }
+ else {
+ PixmapPtr pPixmap;
+ PicturePtr pPicture;
+ PictFormatPtr pFormat;
+ int error;
+
+ pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat) {
+ free(argbbits);
+ free(srcbits);
+ free(mskbits);
+ return BadImplementation;
+ }
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap) {
+ free(argbbits);
+ free(srcbits);
+ free(mskbits);
+ return BadAlloc;
+ }
+ pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0,
+ client, &error);
+ if (!pPicture) {
+ free(argbbits);
+ free(srcbits);
+ free(mskbits);
+ return error;
+ }
+ (*pScreen->DestroyPixmap) (pPixmap);
+ CompositePicture(PictOpSrc,
+ pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height);
+ (*pScreen->GetImage) (pPicture->pDrawable,
+ 0, 0, width, height, ZPixmap,
+ 0xffffffff, (pointer) argbbits);
+ FreePicture(pPicture, 0);
}
/*
* Check whether the cursor can be directly supported by
@@ -1613,314 +1552,300 @@ ProcRenderCreateCursor (ClientPtr client)
*/
ncolor = 0;
argb = argbbits;
- for (y = 0; ncolor <= 2 && y < height; y++)
- {
- for (x = 0; ncolor <= 2 && x < width; x++)
- {
- CARD32 p = *argb++;
- CARD32 a = (p >> 24);
-
- if (a == 0) /* transparent */
- continue;
- if (a == 0xff) /* opaque */
- {
- int n;
- for (n = 0; n < ncolor; n++)
- if (p == twocolor[n])
- break;
- if (n == ncolor)
- twocolor[ncolor++] = p;
- }
- else
- ncolor = 3;
- }
- }
-
+ for (y = 0; ncolor <= 2 && y < height; y++) {
+ for (x = 0; ncolor <= 2 && x < width; x++) {
+ CARD32 p = *argb++;
+ CARD32 a = (p >> 24);
+
+ if (a == 0) /* transparent */
+ continue;
+ if (a == 0xff) { /* opaque */
+ int n;
+
+ for (n = 0; n < ncolor; n++)
+ if (p == twocolor[n])
+ break;
+ if (n == ncolor)
+ twocolor[ncolor++] = p;
+ }
+ else
+ ncolor = 3;
+ }
+ }
+
/*
* Convert argb image to two plane cursor
*/
srcline = srcbits;
mskline = mskbits;
argb = argbbits;
- for (y = 0; y < height; y++)
- {
- for (x = 0; x < width; x++)
- {
- CARD32 p = *argb++;
-
- if (ncolor <= 2)
- {
- CARD32 a = ((p >> 24));
-
- RenderSetBit (mskline, x, a != 0);
- RenderSetBit (srcline, x, a != 0 && p == twocolor[0]);
- }
- else
- {
- CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255;
- CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255;
- CARD32 d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)];
- /* Set mask from dithered alpha value */
- RenderSetBit(mskline, x, a > d);
- /* Set src from dithered intensity value */
- RenderSetBit(srcline, x, a > d && i <= d);
- }
- }
- srcline += stride;
- mskline += stride;
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ CARD32 p = *argb++;
+
+ if (ncolor <= 2) {
+ CARD32 a = ((p >> 24));
+
+ RenderSetBit(mskline, x, a != 0);
+ RenderSetBit(srcline, x, a != 0 && p == twocolor[0]);
+ }
+ else {
+ CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255;
+ CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255;
+ CARD32 d =
+ orderedDither[y & (DITHER_DIM - 1)][x & (DITHER_DIM - 1)];
+ /* Set mask from dithered alpha value */
+ RenderSetBit(mskline, x, a > d);
+ /* Set src from dithered intensity value */
+ RenderSetBit(srcline, x, a > d && i <= d);
+ }
+ }
+ srcline += stride;
+ mskline += stride;
}
/*
* Dither to white and black if the cursor has more than two colors
*/
- if (ncolor > 2)
- {
- twocolor[0] = 0xff000000;
- twocolor[1] = 0xffffffff;
+ if (ncolor > 2) {
+ twocolor[0] = 0xff000000;
+ twocolor[1] = 0xffffffff;
}
- else
- {
- free(argbbits);
- argbbits = 0;
+ else {
+ free(argbbits);
+ argbbits = 0;
}
-
+
#define GetByte(p,s) (((p) >> (s)) & 0xff)
#define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8))
-
+
cm.width = width;
cm.height = height;
cm.xhot = stuff->x;
cm.yhot = stuff->y;
rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm,
- GetColor(twocolor[0], 16),
- GetColor(twocolor[0], 8),
- GetColor(twocolor[0], 0),
- GetColor(twocolor[1], 16),
- GetColor(twocolor[1], 8),
- GetColor(twocolor[1], 0),
- &pCursor, client, stuff->cid);
+ GetColor(twocolor[0], 16),
+ GetColor(twocolor[0], 8),
+ GetColor(twocolor[0], 0),
+ GetColor(twocolor[1], 16),
+ GetColor(twocolor[1], 8),
+ GetColor(twocolor[1], 0),
+ &pCursor, client, stuff->cid);
if (rc != Success)
- goto bail;
- if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) {
- rc = BadAlloc;
- goto bail;
+ goto bail;
+ if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) {
+ rc = BadAlloc;
+ goto bail;
}
return Success;
-bail:
+ bail:
free(srcbits);
free(mskbits);
return rc;
}
static int
-ProcRenderSetPictureTransform (ClientPtr client)
+ProcRenderSetPictureTransform(ClientPtr client)
{
REQUEST(xRenderSetPictureTransformReq);
- PicturePtr pPicture;
+ PicturePtr pPicture;
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
- return SetPictureTransform (pPicture, (PictTransform *) &stuff->transform);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
+ return SetPictureTransform(pPicture, (PictTransform *) &stuff->transform);
}
static int
-ProcRenderQueryFilters (ClientPtr client)
+ProcRenderQueryFilters(ClientPtr client)
{
- REQUEST (xRenderQueryFiltersReq);
- DrawablePtr pDrawable;
- xRenderQueryFiltersReply *reply;
- int nbytesName;
- int nnames;
- ScreenPtr pScreen;
- PictureScreenPtr ps;
- int i, j, len, total_bytes, rc;
- INT16 *aliases;
- char *names;
+ REQUEST(xRenderQueryFiltersReq);
+ DrawablePtr pDrawable;
+ xRenderQueryFiltersReply *reply;
+ int nbytesName;
+ int nnames;
+ ScreenPtr pScreen;
+ PictureScreenPtr ps;
+ int i, j, len, total_bytes, rc;
+ INT16 *aliases;
+ char *names;
REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ DixGetAttrAccess);
if (rc != Success)
- return rc;
-
+ return rc;
+
pScreen = pDrawable->pScreen;
nbytesName = 0;
nnames = 0;
ps = GetPictureScreenIfSet(pScreen);
- if (ps)
- {
- for (i = 0; i < ps->nfilters; i++)
- nbytesName += 1 + strlen (ps->filters[i].name);
- for (i = 0; i < ps->nfilterAliases; i++)
- nbytesName += 1 + strlen (ps->filterAliases[i].alias);
- nnames = ps->nfilters + ps->nfilterAliases;
+ if (ps) {
+ for (i = 0; i < ps->nfilters; i++)
+ nbytesName += 1 + strlen(ps->filters[i].name);
+ for (i = 0; i < ps->nfilterAliases; i++)
+ nbytesName += 1 + strlen(ps->filterAliases[i].alias);
+ nnames = ps->nfilters + ps->nfilterAliases;
}
len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
- total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2);
+ total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
if (!reply)
- return BadAlloc;
+ return BadAlloc;
aliases = (INT16 *) (reply + 1);
names = (char *) (aliases + ((nnames + 1) & ~1));
-
+
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = len;
reply->numAliases = nnames;
reply->numFilters = nnames;
- if (ps)
- {
-
- /* fill in alias values */
- for (i = 0; i < ps->nfilters; i++)
- aliases[i] = FilterAliasNone;
- for (i = 0; i < ps->nfilterAliases; i++)
- {
- for (j = 0; j < ps->nfilters; j++)
- if (ps->filterAliases[i].filter_id == ps->filters[j].id)
- break;
- if (j == ps->nfilters)
- {
- for (j = 0; j < ps->nfilterAliases; j++)
- if (ps->filterAliases[i].filter_id ==
- ps->filterAliases[j].alias_id)
- {
- break;
- }
- if (j == ps->nfilterAliases)
- j = FilterAliasNone;
- else
- j = j + ps->nfilters;
- }
- aliases[i + ps->nfilters] = j;
- }
-
- /* fill in filter names */
- for (i = 0; i < ps->nfilters; i++)
- {
- j = strlen (ps->filters[i].name);
- *names++ = j;
- memcpy (names, ps->filters[i].name, j);
- names += j;
- }
-
- /* fill in filter alias names */
- for (i = 0; i < ps->nfilterAliases; i++)
- {
- j = strlen (ps->filterAliases[i].alias);
- *names++ = j;
- memcpy (names, ps->filterAliases[i].alias, j);
- names += j;
- }
- }
-
- if (client->swapped)
- {
- for (i = 0; i < reply->numAliases; i++)
- {
- swaps(&aliases[i]);
- }
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapl(&reply->numAliases);
- swapl(&reply->numFilters);
+ if (ps) {
+
+ /* fill in alias values */
+ for (i = 0; i < ps->nfilters; i++)
+ aliases[i] = FilterAliasNone;
+ for (i = 0; i < ps->nfilterAliases; i++) {
+ for (j = 0; j < ps->nfilters; j++)
+ if (ps->filterAliases[i].filter_id == ps->filters[j].id)
+ break;
+ if (j == ps->nfilters) {
+ for (j = 0; j < ps->nfilterAliases; j++)
+ if (ps->filterAliases[i].filter_id ==
+ ps->filterAliases[j].alias_id) {
+ break;
+ }
+ if (j == ps->nfilterAliases)
+ j = FilterAliasNone;
+ else
+ j = j + ps->nfilters;
+ }
+ aliases[i + ps->nfilters] = j;
+ }
+
+ /* fill in filter names */
+ for (i = 0; i < ps->nfilters; i++) {
+ j = strlen(ps->filters[i].name);
+ *names++ = j;
+ memcpy(names, ps->filters[i].name, j);
+ names += j;
+ }
+
+ /* fill in filter alias names */
+ for (i = 0; i < ps->nfilterAliases; i++) {
+ j = strlen(ps->filterAliases[i].alias);
+ *names++ = j;
+ memcpy(names, ps->filterAliases[i].alias, j);
+ names += j;
+ }
+ }
+
+ if (client->swapped) {
+ for (i = 0; i < reply->numAliases; i++) {
+ swaps(&aliases[i]);
+ }
+ swaps(&reply->sequenceNumber);
+ swapl(&reply->length);
+ swapl(&reply->numAliases);
+ swapl(&reply->numFilters);
}
WriteToClient(client, total_bytes, (char *) reply);
free(reply);
-
+
return Success;
}
static int
-ProcRenderSetPictureFilter (ClientPtr client)
+ProcRenderSetPictureFilter(ClientPtr client)
{
- REQUEST (xRenderSetPictureFilterReq);
- PicturePtr pPicture;
- int result;
- xFixed *params;
- int nparams;
- char *name;
-
- REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
+ REQUEST(xRenderSetPictureFilterReq);
+ PicturePtr pPicture;
+ int result;
+ xFixed *params;
+ int nparams;
+ char *name;
+
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
name = (char *) (stuff + 1);
params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
nparams = ((xFixed *) stuff + client->req_len) - params;
- result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams);
+ result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
return result;
}
static int
-ProcRenderCreateAnimCursor (ClientPtr client)
+ProcRenderCreateAnimCursor(ClientPtr client)
{
REQUEST(xRenderCreateAnimCursorReq);
- CursorPtr *cursors;
- CARD32 *deltas;
- CursorPtr pCursor;
- int ncursor;
- xAnimCursorElt *elt;
- int i;
- int ret;
+ CursorPtr *cursors;
+ CARD32 *deltas;
+ CursorPtr pCursor;
+ int ncursor;
+ xAnimCursorElt *elt;
+ int i;
+ int ret;
REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
if (client->req_len & 1)
- return BadLength;
- ncursor = (client->req_len - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
- cursors = malloc(ncursor * (sizeof (CursorPtr) + sizeof (CARD32)));
+ return BadLength;
+ ncursor =
+ (client->req_len -
+ (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
+ cursors = malloc(ncursor * (sizeof(CursorPtr) + sizeof(CARD32)));
if (!cursors)
- return BadAlloc;
+ return BadAlloc;
deltas = (CARD32 *) (cursors + ncursor);
elt = (xAnimCursorElt *) (stuff + 1);
- for (i = 0; i < ncursor; i++)
- {
- ret = dixLookupResourceByType((pointer *)(cursors + i), elt->cursor,
- RT_CURSOR, client, DixReadAccess);
- if (ret != Success)
- {
- free(cursors);
- return ret;
- }
- deltas[i] = elt->delay;
- elt++;
- }
- ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor, client,
- stuff->cid);
+ for (i = 0; i < ncursor; i++) {
+ ret = dixLookupResourceByType((pointer *) (cursors + i), elt->cursor,
+ RT_CURSOR, client, DixReadAccess);
+ if (ret != Success) {
+ free(cursors);
+ return ret;
+ }
+ deltas[i] = elt->delay;
+ elt++;
+ }
+ ret = AnimCursorCreate(cursors, deltas, ncursor, &pCursor, client,
+ stuff->cid);
free(cursors);
if (ret != Success)
- return ret;
-
- if (AddResource (stuff->cid, RT_CURSOR, (pointer)pCursor))
- return Success;
+ return ret;
+
+ if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor))
+ return Success;
return BadAlloc;
}
static int
-ProcRenderAddTraps (ClientPtr client)
+ProcRenderAddTraps(ClientPtr client)
{
- int ntraps;
- PicturePtr pPicture;
+ int ntraps;
+ PicturePtr pPicture;
+
REQUEST(xRenderAddTrapsReq);
REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
- VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
if (!pPicture->pDrawable)
return BadDrawable;
- ntraps = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
- if (ntraps % sizeof (xTrap))
- return BadLength;
- ntraps /= sizeof (xTrap);
+ ntraps = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
+ if (ntraps % sizeof(xTrap))
+ return BadLength;
+ ntraps /= sizeof(xTrap);
if (ntraps)
- AddTraps (pPicture,
- stuff->xOff, stuff->yOff,
- ntraps, (xTrap *) &stuff[1]);
+ AddTraps(pPicture,
+ stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]);
return Success;
}
-static int ProcRenderCreateSolidFill(ClientPtr client)
+static int
+ProcRenderCreateSolidFill(ClientPtr client)
{
- PicturePtr pPicture;
- int error = 0;
+ PicturePtr pPicture;
+ int error = 0;
+
REQUEST(xRenderCreateSolidFillReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
@@ -1929,24 +1854,26 @@ static int ProcRenderCreateSolidFill(ClientPtr client)
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-static int ProcRenderCreateLinearGradient (ClientPtr client)
+static int
+ProcRenderCreateLinearGradient(ClientPtr client)
{
- PicturePtr pPicture;
- int len;
- int error = 0;
- xFixed *stops;
- xRenderColor *colors;
+ PicturePtr pPicture;
+ int len;
+ int error = 0;
+ xFixed *stops;
+ xRenderColor *colors;
+
REQUEST(xRenderCreateLinearGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
@@ -1954,35 +1881,38 @@ static int ProcRenderCreateLinearGradient (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- stops = (xFixed *)(stuff + 1);
- colors = (xRenderColor *)(stops + stuff->nStops);
+ stops = (xFixed *) (stuff + 1);
+ colors = (xRenderColor *) (stops + stuff->nStops);
- pPicture = CreateLinearGradientPicture (stuff->pid, &stuff->p1, &stuff->p2,
- stuff->nStops, stops, colors, &error);
+ pPicture = CreateLinearGradientPicture(stuff->pid, &stuff->p1, &stuff->p2,
+ stuff->nStops, stops, colors,
+ &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-static int ProcRenderCreateRadialGradient (ClientPtr client)
+static int
+ProcRenderCreateRadialGradient(ClientPtr client)
{
- PicturePtr pPicture;
- int len;
- int error = 0;
- xFixed *stops;
- xRenderColor *colors;
+ PicturePtr pPicture;
+ int len;
+ int error = 0;
+ xFixed *stops;
+ xRenderColor *colors;
+
REQUEST(xRenderCreateRadialGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
@@ -1990,34 +1920,37 @@ static int ProcRenderCreateRadialGradient (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- stops = (xFixed *)(stuff + 1);
- colors = (xRenderColor *)(stops + stuff->nStops);
+ stops = (xFixed *) (stuff + 1);
+ colors = (xRenderColor *) (stops + stuff->nStops);
- pPicture = CreateRadialGradientPicture (stuff->pid, &stuff->inner, &stuff->outer,
- stuff->inner_radius, stuff->outer_radius,
- stuff->nStops, stops, colors, &error);
+ pPicture =
+ CreateRadialGradientPicture(stuff->pid, &stuff->inner, &stuff->outer,
+ stuff->inner_radius, stuff->outer_radius,
+ stuff->nStops, stops, colors, &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-static int ProcRenderCreateConicalGradient (ClientPtr client)
+static int
+ProcRenderCreateConicalGradient(ClientPtr client)
{
- PicturePtr pPicture;
- int len;
- int error = 0;
- xFixed *stops;
- xRenderColor *colors;
+ PicturePtr pPicture;
+ int len;
+ int error = 0;
+ xFixed *stops;
+ xRenderColor *colors;
+
REQUEST(xRenderCreateConicalGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
@@ -2025,51 +1958,51 @@ static int ProcRenderCreateConicalGradient (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- stops = (xFixed *)(stuff + 1);
- colors = (xRenderColor *)(stops + stuff->nStops);
+ stops = (xFixed *) (stuff + 1);
+ colors = (xRenderColor *) (stops + stuff->nStops);
- pPicture = CreateConicalGradientPicture (stuff->pid, &stuff->center, stuff->angle,
- stuff->nStops, stops, colors, &error);
+ pPicture =
+ CreateConicalGradientPicture(stuff->pid, &stuff->center, stuff->angle,
+ stuff->nStops, stops, colors, &error);
if (!pPicture)
- return error;
+ return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
- pPicture, RT_NONE, NULL, DixCreateAccess);
+ pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
- return error;
- if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
- return BadAlloc;
+ return error;
+ if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+ return BadAlloc;
return Success;
}
-
static int
-ProcRenderDispatch (ClientPtr client)
+ProcRenderDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < RenderNumberRequests)
- return (*ProcRenderVector[stuff->data]) (client);
+ return (*ProcRenderVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
static int
-SProcRenderQueryVersion (ClientPtr client)
+SProcRenderQueryVersion(ClientPtr client)
{
REQUEST(xRenderQueryVersionReq);
swaps(&stuff->length);
swapl(&stuff->majorVersion);
swapl(&stuff->minorVersion);
- return (*ProcRenderVector[stuff->renderReqType])(client);
+ return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderQueryPictFormats (ClientPtr client)
+SProcRenderQueryPictFormats(ClientPtr client)
{
REQUEST(xRenderQueryPictFormatsReq);
swaps(&stuff->length);
@@ -2077,7 +2010,7 @@ SProcRenderQueryPictFormats (ClientPtr client)
}
static int
-SProcRenderQueryPictIndexValues (ClientPtr client)
+SProcRenderQueryPictIndexValues(ClientPtr client)
{
REQUEST(xRenderQueryPictIndexValuesReq);
swaps(&stuff->length);
@@ -2086,13 +2019,13 @@ SProcRenderQueryPictIndexValues (ClientPtr client)
}
static int
-SProcRenderQueryDithers (ClientPtr client)
+SProcRenderQueryDithers(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderCreatePicture (ClientPtr client)
+SProcRenderCreatePicture(ClientPtr client)
{
REQUEST(xRenderCreatePictureReq);
swaps(&stuff->length);
@@ -2105,7 +2038,7 @@ SProcRenderCreatePicture (ClientPtr client)
}
static int
-SProcRenderChangePicture (ClientPtr client)
+SProcRenderChangePicture(ClientPtr client)
{
REQUEST(xRenderChangePictureReq);
swaps(&stuff->length);
@@ -2116,7 +2049,7 @@ SProcRenderChangePicture (ClientPtr client)
}
static int
-SProcRenderSetPictureClipRectangles (ClientPtr client)
+SProcRenderSetPictureClipRectangles(ClientPtr client)
{
REQUEST(xRenderSetPictureClipRectanglesReq);
swaps(&stuff->length);
@@ -2128,7 +2061,7 @@ SProcRenderSetPictureClipRectangles (ClientPtr client)
}
static int
-SProcRenderFreePicture (ClientPtr client)
+SProcRenderFreePicture(ClientPtr client)
{
REQUEST(xRenderFreePictureReq);
swaps(&stuff->length);
@@ -2137,7 +2070,7 @@ SProcRenderFreePicture (ClientPtr client)
}
static int
-SProcRenderComposite (ClientPtr client)
+SProcRenderComposite(ClientPtr client)
{
REQUEST(xRenderCompositeReq);
swaps(&stuff->length);
@@ -2156,7 +2089,7 @@ SProcRenderComposite (ClientPtr client)
}
static int
-SProcRenderScale (ClientPtr client)
+SProcRenderScale(ClientPtr client)
{
REQUEST(xRenderScaleReq);
swaps(&stuff->length);
@@ -2174,7 +2107,7 @@ SProcRenderScale (ClientPtr client)
}
static int
-SProcRenderTrapezoids (ClientPtr client)
+SProcRenderTrapezoids(ClientPtr client)
{
REQUEST(xRenderTrapezoidsReq);
@@ -2190,7 +2123,7 @@ SProcRenderTrapezoids (ClientPtr client)
}
static int
-SProcRenderTriangles (ClientPtr client)
+SProcRenderTriangles(ClientPtr client)
{
REQUEST(xRenderTrianglesReq);
@@ -2206,7 +2139,7 @@ SProcRenderTriangles (ClientPtr client)
}
static int
-SProcRenderTriStrip (ClientPtr client)
+SProcRenderTriStrip(ClientPtr client)
{
REQUEST(xRenderTriStripReq);
@@ -2222,7 +2155,7 @@ SProcRenderTriStrip (ClientPtr client)
}
static int
-SProcRenderTriFan (ClientPtr client)
+SProcRenderTriFan(ClientPtr client)
{
REQUEST(xRenderTriFanReq);
@@ -2238,25 +2171,25 @@ SProcRenderTriFan (ClientPtr client)
}
static int
-SProcRenderColorTrapezoids (ClientPtr client)
+SProcRenderColorTrapezoids(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderColorTriangles (ClientPtr client)
+SProcRenderColorTriangles(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderTransform (ClientPtr client)
+SProcRenderTransform(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderCreateGlyphSet (ClientPtr client)
+SProcRenderCreateGlyphSet(ClientPtr client)
{
REQUEST(xRenderCreateGlyphSetReq);
swaps(&stuff->length);
@@ -2266,17 +2199,17 @@ SProcRenderCreateGlyphSet (ClientPtr client)
}
static int
-SProcRenderReferenceGlyphSet (ClientPtr client)
+SProcRenderReferenceGlyphSet(ClientPtr client)
{
REQUEST(xRenderReferenceGlyphSetReq);
swaps(&stuff->length);
swapl(&stuff->gsid);
swapl(&stuff->existing);
- return (*ProcRenderVector[stuff->renderReqType]) (client);
+ return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderFreeGlyphSet (ClientPtr client)
+SProcRenderFreeGlyphSet(ClientPtr client)
{
REQUEST(xRenderFreeGlyphSetReq);
swaps(&stuff->length);
@@ -2285,46 +2218,46 @@ SProcRenderFreeGlyphSet (ClientPtr client)
}
static int
-SProcRenderAddGlyphs (ClientPtr client)
+SProcRenderAddGlyphs(ClientPtr client)
{
register int i;
- CARD32 *gids;
- void *end;
+ CARD32 *gids;
+ void *end;
xGlyphInfo *gi;
+
REQUEST(xRenderAddGlyphsReq);
swaps(&stuff->length);
swapl(&stuff->glyphset);
swapl(&stuff->nglyphs);
if (stuff->nglyphs & 0xe0000000)
- return BadLength;
+ return BadLength;
end = (CARD8 *) stuff + (client->req_len << 2);
gids = (CARD32 *) (stuff + 1);
gi = (xGlyphInfo *) (gids + stuff->nglyphs);
if ((char *) end - (char *) (gids + stuff->nglyphs) < 0)
- return BadLength;
+ return BadLength;
if ((char *) end - (char *) (gi + stuff->nglyphs) < 0)
- return BadLength;
- for (i = 0; i < stuff->nglyphs; i++)
- {
- 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 BadLength;
+ for (i = 0; i < stuff->nglyphs; i++) {
+ 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);
}
static int
-SProcRenderAddGlyphsFromPicture (ClientPtr client)
+SProcRenderAddGlyphsFromPicture(ClientPtr client)
{
return BadImplementation;
}
static int
-SProcRenderFreeGlyphs (ClientPtr client)
+SProcRenderFreeGlyphs(ClientPtr client)
{
REQUEST(xRenderFreeGlyphsReq);
swaps(&stuff->length);
@@ -2334,23 +2267,29 @@ SProcRenderFreeGlyphs (ClientPtr client)
}
static int
-SProcRenderCompositeGlyphs (ClientPtr client)
+SProcRenderCompositeGlyphs(ClientPtr client)
{
- xGlyphElt *elt;
- CARD8 *buffer;
- CARD8 *end;
- int space;
- int i;
- int size;
-
+ xGlyphElt *elt;
+ CARD8 *buffer;
+ CARD8 *end;
+ int space;
+ int i;
+ int size;
+
REQUEST(xRenderCompositeGlyphsReq);
-
+
switch (stuff->renderReqType) {
- default: size = 1; break;
- case X_RenderCompositeGlyphs16: size = 2; break;
- case X_RenderCompositeGlyphs32: size = 4; break;
+ default:
+ size = 1;
+ break;
+ case X_RenderCompositeGlyphs16:
+ size = 2;
+ break;
+ case X_RenderCompositeGlyphs32:
+ size = 4;
+ break;
}
-
+
swaps(&stuff->length);
swapl(&stuff->src);
swapl(&stuff->dst);
@@ -2360,55 +2299,50 @@ SProcRenderCompositeGlyphs (ClientPtr client)
swaps(&stuff->ySrc);
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
- while (buffer + sizeof (xGlyphElt) < end)
- {
- elt = (xGlyphElt *) buffer;
- buffer += sizeof (xGlyphElt);
-
- swaps(&elt->deltax);
- swaps(&elt->deltay);
-
- i = elt->len;
- if (i == 0xff)
- {
- swapl((int *)buffer);
- buffer += 4;
- }
- else
- {
- space = size * i;
- switch (size) {
- case 1:
- buffer += i;
- break;
- case 2:
- while (i--)
- {
- swaps((short *)buffer);
- buffer += 2;
- }
- break;
- case 4:
- while (i--)
- {
- swapl((int *)buffer);
- buffer += 4;
- }
- break;
- }
- if (space & 3)
- buffer += 4 - (space & 3);
- }
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ swaps(&elt->deltax);
+ swaps(&elt->deltay);
+
+ i = elt->len;
+ if (i == 0xff) {
+ swapl((int *) buffer);
+ buffer += 4;
+ }
+ else {
+ space = size * i;
+ switch (size) {
+ case 1:
+ buffer += i;
+ break;
+ case 2:
+ while (i--) {
+ swaps((short *) buffer);
+ buffer += 2;
+ }
+ break;
+ case 4:
+ while (i--) {
+ swapl((int *) buffer);
+ buffer += 4;
+ }
+ break;
+ }
+ if (space & 3)
+ buffer += 4 - (space & 3);
+ }
}
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderFillRectangles (ClientPtr client)
+SProcRenderFillRectangles(ClientPtr client)
{
REQUEST(xRenderFillRectanglesReq);
- REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
swaps(&stuff->length);
swapl(&stuff->dst);
swaps(&stuff->color.red);
@@ -2418,13 +2352,13 @@ SProcRenderFillRectangles (ClientPtr client)
SwapRestS(stuff);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderCreateCursor (ClientPtr client)
+SProcRenderCreateCursor(ClientPtr client)
{
REQUEST(xRenderCreateCursorReq);
- REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
-
+ REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
+
swaps(&stuff->length);
swapl(&stuff->cid);
swapl(&stuff->src);
@@ -2432,9 +2366,9 @@ SProcRenderCreateCursor (ClientPtr client)
swaps(&stuff->y);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderSetPictureTransform (ClientPtr client)
+SProcRenderSetPictureTransform(ClientPtr client)
{
REQUEST(xRenderSetPictureTransformReq);
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
@@ -2454,33 +2388,33 @@ SProcRenderSetPictureTransform (ClientPtr client)
}
static int
-SProcRenderQueryFilters (ClientPtr client)
+SProcRenderQueryFilters(ClientPtr client)
{
- REQUEST (xRenderQueryFiltersReq);
- REQUEST_SIZE_MATCH (xRenderQueryFiltersReq);
+ REQUEST(xRenderQueryFiltersReq);
+ REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderSetPictureFilter (ClientPtr client)
+SProcRenderSetPictureFilter(ClientPtr client)
{
- REQUEST (xRenderSetPictureFilterReq);
- REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
+ REQUEST(xRenderSetPictureFilterReq);
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
swaps(&stuff->length);
swapl(&stuff->picture);
swaps(&stuff->nbytes);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-
+
static int
-SProcRenderCreateAnimCursor (ClientPtr client)
+SProcRenderCreateAnimCursor(ClientPtr client)
{
- REQUEST (xRenderCreateAnimCursorReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq);
+ REQUEST(xRenderCreateAnimCursorReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq);
swaps(&stuff->length);
swapl(&stuff->cid);
@@ -2489,10 +2423,10 @@ SProcRenderCreateAnimCursor (ClientPtr client)
}
static int
-SProcRenderAddTraps (ClientPtr client)
+SProcRenderAddTraps(ClientPtr client)
{
- REQUEST (xRenderAddTrapsReq);
- REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
+ REQUEST(xRenderAddTrapsReq);
+ REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
swaps(&stuff->length);
swapl(&stuff->picture);
@@ -2505,8 +2439,8 @@ SProcRenderAddTraps (ClientPtr client)
static int
SProcRenderCreateSolidFill(ClientPtr client)
{
- REQUEST (xRenderCreateSolidFillReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq);
+ REQUEST(xRenderCreateSolidFillReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2517,29 +2451,32 @@ SProcRenderCreateSolidFill(ClientPtr client)
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
-static void swapStops(void *stuff, int num)
+static void
+swapStops(void *stuff, int num)
{
int i;
CARD32 *stops;
CARD16 *colors;
- stops = (CARD32 *)(stuff);
+
+ stops = (CARD32 *) (stuff);
for (i = 0; i < num; ++i) {
swapl(stops);
++stops;
}
- colors = (CARD16 *)(stops);
- for (i = 0; i < 4*num; ++i) {
+ colors = (CARD16 *) (stops);
+ for (i = 0; i < 4 * num; ++i) {
swaps(colors);
++colors;
}
}
static int
-SProcRenderCreateLinearGradient (ClientPtr client)
+SProcRenderCreateLinearGradient(ClientPtr client)
{
int len;
- REQUEST (xRenderCreateLinearGradientReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq);
+
+ REQUEST(xRenderCreateLinearGradientReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2550,22 +2487,23 @@ SProcRenderCreateLinearGradient (ClientPtr client)
swapl(&stuff->nStops);
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- swapStops(stuff+1, stuff->nStops);
+ swapStops(stuff + 1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderCreateRadialGradient (ClientPtr client)
+SProcRenderCreateRadialGradient(ClientPtr client)
{
int len;
- REQUEST (xRenderCreateRadialGradientReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq);
+
+ REQUEST(xRenderCreateRadialGradientReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2578,22 +2516,23 @@ SProcRenderCreateRadialGradient (ClientPtr client)
swapl(&stuff->nStops);
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- swapStops(stuff+1, stuff->nStops);
+ swapStops(stuff + 1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderCreateConicalGradient (ClientPtr client)
+SProcRenderCreateConicalGradient(ClientPtr client)
{
int len;
- REQUEST (xRenderCreateConicalGradientReq);
- REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq);
+
+ REQUEST(xRenderCreateConicalGradientReq);
+ REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
swaps(&stuff->length);
swapl(&stuff->pid);
@@ -2603,25 +2542,25 @@ SProcRenderCreateConicalGradient (ClientPtr client)
swapl(&stuff->nStops);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
- if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
- return BadLength;
- if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
+ if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
+ return BadLength;
+ if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
- swapStops(stuff+1, stuff->nStops);
+ swapStops(stuff + 1, stuff->nStops);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
static int
-SProcRenderDispatch (ClientPtr client)
+SProcRenderDispatch(ClientPtr client)
{
REQUEST(xReq);
-
+
if (stuff->data < RenderNumberRequests)
- return (*SProcRenderVector[stuff->data]) (client);
+ return (*SProcRenderVector[stuff->data]) (client);
else
- return BadRequest;
+ return BadRequest;
}
#ifdef PANORAMIX
@@ -2640,133 +2579,143 @@ SProcRenderDispatch (ClientPtr client)
} \
} \
-int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr);
+int (*PanoramiXSaveRenderVector[RenderNumberRequests]) (ClientPtr);
static int
-PanoramiXRenderCreatePicture (ClientPtr client)
+PanoramiXRenderCreatePicture(ClientPtr client)
{
REQUEST(xRenderCreatePictureReq);
- PanoramiXRes *refDraw, *newPict;
- int result, j;
+ PanoramiXRes *refDraw, *newPict;
+ int result, j;
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
- result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
- XRC_DRAWABLE, client, DixWriteAccess);
+ result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+ XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadDrawable : result;
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ return (result == BadValue) ? BadDrawable : result;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
-
+
if (refDraw->type == XRT_WINDOW &&
- stuff->drawable == screenInfo.screens[0]->root->drawable.id)
- {
- newPict->u.pict.root = TRUE;
+ stuff->drawable == screenInfo.screens[0]->root->drawable.id) {
+ newPict->u.pict.root = TRUE;
}
else
- newPict->u.pict.root = FALSE;
-
+ newPict->u.pict.root = FALSE;
+
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- stuff->drawable = refDraw->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ stuff->drawable = refDraw->info[j].id;
+ result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
- else
- free(newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ else
+ free(newPict);
return result;
}
static int
-PanoramiXRenderChangePicture (ClientPtr client)
+PanoramiXRenderChangePicture(ClientPtr client)
{
- PanoramiXRes *pict;
- int result = Success, j;
+ PanoramiXRes *pict;
+ int result = Success, j;
+
REQUEST(xRenderChangePictureReq);
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderChangePicture]) (client);
- if(result != Success) break;
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderSetPictureClipRectangles (ClientPtr client)
+PanoramiXRenderSetPictureClipRectangles(ClientPtr client)
{
REQUEST(xRenderSetPictureClipRectanglesReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles])
+ (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderSetPictureTransform (ClientPtr client)
+PanoramiXRenderSetPictureTransform(ClientPtr client)
{
REQUEST(xRenderSetPictureTransformReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderSetPictureFilter (ClientPtr client)
+PanoramiXRenderSetPictureFilter(ClientPtr client)
{
REQUEST(xRenderSetPictureFilterReq);
- int result = Success, j;
- PanoramiXRes *pict;
+ int result = Success, j;
+ PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
-
+
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
-
+
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client);
- if(result != Success) break;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderFreePicture (ClientPtr client)
+PanoramiXRenderFreePicture(ClientPtr client)
{
PanoramiXRes *pict;
- int result = Success, j;
+ int result = Success, j;
+
REQUEST(xRenderFreePictureReq);
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
@@ -2774,146 +2723,144 @@ PanoramiXRenderFreePicture (ClientPtr client)
client->errorValue = stuff->picture;
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess);
-
FOR_NSCREENS_BACKWARD(j) {
- stuff->picture = pict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client);
- if(result != Success) break;
+ stuff->picture = pict->info[j].id;
+ result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client);
+ if (result != Success)
+ break;
}
/* Since ProcRenderFreePicture is using FreeResource, it will free
- our resource for us on the last pass through the loop above */
-
+ our resource for us on the last pass through the loop above */
+
return result;
}
static int
-PanoramiXRenderComposite (ClientPtr client)
+PanoramiXRenderComposite(ClientPtr client)
{
- PanoramiXRes *src, *msk, *dst;
- int result = Success, j;
- xRenderCompositeReq orig;
+ PanoramiXRes *src, *msk, *dst;
+ int result = Success, j;
+ xRenderCompositeReq orig;
+
REQUEST(xRenderCompositeReq);
REQUEST_SIZE_MATCH(xRenderCompositeReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_ALPHA(msk, stuff->mask, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
orig = *stuff;
-
+
FOR_NSCREENS_FORWARD(j) {
- stuff->src = src->info[j].id;
- if (src->u.pict.root)
- {
- stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
- stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
- }
- stuff->dst = dst->info[j].id;
- if (dst->u.pict.root)
- {
- stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
- stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
- }
- if (msk)
- {
- stuff->mask = msk->info[j].id;
- if (msk->u.pict.root)
- {
- stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
- stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
- }
- }
- result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client);
- if(result != Success) break;
+ stuff->src = src->info[j].id;
+ if (src->u.pict.root) {
+ stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
+ stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
+ }
+ stuff->dst = dst->info[j].id;
+ if (dst->u.pict.root) {
+ stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
+ stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
+ }
+ if (msk) {
+ stuff->mask = msk->info[j].id;
+ if (msk->u.pict.root) {
+ stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
+ stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
+ }
+ }
+ result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client);
+ if (result != Success)
+ break;
}
return result;
}
static int
-PanoramiXRenderCompositeGlyphs (ClientPtr client)
+PanoramiXRenderCompositeGlyphs(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderCompositeGlyphsReq);
- xGlyphElt origElt, *elt;
- INT16 xSrc, ySrc;
+ xGlyphElt origElt, *elt;
+ INT16 xSrc, ySrc;
REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) +
- sizeof (xGlyphElt)))
- {
- elt = (xGlyphElt *) (stuff + 1);
- origElt = *elt;
- xSrc = stuff->xSrc;
- ySrc = stuff->ySrc;
- FOR_NSCREENS_FORWARD(j) {
- stuff->src = src->info[j].id;
- if (src->u.pict.root)
- {
- stuff->xSrc = xSrc - screenInfo.screens[j]->x;
- stuff->ySrc = ySrc - screenInfo.screens[j]->y;
- }
- stuff->dst = dst->info[j].id;
- if (dst->u.pict.root)
- {
- elt->deltax = origElt.deltax - screenInfo.screens[j]->x;
- elt->deltay = origElt.deltay - screenInfo.screens[j]->y;
- }
- result = (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client);
- if(result != Success) break;
- }
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ if (client->req_len << 2 >= (sizeof(xRenderCompositeGlyphsReq) +
+ sizeof(xGlyphElt))) {
+ elt = (xGlyphElt *) (stuff + 1);
+ origElt = *elt;
+ xSrc = stuff->xSrc;
+ ySrc = stuff->ySrc;
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->src = src->info[j].id;
+ if (src->u.pict.root) {
+ stuff->xSrc = xSrc - screenInfo.screens[j]->x;
+ stuff->ySrc = ySrc - screenInfo.screens[j]->y;
+ }
+ stuff->dst = dst->info[j].id;
+ if (dst->u.pict.root) {
+ elt->deltax = origElt.deltax - screenInfo.screens[j]->x;
+ elt->deltay = origElt.deltay - screenInfo.screens[j]->y;
+ }
+ result =
+ (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client);
+ if (result != Success)
+ break;
+ }
}
return result;
}
static int
-PanoramiXRenderFillRectangles (ClientPtr client)
+PanoramiXRenderFillRectangles(ClientPtr client)
{
- PanoramiXRes *dst;
- int result = Success, j;
+ PanoramiXRes *dst;
+ int result = Success, j;
+
REQUEST(xRenderFillRectanglesReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
- extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len)))
- {
- memcpy (extra, stuff + 1, extra_len);
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root)
- {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xRectangle *rects = (xRectangle *) (stuff + 1);
- int i = extra_len / sizeof (xRectangle);
-
- while (i--)
- {
- rects->x -= x_off;
- rects->y -= y_off;
- rects++;
- }
- }
- }
- stuff->dst = dst->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
- if(result != Success) break;
- }
- free(extra);
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+ extra_len = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xRectangle *rects = (xRectangle *) (stuff + 1);
+ int i = extra_len / sizeof(xRectangle);
+
+ while (i--) {
+ rects->x -= x_off;
+ rects->y -= y_off;
+ rects++;
+ }
+ }
+ }
+ stuff->dst = dst->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
+ if (result != Success)
+ break;
+ }
+ free(extra);
}
return result;
@@ -2922,57 +2869,58 @@ PanoramiXRenderFillRectangles (ClientPtr client)
static int
PanoramiXRenderTrapezoids(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTrapezoidsReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xTrapezoid *trap = (xTrapezoid *) (stuff + 1);
- int i = extra_len / sizeof (xTrapezoid);
-
- while (i--) {
- trap->top -= y_off;
- trap->bottom -= y_off;
- trap->left.p1.x -= x_off;
- trap->left.p1.y -= y_off;
- trap->left.p2.x -= x_off;
- trap->left.p2.y -= y_off;
- trap->right.p1.x -= x_off;
- trap->right.p1.y -= y_off;
- trap->right.p2.x -= x_off;
- trap->right.p2.y -= y_off;
- trap++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xTrapezoid *trap = (xTrapezoid *) (stuff + 1);
+ int i = extra_len / sizeof(xTrapezoid);
+
+ while (i--) {
+ trap->top -= y_off;
+ trap->bottom -= y_off;
+ trap->left.p1.x -= x_off;
+ trap->left.p1.y -= y_off;
+ trap->left.p2.x -= x_off;
+ trap->left.p2.y -= y_off;
+ trap->right.p1.x -= x_off;
+ trap->right.p1.y -= y_off;
+ trap->right.p2.x -= x_off;
+ trap->right.p2.y -= y_off;
+ trap++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -2982,53 +2930,54 @@ PanoramiXRenderTrapezoids(ClientPtr client)
static int
PanoramiXRenderTriangles(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTrianglesReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xTriangle *tri = (xTriangle *) (stuff + 1);
- int i = extra_len / sizeof (xTriangle);
-
- while (i--) {
- tri->p1.x -= x_off;
- tri->p1.y -= y_off;
- tri->p2.x -= x_off;
- tri->p2.y -= y_off;
- tri->p3.x -= x_off;
- tri->p3.y -= y_off;
- tri++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xTriangle *tri = (xTriangle *) (stuff + 1);
+ int i = extra_len / sizeof(xTriangle);
+
+ while (i--) {
+ tri->p1.x -= x_off;
+ tri->p1.y -= y_off;
+ tri->p2.x -= x_off;
+ tri->p2.y -= y_off;
+ tri->p3.x -= x_off;
+ tri->p3.y -= y_off;
+ tri++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -3038,49 +2987,50 @@ PanoramiXRenderTriangles(ClientPtr client)
static int
PanoramiXRenderTriStrip(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTriStripReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTriStripReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xPointFixed *fixed = (xPointFixed *) (stuff + 1);
- int i = extra_len / sizeof (xPointFixed);
-
- while (i--) {
- fixed->x -= x_off;
- fixed->y -= y_off;
- fixed++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTriStripReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTriStripReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xPointFixed *fixed = (xPointFixed *) (stuff + 1);
+ int i = extra_len / sizeof(xPointFixed);
+
+ while (i--) {
+ fixed->x -= x_off;
+ fixed->y -= y_off;
+ fixed++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -3090,49 +3040,50 @@ PanoramiXRenderTriStrip(ClientPtr client)
static int
PanoramiXRenderTriFan(ClientPtr client)
{
- PanoramiXRes *src, *dst;
- int result = Success, j;
+ PanoramiXRes *src, *dst;
+ int result = Success, j;
+
REQUEST(xRenderTriFanReq);
- char *extra;
- int extra_len;
-
- REQUEST_AT_LEAST_SIZE (xRenderTriFanReq);
-
- VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
- VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
-
- extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
-
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- if (dst->u.pict.root) {
- int x_off = screenInfo.screens[j]->x;
- int y_off = screenInfo.screens[j]->y;
-
- if(x_off || y_off) {
- xPointFixed *fixed = (xPointFixed *) (stuff + 1);
- int i = extra_len / sizeof (xPointFixed);
-
- while (i--) {
- fixed->x -= x_off;
- fixed->y -= y_off;
- fixed++;
- }
- }
- }
-
+ char *extra;
+ int extra_len;
+
+ REQUEST_AT_LEAST_SIZE(xRenderTriFanReq);
+
+ VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
+ VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
+
+ extra_len = (client->req_len << 2) - sizeof(xRenderTriFanReq);
+
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ if (dst->u.pict.root) {
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
+
+ if (x_off || y_off) {
+ xPointFixed *fixed = (xPointFixed *) (stuff + 1);
+ int i = extra_len / sizeof(xPointFixed);
+
+ while (i--) {
+ fixed->x -= x_off;
+ fixed->y -= y_off;
+ fixed++;
+ }
+ }
+ }
+
stuff->src = src->info[j].id;
stuff->dst = dst->info[j].id;
- result =
- (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client);
+ result = (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client);
+
+ if (result != Success)
+ break;
+ }
- if(result != Success) break;
- }
-
free(extra);
}
@@ -3140,186 +3091,199 @@ PanoramiXRenderTriFan(ClientPtr client)
}
static int
-PanoramiXRenderAddTraps (ClientPtr client)
+PanoramiXRenderAddTraps(ClientPtr client)
{
- PanoramiXRes *picture;
- int result = Success, j;
+ PanoramiXRes *picture;
+ int result = Success, j;
+
REQUEST(xRenderAddTrapsReq);
- char *extra;
- int extra_len;
- INT16 x_off, y_off;
-
- REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
- VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess);
- extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len)))
- {
- memcpy (extra, stuff + 1, extra_len);
- x_off = stuff->xOff;
- y_off = stuff->yOff;
- FOR_NSCREENS_FORWARD(j) {
- if (j) memcpy (stuff + 1, extra, extra_len);
- stuff->picture = picture->info[j].id;
-
- if (picture->u.pict.root)
- {
- stuff->xOff = x_off + screenInfo.screens[j]->x;
- stuff->yOff = y_off + screenInfo.screens[j]->y;
- }
- result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
- if(result != Success) break;
- }
- free(extra);
+ char *extra;
+ int extra_len;
+ INT16 x_off, y_off;
+
+ REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
+ VERIFY_XIN_PICTURE(picture, stuff->picture, client, DixWriteAccess);
+ extra_len = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
+ if (extra_len && (extra = (char *) malloc(extra_len))) {
+ memcpy(extra, stuff + 1, extra_len);
+ x_off = stuff->xOff;
+ y_off = stuff->yOff;
+ FOR_NSCREENS_FORWARD(j) {
+ if (j)
+ memcpy(stuff + 1, extra, extra_len);
+ stuff->picture = picture->info[j].id;
+
+ if (picture->u.pict.root) {
+ stuff->xOff = x_off + screenInfo.screens[j]->x;
+ stuff->yOff = y_off + screenInfo.screens[j]->y;
+ }
+ result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
+ if (result != Success)
+ break;
+ }
+ free(extra);
}
return result;
}
static int
-PanoramiXRenderCreateSolidFill (ClientPtr client)
+PanoramiXRenderCreateSolidFill(ClientPtr client)
{
REQUEST(xRenderCreateSolidFillReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
-
+
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
static int
-PanoramiXRenderCreateLinearGradient (ClientPtr client)
+PanoramiXRenderCreateLinearGradient(ClientPtr client)
{
REQUEST(xRenderCreateLinearGradientReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
static int
-PanoramiXRenderCreateRadialGradient (ClientPtr client)
+PanoramiXRenderCreateRadialGradient(ClientPtr client)
{
REQUEST(xRenderCreateRadialGradientReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
static int
-PanoramiXRenderCreateConicalGradient (ClientPtr client)
+PanoramiXRenderCreateConicalGradient(ClientPtr client)
{
REQUEST(xRenderCreateConicalGradientReq);
- PanoramiXRes *newPict;
- int result = Success, j;
+ PanoramiXRes *newPict;
+ int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
- if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
- return BadAlloc;
+ if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
newPict->type = XRT_PICTURE;
panoramix_setup_ids(newPict, client, stuff->pid);
newPict->u.pict.root = FALSE;
FOR_NSCREENS_BACKWARD(j) {
- stuff->pid = newPict->info[j].id;
- result = (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient]) (client);
- if(result != Success) break;
+ stuff->pid = newPict->info[j].id;
+ result =
+ (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient])
+ (client);
+ if (result != Success)
+ break;
}
if (result == Success)
- AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
+ AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
- free(newPict);
+ free(newPict);
return result;
}
void
-PanoramiXRenderInit (void)
+PanoramiXRenderInit(void)
{
- int i;
-
- XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource,
- "XineramaPicture");
+ int i;
+
+ XRT_PICTURE = CreateNewResourceType(XineramaDeleteResource,
+ "XineramaPicture");
if (RenderErrBase)
- SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
+ SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
for (i = 0; i < RenderNumberRequests; i++)
- PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
+ PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
/*
* Stuff in Xinerama aware request processing hooks
*/
ProcRenderVector[X_RenderCreatePicture] = PanoramiXRenderCreatePicture;
ProcRenderVector[X_RenderChangePicture] = PanoramiXRenderChangePicture;
- ProcRenderVector[X_RenderSetPictureTransform] = PanoramiXRenderSetPictureTransform;
- ProcRenderVector[X_RenderSetPictureFilter] = PanoramiXRenderSetPictureFilter;
- ProcRenderVector[X_RenderSetPictureClipRectangles] = PanoramiXRenderSetPictureClipRectangles;
+ ProcRenderVector[X_RenderSetPictureTransform] =
+ PanoramiXRenderSetPictureTransform;
+ ProcRenderVector[X_RenderSetPictureFilter] =
+ PanoramiXRenderSetPictureFilter;
+ ProcRenderVector[X_RenderSetPictureClipRectangles] =
+ PanoramiXRenderSetPictureClipRectangles;
ProcRenderVector[X_RenderFreePicture] = PanoramiXRenderFreePicture;
ProcRenderVector[X_RenderComposite] = PanoramiXRenderComposite;
ProcRenderVector[X_RenderCompositeGlyphs8] = PanoramiXRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs16] = PanoramiXRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs32] = PanoramiXRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs16] =
+ PanoramiXRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs32] =
+ PanoramiXRenderCompositeGlyphs;
ProcRenderVector[X_RenderFillRectangles] = PanoramiXRenderFillRectangles;
ProcRenderVector[X_RenderTrapezoids] = PanoramiXRenderTrapezoids;
@@ -3329,18 +3293,22 @@ PanoramiXRenderInit (void)
ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps;
ProcRenderVector[X_RenderCreateSolidFill] = PanoramiXRenderCreateSolidFill;
- ProcRenderVector[X_RenderCreateLinearGradient] = PanoramiXRenderCreateLinearGradient;
- ProcRenderVector[X_RenderCreateRadialGradient] = PanoramiXRenderCreateRadialGradient;
- ProcRenderVector[X_RenderCreateConicalGradient] = PanoramiXRenderCreateConicalGradient;
+ ProcRenderVector[X_RenderCreateLinearGradient] =
+ PanoramiXRenderCreateLinearGradient;
+ ProcRenderVector[X_RenderCreateRadialGradient] =
+ PanoramiXRenderCreateRadialGradient;
+ ProcRenderVector[X_RenderCreateConicalGradient] =
+ PanoramiXRenderCreateConicalGradient;
}
void
-PanoramiXRenderReset (void)
+PanoramiXRenderReset(void)
{
- int i;
+ int i;
+
for (i = 0; i < RenderNumberRequests; i++)
- ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
+ ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
RenderErrBase = 0;
}
-#endif /* PANORAMIX */
+#endif /* PANORAMIX */