aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/dispatch.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-07 08:23:46 +0200
committermarha <marha@users.sourceforge.net>2013-10-07 08:23:46 +0200
commit81fd17c8678e89cea6610b8b2996b028b21eb5dc (patch)
treed2c201976b3cd000658870071ab7b533359de039 /xorg-server/dix/dispatch.c
parent5593a3d2f370e3e12a043110bf2e395c938980d6 (diff)
downloadvcxsrv-81fd17c8678e89cea6610b8b2996b028b21eb5dc.tar.gz
vcxsrv-81fd17c8678e89cea6610b8b2996b028b21eb5dc.tar.bz2
vcxsrv-81fd17c8678e89cea6610b8b2996b028b21eb5dc.zip
xserver fontconfig libXdmcp mesa pixmand xkeyboard-config git update 7 oct 2013
xserver commit ccbe17b1c6da1ad9d085fc8133cdd15dc7004a4a xkeyboard-config commit c8326b7d12b20eccfd38d661b95d9b23d8a56e27 libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854 pixman commit c89f4c826695dbb5df0817d84f845dbd3e28b7a7 fontconfig commit 604c2a683f1357fc65bad372b5d25a90099f827f mesa commit cfbfb50cb8d47b7f6975828b504936f9324f3b12
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rw-r--r--xorg-server/dix/dispatch.c88
1 files changed, 31 insertions, 57 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 71fda4893..4fecfea7b 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -1974,7 +1974,7 @@ ProcPutImage(ClientPtr client)
static int
DoGetImage(ClientPtr client, int format, Drawable drawable,
int x, int y, int width, int height,
- Mask planemask, xGetImageReply ** im_return)
+ Mask planemask)
{
DrawablePtr pDraw, pBoundingDraw;
int nlines, linesPerBuf, rc;
@@ -2074,46 +2074,32 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
xgi.length = length;
- if (im_return) {
- pBuf = calloc(1, sz_xGetImageReply + length);
- if (!pBuf)
- return BadAlloc;
- if (widthBytesLine == 0)
- linesPerBuf = 0;
- else
+ xgi.length = bytes_to_int32(xgi.length);
+ if (widthBytesLine == 0 || height == 0)
+ linesPerBuf = 0;
+ else if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
+ else {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
linesPerBuf = height;
- *im_return = (xGetImageReply *) pBuf;
- *(xGetImageReply *) pBuf = xgi;
- pBuf += sz_xGetImageReply;
}
- else {
- xgi.length = bytes_to_int32(xgi.length);
- if (widthBytesLine == 0 || height == 0)
- linesPerBuf = 0;
- else if (widthBytesLine >= IMAGE_BUFSIZE)
- linesPerBuf = 1;
- else {
- linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > height)
- linesPerBuf = height;
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height) {
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) &&
+ (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
+ linesPerBuf--;
+ length -= widthBytesLine;
}
- length = linesPerBuf * widthBytesLine;
- if (linesPerBuf < height) {
- /* we have to make sure intermediate buffers don't need padding */
- while ((linesPerBuf > 1) &&
- (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
- linesPerBuf--;
- length -= widthBytesLine;
- }
- while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
- linesPerBuf++;
- length += widthBytesLine;
- }
+ while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
+ linesPerBuf++;
+ length += widthBytesLine;
}
- if (!(pBuf = calloc(1, length)))
- return BadAlloc;
- WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
}
+ if (!(pBuf = calloc(1, length)))
+ return BadAlloc;
+ WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
if (pDraw->type == DRAWABLE_WINDOW) {
pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
@@ -2142,13 +2128,10 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
/* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
- if (!im_return) {
- ReformatImage(pBuf, (int) (nlines * widthBytesLine),
- BitsPerPixel(pDraw->depth), ClientOrder(client));
+ ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+ BitsPerPixel(pDraw->depth), ClientOrder(client));
-/* Don't split me, gcc pukes when you do */
- WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
- }
+ WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
}
@@ -2173,18 +2156,10 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
/* Note: NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
- if (im_return) {
- pBuf += nlines * widthBytesLine;
- }
- else {
- ReformatImage(pBuf,
- (int) (nlines * widthBytesLine),
- 1, ClientOrder(client));
-
-/* Don't split me, gcc pukes when you do */
- WriteToClient(client, (int) (nlines * widthBytesLine),
- pBuf);
- }
+ ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+ 1, ClientOrder(client));
+
+ WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
}
@@ -2192,8 +2167,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
}
if (pVisibleRegion)
RegionDestroy(pVisibleRegion);
- if (!im_return)
- free(pBuf);
+ free(pBuf);
return Success;
}
@@ -2207,7 +2181,7 @@ ProcGetImage(ClientPtr client)
return DoGetImage(client, stuff->format, stuff->drawable,
stuff->x, stuff->y,
(int) stuff->width, (int) stuff->height,
- stuff->planeMask, (xGetImageReply **) NULL);
+ stuff->planeMask);
}
int