aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/render/picture.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/render/picture.c
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/render/picture.c')
-rw-r--r--xorg-server/render/picture.c2023
1 files changed, 965 insertions, 1058 deletions
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);
}
-