2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
*
|
2004-12-04 01:43:13 +01:00
|
|
|
* Copyright © 2000 SuSE, Inc.
|
2003-11-14 17:48:57 +01:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
|
|
|
#include "os.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "colormapst.h"
|
|
|
|
#include "extnsionst.h"
|
2012-07-10 03:02:56 +02:00
|
|
|
#include "extinit.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "servermd.h"
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/extensions/render.h>
|
|
|
|
#include <X11/extensions/renderproto.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "picturestr.h"
|
|
|
|
#include "glyphstr.h"
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/Xfuncproto.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "cursorstr.h"
|
2007-08-31 15:55:27 +02:00
|
|
|
#include "xace.h"
|
2009-09-18 08:27:54 +02:00
|
|
|
#include "protocol-versions.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-12-01 01:34:38 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
#include "panoramiX.h"
|
|
|
|
#include "panoramiXsrv.h"
|
|
|
|
#endif
|
|
|
|
|
2007-01-09 14:14:19 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2010-04-27 02:22:21 +02:00
|
|
|
static DevPrivateKeyRec RenderClientPrivateKeyRec;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
#define RenderClientPrivateKey (&RenderClientPrivateKeyRec )
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
typedef struct _RenderClient {
|
2012-03-21 20:55:09 +01:00
|
|
|
int major_version;
|
|
|
|
int minor_version;
|
2003-11-14 17:48:57 +01:00
|
|
|
} RenderClientRec, *RenderClientPtr;
|
|
|
|
|
2007-08-28 15:28:25 +02:00
|
|
|
#define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey))
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
static void
|
2013-12-15 10:05:51 +01:00
|
|
|
RenderClientCallback(CallbackListPtr *list, void *closure, void *data)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
|
|
|
ClientPtr pClient = clientinfo->client;
|
|
|
|
RenderClientPtr pRenderClient = GetRenderClient(pClient);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pRenderClient->major_version = 0;
|
|
|
|
pRenderClient->minor_version = 0;
|
|
|
|
}
|
|
|
|
|
2010-04-25 08:56:36 +02:00
|
|
|
#ifdef PANORAMIX
|
2012-03-21 20:55:09 +01:00
|
|
|
RESTYPE XRT_PICTURE;
|
2010-04-25 08:56:36 +02:00
|
|
|
#endif
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
RenderExtensionInit(void)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
ExtensionEntry *extEntry;
|
|
|
|
|
|
|
|
if (!PictureType)
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!extEntry)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2003-11-14 17:48:57 +01:00
|
|
|
RenderErrBase = extEntry->errorBase;
|
2010-04-25 08:56:36 +02:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (XRT_PICTURE)
|
2012-03-21 20:55:09 +01:00
|
|
|
SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
|
2010-04-25 08:56:36 +02:00
|
|
|
#endif
|
|
|
|
SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture);
|
|
|
|
SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat);
|
|
|
|
SetResourceTypeErrorValue(GlyphSetType, RenderErrBase + BadGlyphSet);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderQueryVersion(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RenderClientPtr pRenderClient = GetRenderClient(client);
|
2012-07-10 04:12:43 +02:00
|
|
|
xRenderQueryVersionReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderQueryVersionReq);
|
|
|
|
|
|
|
|
pRenderClient->major_version = stuff->majorVersion;
|
|
|
|
pRenderClient->minor_version = stuff->minorVersion;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderQueryVersionReq);
|
2009-09-17 06:17:54 +02:00
|
|
|
|
|
|
|
if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
|
2012-03-21 20:55:09 +01:00
|
|
|
(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;
|
2009-09-17 06:17:54 +02:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.majorVersion);
|
|
|
|
swapl(&rep.minorVersion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static VisualPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
findVisual(ScreenPtr pScreen, VisualID vid)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
VisualPtr pVisual;
|
|
|
|
int v;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (v = 0; v < pScreen->numVisuals; v++) {
|
|
|
|
pVisual = pScreen->visuals + v;
|
|
|
|
if (pVisual->vid == vid)
|
|
|
|
return pVisual;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* REQUEST(xRenderQueryPictFormatsReq); */
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq);
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (noPanoramiXExtension)
|
2012-03-21 20:55:09 +01:00
|
|
|
numScreens = screenInfo.numScreens;
|
|
|
|
else
|
|
|
|
numScreens = ((xConnSetup *) ConnectionInfo)->numRoots;
|
2003-11-14 17:48:57 +01:00
|
|
|
#else
|
|
|
|
numScreens = screenInfo.numScreens;
|
|
|
|
#endif
|
|
|
|
ndepth = nformat = nvisual = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6)
|
2012-03-21 20:55:09 +01:00
|
|
|
numSubpixel = 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
numSubpixel = numScreens;
|
|
|
|
|
|
|
|
rlength = (sizeof(xRenderQueryPictFormatsReply) +
|
|
|
|
nformat * sizeof(xPictFormInfo) +
|
|
|
|
numScreens * sizeof(xPictScreen) +
|
|
|
|
ndepth * sizeof(xPictDepth) +
|
|
|
|
nvisual * sizeof(xPictVisual) + numSubpixel * sizeof(CARD32));
|
2010-05-05 20:44:06 +02:00
|
|
|
reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!reply)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
reply->type = X_Reply;
|
|
|
|
reply->sequenceNumber = client->sequence;
|
2009-07-06 04:27:23 +02:00
|
|
|
reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
|
2003-11-14 17:48:57 +01:00
|
|
|
reply->numFormats = nformat;
|
|
|
|
reply->numScreens = numScreens;
|
|
|
|
reply->numDepths = ndepth;
|
|
|
|
reply->numVisuals = nvisual;
|
|
|
|
reply->numSubpixel = numSubpixel;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
pictForm = (xPictFormInfo *) (reply + 1);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
pictScreen = (xPictScreen *) pictForm;
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
pictSubpixel = (CARD32 *) pictScreen;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, rlength, reply);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(reply);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderQueryPictIndexValues(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatPtr pFormat;
|
|
|
|
int rc, num;
|
|
|
|
int rlength;
|
|
|
|
int i;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderQueryPictIndexValuesReq);
|
|
|
|
xRenderQueryPictIndexValuesReply *reply;
|
2012-03-21 20:55:09 +01:00
|
|
|
xIndexValue *values;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq);
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->format,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
2009-04-29 07:04:37 +02:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pFormat->type != PictTypeIndexed) {
|
|
|
|
client->errorValue = stuff->format;
|
|
|
|
return BadMatch;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
num = pFormat->index.nvalues;
|
2012-03-21 20:55:09 +01:00
|
|
|
rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
|
|
|
|
num * sizeof(xIndexValue));
|
2012-07-10 04:12:42 +02:00
|
|
|
reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!reply)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
reply->type = X_Reply;
|
|
|
|
reply->sequenceNumber = client->sequence;
|
2009-07-06 04:27:23 +02:00
|
|
|
reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
|
2003-11-14 17:48:57 +01:00
|
|
|
reply->numIndexValues = num;
|
|
|
|
|
|
|
|
values = (xIndexValue *) (reply + 1);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, rlength, reply);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(reply);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderQueryDithers(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderCreatePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
DrawablePtr pDrawable;
|
|
|
|
PictFormatPtr pFormat;
|
|
|
|
int len, error, rc;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCreatePictureReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->pid, client);
|
2006-12-14 23:53:43 +01:00
|
|
|
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
|
2012-03-21 20:55:09 +01:00
|
|
|
DixReadAccess | DixAddAccess);
|
2006-12-14 23:53:43 +01:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2006-12-14 23:53:43 +01:00
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->format,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
2009-04-29 07:04:37 +02:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2009-04-29 07:04:37 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (pFormat->depth != pDrawable->depth)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
2009-07-06 04:27:23 +02:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (Ones(stuff->mask) != len)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
|
|
|
|
|
|
|
pPicture = CreatePicture(stuff->pid,
|
|
|
|
pDrawable,
|
|
|
|
pFormat,
|
|
|
|
stuff->mask, (XID *) (stuff + 1), client, &error);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!pPicture)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderChangePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderChangePictureReq);
|
|
|
|
int len;
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2009-07-06 04:27:23 +02:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (Ones(stuff->mask) != len)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
|
|
|
|
|
|
|
return ChangePicture(pPicture, stuff->mask, (XID *) (stuff + 1),
|
|
|
|
(DevUnion *) 0, client);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderSetPictureClipRectangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureClipRectanglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
int nr;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pPicture->pDrawable)
|
2014-04-10 17:34:28 +02:00
|
|
|
return RenderErrBase + BadPicture;
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2010-01-21 21:38:47 +01:00
|
|
|
nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (nr & 4)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
nr >>= 3;
|
2012-03-21 20:55:09 +01:00
|
|
|
return SetPictureClipRects(pPicture,
|
|
|
|
stuff->xOrigin, stuff->yOrigin,
|
|
|
|
nr, (xRectangle *) &stuff[1]);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderFreePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderFreePictureReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess);
|
|
|
|
FreeResource(stuff->picture, RT_NONE);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
PictOpValid(CARD8 op)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if ( /*PictOpMinimum <= op && */ op <= PictOpMaximum)
|
|
|
|
return TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2009-07-15 00:37:05 +02:00
|
|
|
if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderComposite(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pSrc, pMask, pDst;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCompositeReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderCompositeReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!PictOpValid(stuff->op)) {
|
|
|
|
client->errorValue = stuff->op;
|
|
|
|
return BadValue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderScale(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderTrapezoids(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int rc, ntraps;
|
|
|
|
PicturePtr pSrc, pDst;
|
|
|
|
PictFormatPtr pFormat;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderTrapezoidsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!PictOpValid(stuff->op)) {
|
|
|
|
client->errorValue = stuff->op;
|
|
|
|
return BadValue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
|
|
|
|
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
|
|
|
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
if (stuff->maskFormat) {
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
pFormat = 0;
|
|
|
|
ntraps = (client->req_len << 2) - sizeof(xRenderTrapezoidsReq);
|
|
|
|
if (ntraps % sizeof(xTrapezoid))
|
|
|
|
return BadLength;
|
|
|
|
ntraps /= sizeof(xTrapezoid);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (ntraps)
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeTrapezoids(stuff->op, pSrc, pDst, pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc,
|
2012-03-15 16:18:29 +01:00
|
|
|
ntraps, (xTrapezoid *) &stuff[1]);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderTriangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int rc, ntris;
|
|
|
|
PicturePtr pSrc, pDst;
|
|
|
|
PictFormatPtr pFormat;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderTrianglesReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!PictOpValid(stuff->op)) {
|
|
|
|
client->errorValue = stuff->op;
|
|
|
|
return BadValue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
|
|
|
|
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
|
|
|
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
if (stuff->maskFormat) {
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
pFormat = 0;
|
|
|
|
ntris = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
|
|
|
|
if (ntris % sizeof(xTriangle))
|
|
|
|
return BadLength;
|
|
|
|
ntris /= sizeof(xTriangle);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (ntris)
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeTriangles(stuff->op, pSrc, pDst, pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc,
|
2012-03-15 16:18:29 +01:00
|
|
|
ntris, (xTriangle *) &stuff[1]);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderTriStrip(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int rc, npoints;
|
|
|
|
PicturePtr pSrc, pDst;
|
|
|
|
PictFormatPtr pFormat;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderTrianglesReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!PictOpValid(stuff->op)) {
|
|
|
|
client->errorValue = stuff->op;
|
|
|
|
return BadValue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
|
|
|
|
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
|
|
|
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
if (stuff->maskFormat) {
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
pFormat = 0;
|
|
|
|
npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (npoints & 4)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
npoints >>= 3;
|
|
|
|
if (npoints >= 3)
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeTriStrip(stuff->op, pSrc, pDst, pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc,
|
2012-03-15 16:18:29 +01:00
|
|
|
npoints, (xPointFixed *) &stuff[1]);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderTriFan(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int rc, npoints;
|
|
|
|
PicturePtr pSrc, pDst;
|
|
|
|
PictFormatPtr pFormat;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderTrianglesReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!PictOpValid(stuff->op)) {
|
|
|
|
client->errorValue = stuff->op;
|
|
|
|
return BadValue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
|
|
|
|
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
|
|
|
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
if (stuff->maskFormat) {
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
pFormat = 0;
|
|
|
|
npoints = ((client->req_len << 2) - sizeof(xRenderTriStripReq));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (npoints & 4)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
npoints >>= 3;
|
|
|
|
if (npoints >= 3)
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeTriFan(stuff->op, pSrc, pDst, pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc,
|
2012-03-15 16:18:29 +01:00
|
|
|
npoints, (xPointFixed *) &stuff[1]);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderColorTrapezoids(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderColorTriangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderTransform(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderCreateGlyphSet(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
PictFormatPtr format;
|
|
|
|
int rc, f;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCreateGlyphSetReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->gsid, client);
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &format, stuff->format,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
2009-04-29 07:04:37 +02:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2009-04-29 07:04:37 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
switch (format->depth) {
|
|
|
|
case 1:
|
2012-03-21 20:55:09 +01:00
|
|
|
f = GlyphFormat1;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case 4:
|
2012-03-21 20:55:09 +01:00
|
|
|
f = GlyphFormat4;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case 8:
|
2012-03-21 20:55:09 +01:00
|
|
|
f = GlyphFormat8;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case 16:
|
2012-03-21 20:55:09 +01:00
|
|
|
f = GlyphFormat16;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
case 32:
|
2012-03-21 20:55:09 +01:00
|
|
|
f = GlyphFormat32;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
if (format->type != PictTypeDirect)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
glyphSet = AllocateGlyphSet(f, format);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!glyphSet)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2007-08-31 15:55:27 +02:00
|
|
|
/* security creation/labeling check */
|
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType,
|
2012-03-21 20:55:09 +01:00
|
|
|
glyphSet, RT_NONE, NULL, DixCreateAccess);
|
2007-08-31 15:55:27 +02:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderReferenceGlyphSet(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet;
|
2007-08-31 15:55:27 +02:00
|
|
|
int rc;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderReferenceGlyphSetReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->gsid, client);
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &glyphSet, stuff->existing,
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetType, client, DixGetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->existing;
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
glyphSet->refcnt++;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NLOCALDELTA 64
|
|
|
|
#define NLOCALGLYPH 256
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderFreeGlyphSet(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet;
|
2007-08-31 15:55:27 +02:00
|
|
|
int rc;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderFreeGlyphSetReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetType, client, DixDestroyAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->glyphset;
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeResource(stuff->glyphset, RT_NONE);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct _GlyphNew {
|
2012-03-21 20:55:09 +01:00
|
|
|
Glyph id;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
Bool found;
|
|
|
|
unsigned char sha1[20];
|
2003-11-14 17:48:57 +01:00
|
|
|
} GlyphNewRec, *GlyphNewPtr;
|
|
|
|
|
2007-08-03 07:48:32 +02:00
|
|
|
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderAddGlyphs(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderAddGlyphsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
err =
|
2013-12-15 10:05:51 +01:00
|
|
|
dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetType, client, DixAddAccess);
|
|
|
|
if (err != Success) {
|
|
|
|
client->errorValue = stuff->glyphset;
|
|
|
|
return err;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2007-08-31 15:55:27 +02:00
|
|
|
err = BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
nglyphs = stuff->nglyphs;
|
2007-01-09 14:14:19 +01:00
|
|
|
if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2007-01-09 14:14:19 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
component_alpha = NeedsComponent(glyphSet->format->format);
|
2007-08-03 07:48:32 +02:00
|
|
|
|
2007-07-31 02:31:47 +02:00
|
|
|
if (nglyphs <= NLOCALGLYPH) {
|
2012-03-21 20:55:09 +01:00
|
|
|
memset(glyphsLocal, 0, sizeof(glyphsLocal));
|
|
|
|
glyphsBase = glyphsLocal;
|
2007-07-31 02:31:47 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
glyphsBase = (GlyphNewPtr) calloc(nglyphs, sizeof(GlyphNewRec));
|
|
|
|
if (!glyphsBase)
|
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
remain = (client->req_len << 2) - sizeof(xRenderAddGlyphsReq);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
glyphs = glyphsBase;
|
|
|
|
|
|
|
|
gids = (CARD32 *) (stuff + 1);
|
|
|
|
gi = (xGlyphInfo *) (gids + nglyphs);
|
|
|
|
bits = (CARD8 *) (gi + nglyphs);
|
2012-03-21 20:55:09 +01:00
|
|
|
remain -= (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs;
|
2010-06-29 00:08:50 +02:00
|
|
|
|
|
|
|
/* protect against bad nglyphs */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (gi < ((xGlyphInfo *) stuff) ||
|
|
|
|
gi > ((xGlyphInfo *) ((CARD32 *) stuff + client->req_len)) ||
|
|
|
|
bits < ((CARD8 *) stuff) ||
|
|
|
|
bits > ((CARD8 *) ((CARD32 *) stuff + client->req_len))) {
|
2010-06-29 00:08:50 +02:00
|
|
|
err = BadLength;
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-05-05 10:47:24 +02:00
|
|
|
pDst = CreatePicture(0, &pDstPix->drawable,
|
2012-03-21 20:55:09 +01:00
|
|
|
glyphSet->format,
|
|
|
|
CPComponentAlpha, &component_alpha,
|
|
|
|
serverClient, &error);
|
2012-05-05 10:47:24 +02:00
|
|
|
SetGlyphPicture(glyph, pScreen, pDst);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
FreePicture((void *) pSrc, 0);
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2007-07-31 00:10:11 +02:00
|
|
|
for (i = 0; i < nglyphs; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddGlyph(glyphSet, glyphs[i].glyph, glyphs[i].id);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if (glyphsBase != glyphsLocal)
|
2012-03-21 20:55:09 +01:00
|
|
|
free(glyphsBase);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2012-03-21 20:55:09 +01:00
|
|
|
bail:
|
2007-08-02 00:48:30 +02:00
|
|
|
if (pSrc)
|
2013-12-15 10:05:51 +01:00
|
|
|
FreePicture((void *) pSrc, 0);
|
2007-08-02 00:48:30 +02:00
|
|
|
if (pSrcPix)
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeScratchPixmapHeader(pSrcPix);
|
2007-07-31 02:31:47 +02:00
|
|
|
for (i = 0; i < nglyphs; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
if (glyphs[i].glyph && !glyphs[i].found)
|
|
|
|
free(glyphs[i].glyph);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (glyphsBase != glyphsLocal)
|
2012-03-21 20:55:09 +01:00
|
|
|
free(glyphsBase);
|
2003-11-14 17:48:57 +01:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderAddGlyphsFromPicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderFreeGlyphs(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderFreeGlyphsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
int rc, nglyph;
|
|
|
|
CARD32 *gids;
|
|
|
|
CARD32 glyph;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetType, client, DixRemoveAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->glyphset;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
nglyph =
|
|
|
|
bytes_to_int32((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq));
|
2003-11-14 17:48:57 +01:00
|
|
|
gids = (CARD32 *) (stuff + 1);
|
2012-03-21 20:55:09 +01:00
|
|
|
while (nglyph-- > 0) {
|
|
|
|
glyph = *gids++;
|
|
|
|
if (!DeleteGlyph(glyphSet, glyph)) {
|
|
|
|
client->errorValue = glyph;
|
|
|
|
return RenderErrBase + BadGlyph;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCompositeGlyphsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
|
|
|
|
|
|
|
|
switch (stuff->renderReqType) {
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
|
|
|
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
|
|
|
if (stuff->maskFormat) {
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
|
2012-03-21 20:55:09 +01:00
|
|
|
PictFormatType, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
pFormat = 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetType, client, DixUseAccess);
|
2009-04-29 07:04:37 +02:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
buffer = (CARD8 *) (stuff + 1);
|
|
|
|
end = (CARD8 *) stuff + (client->req_len << 2);
|
|
|
|
nglyph = 0;
|
|
|
|
nlist = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
if (nglyph <= NLOCALGLYPH)
|
2012-03-21 20:55:09 +01:00
|
|
|
glyphsBase = glyphsLocal;
|
|
|
|
else {
|
|
|
|
glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof(GlyphPtr));
|
|
|
|
if (!glyphsBase)
|
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
if (nlist <= NLOCALDELTA)
|
2012-03-21 20:55:09 +01:00
|
|
|
listsBase = listsLocal;
|
|
|
|
else {
|
|
|
|
listsBase = (GlyphListPtr) malloc(nlist * sizeof(GlyphListRec));
|
|
|
|
if (!listsBase) {
|
|
|
|
rc = BadAlloc;
|
|
|
|
goto bail;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
buffer = (CARD8 *) (stuff + 1);
|
|
|
|
glyphs = glyphsBase;
|
|
|
|
lists = listsBase;
|
2012-03-21 20:55:09 +01:00
|
|
|
while (buffer + sizeof(xGlyphElt) < end) {
|
|
|
|
elt = (xGlyphElt *) buffer;
|
|
|
|
buffer += sizeof(xGlyphElt);
|
|
|
|
|
|
|
|
if (elt->len == 0xff) {
|
|
|
|
if (buffer + sizeof(GlyphSet) < end) {
|
2005-08-28 21:47:39 +02:00
|
|
|
memcpy(&gs, buffer, sizeof(GlyphSet));
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &glyphSet, gs,
|
2012-03-21 20:55:09 +01:00
|
|
|
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++;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2011-03-29 17:22:50 +02:00
|
|
|
if (buffer > end) {
|
2012-03-21 20:55:09 +01:00
|
|
|
rc = BadLength;
|
|
|
|
goto bail;
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositeGlyphs(stuff->op,
|
|
|
|
pSrc,
|
|
|
|
pDst,
|
|
|
|
pFormat,
|
|
|
|
stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase);
|
2011-03-29 17:22:50 +02:00
|
|
|
rc = Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
bail:
|
2003-11-14 17:48:57 +01:00
|
|
|
if (glyphsBase != glyphsLocal)
|
2012-03-21 20:55:09 +01:00
|
|
|
free(glyphsBase);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (listsBase != listsLocal)
|
2012-03-21 20:55:09 +01:00
|
|
|
free(listsBase);
|
2011-03-29 17:22:50 +02:00
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderFillRectangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pDst;
|
|
|
|
int things;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderFillRectanglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
|
|
|
|
if (!PictOpValid(stuff->op)) {
|
|
|
|
client->errorValue = stuff->op;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pDst->pDrawable)
|
|
|
|
return BadDrawable;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq);
|
|
|
|
if (things & 4)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
things >>= 3;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
CompositeRects(stuff->op,
|
|
|
|
pDst, &stuff->color, things, (xRectangle *) &stuff[1]);
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
RenderSetBit(unsigned char *line, int x, int bit)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
unsigned char mask;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (screenInfo.bitmapBitOrder == LSBFirst)
|
2012-03-21 20:55:09 +01:00
|
|
|
mask = (1 << (x & 7));
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
mask = (0x80 >> (x & 7));
|
2003-11-14 17:48:57 +01:00
|
|
|
/* XXX assumes byte order is host byte order */
|
|
|
|
line += (x >> 3);
|
|
|
|
if (bit)
|
2012-03-21 20:55:09 +01:00
|
|
|
*line |= mask;
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
*line &= ~mask;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define DITHER_DIM 2
|
|
|
|
|
|
|
|
static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = {
|
2012-03-21 20:55:09 +01:00
|
|
|
{1, 3,},
|
|
|
|
{4, 2,},
|
2003-11-14 17:48:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1)
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderCreateCursor(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateCursorReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
CursorMetricRec cm;
|
2012-03-21 20:55:09 +01:00
|
|
|
CursorPtr pCursor;
|
|
|
|
CARD32 twocolor[3];
|
|
|
|
int rc, ncolor;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
|
2003-11-14 17:48:57 +01:00
|
|
|
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pSrc->pDrawable)
|
|
|
|
return BadDrawable;
|
2003-11-14 17:48:57 +01:00
|
|
|
pScreen = pSrc->pDrawable->pScreen;
|
|
|
|
width = pSrc->pDrawable->width;
|
|
|
|
height = pSrc->pDrawable->height;
|
2012-03-21 20:55:09 +01:00
|
|
|
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));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!argbbits)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
stride = BitmapBytePad(width);
|
2012-03-21 20:55:09 +01:00
|
|
|
nbytes_mono = stride * height;
|
2010-05-05 20:44:06 +02:00
|
|
|
srcbits = calloc(1, nbytes_mono);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!srcbits) {
|
|
|
|
free(argbbits);
|
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
mskbits = calloc(1, nbytes_mono);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!mskbits) {
|
|
|
|
free(argbbits);
|
|
|
|
free(srcbits);
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pSrc->format == PICT_a8r8g8b8) {
|
|
|
|
(*pScreen->GetImage) (pSrc->pDrawable,
|
|
|
|
0, 0, width, height, ZPixmap,
|
2013-12-15 10:05:51 +01:00
|
|
|
0xffffffff, (void *) argbbits);
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
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,
|
2013-12-15 10:05:51 +01:00
|
|
|
0xffffffff, (void *) argbbits);
|
2012-03-21 20:55:09 +01:00
|
|
|
FreePicture(pPicture, 0);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Check whether the cursor can be directly supported by
|
|
|
|
* the core cursor code
|
|
|
|
*/
|
|
|
|
ncolor = 0;
|
|
|
|
argb = argbbits;
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* Convert argb image to two plane cursor
|
|
|
|
*/
|
|
|
|
srcline = srcbits;
|
|
|
|
mskline = mskbits;
|
|
|
|
argb = argbbits;
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Dither to white and black if the cursor has more than two colors
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
if (ncolor > 2) {
|
|
|
|
twocolor[0] = 0xff000000;
|
|
|
|
twocolor[1] = 0xffffffff;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
free(argbbits);
|
|
|
|
argbbits = 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#define GetByte(p,s) (((p) >> (s)) & 0xff)
|
|
|
|
#define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8))
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
cm.width = width;
|
|
|
|
cm.height = height;
|
|
|
|
cm.xhot = stuff->x;
|
|
|
|
cm.yhot = stuff->y;
|
2007-08-15 20:13:53 +02:00
|
|
|
rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm,
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2007-08-15 20:13:53 +02:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
goto bail;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
|
2012-03-21 20:55:09 +01:00
|
|
|
rc = BadAlloc;
|
|
|
|
goto bail;
|
2011-04-04 21:31:42 +02:00
|
|
|
}
|
2007-08-15 20:13:53 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2012-03-21 20:55:09 +01:00
|
|
|
bail:
|
2011-04-04 21:31:42 +02:00
|
|
|
free(srcbits);
|
|
|
|
free(mskbits);
|
|
|
|
return rc;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderSetPictureTransform(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureTransformReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
2012-03-15 16:18:29 +01:00
|
|
|
return SetPictureTransform(pPicture, (PictTransform *) &stuff->transform);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderQueryFilters(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
|
2006-12-14 23:53:43 +01:00
|
|
|
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
|
2012-03-21 20:55:09 +01:00
|
|
|
DixGetAttrAccess);
|
2006-12-14 23:53:43 +01:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
pScreen = pDrawable->pScreen;
|
|
|
|
nbytesName = 0;
|
|
|
|
nnames = 0;
|
|
|
|
ps = GetPictureScreenIfSet(pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2009-07-06 04:27:23 +02:00
|
|
|
len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
|
2012-03-21 20:55:09 +01:00
|
|
|
total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
|
2012-07-10 04:12:42 +02:00
|
|
|
reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!reply)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
aliases = (INT16 *) (reply + 1);
|
|
|
|
names = (char *) (aliases + ((nnames + 1) & ~1));
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
reply->type = X_Reply;
|
|
|
|
reply->sequenceNumber = client->sequence;
|
|
|
|
reply->length = len;
|
|
|
|
reply->numAliases = nnames;
|
|
|
|
reply->numFilters = nnames;
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, total_bytes, reply);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(reply);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderSetPictureFilter(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xRenderSetPictureFilterReq);
|
|
|
|
PicturePtr pPicture;
|
|
|
|
int result;
|
|
|
|
xFixed *params;
|
|
|
|
int nparams;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
|
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
2003-11-14 17:48:57 +01:00
|
|
|
name = (char *) (stuff + 1);
|
2009-07-06 04:27:23 +02:00
|
|
|
params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
|
2003-11-14 17:48:57 +01:00
|
|
|
nparams = ((xFixed *) stuff + client->req_len) - params;
|
2012-03-21 20:55:09 +01:00
|
|
|
result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
|
2003-11-14 17:48:57 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderCreateAnimCursor(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateAnimCursorReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
CursorPtr *cursors;
|
|
|
|
CARD32 *deltas;
|
|
|
|
CursorPtr pCursor;
|
|
|
|
int ncursor;
|
|
|
|
xAnimCursorElt *elt;
|
|
|
|
int i;
|
|
|
|
int ret;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq);
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
|
|
|
if (client->req_len & 1)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
|
|
|
ncursor =
|
|
|
|
(client->req_len -
|
|
|
|
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
|
|
|
|
cursors = malloc(ncursor * (sizeof(CursorPtr) + sizeof(CARD32)));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cursors)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
deltas = (CARD32 *) (cursors + ncursor);
|
|
|
|
elt = (xAnimCursorElt *) (stuff + 1);
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < ncursor; i++) {
|
2013-12-15 10:05:51 +01:00
|
|
|
ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor,
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(cursors);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (ret != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return ret;
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
|
2012-03-21 20:55:09 +01:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
2004-08-07 01:42:10 +02:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderAddTraps(ClientPtr client)
|
2004-08-07 01:42:10 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int ntraps;
|
|
|
|
PicturePtr pPicture;
|
|
|
|
|
2004-08-07 01:42:10 +02:00
|
|
|
REQUEST(xRenderAddTrapsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pPicture->pDrawable)
|
|
|
|
return BadDrawable;
|
2012-03-21 20:55:09 +01:00
|
|
|
ntraps = (client->req_len << 2) - sizeof(xRenderAddTrapsReq);
|
|
|
|
if (ntraps % sizeof(xTrap))
|
|
|
|
return BadLength;
|
|
|
|
ntraps /= sizeof(xTrap);
|
2004-08-07 01:42:10 +02:00
|
|
|
if (ntraps)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddTraps(pPicture,
|
2012-03-15 16:18:29 +01:00
|
|
|
stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-08-07 01:42:10 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
ProcRenderCreateSolidFill(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
int error = 0;
|
|
|
|
|
2005-07-01 12:05:43 +02:00
|
|
|
REQUEST(xRenderCreateSolidFillReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->pid, client);
|
|
|
|
|
|
|
|
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
|
|
|
|
if (!pPicture)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2007-08-31 15:55:27 +02:00
|
|
|
/* security creation/labeling check */
|
|
|
|
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture, RT_NONE, NULL, DixCreateAccess);
|
2007-08-31 15:55:27 +02:00
|
|
|
if (error != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2005-07-01 12:05:43 +02:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
ProcRenderCreateLinearGradient(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
int len;
|
|
|
|
int error = 0;
|
|
|
|
xFixed *stops;
|
|
|
|
xRenderColor *colors;
|
|
|
|
|
2005-07-01 12:05:43 +02:00
|
|
|
REQUEST(xRenderCreateLinearGradientReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->pid, client);
|
|
|
|
|
|
|
|
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
|
|
|
|
return BadLength;
|
|
|
|
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
|
2005-07-01 12:05:43 +02:00
|
|
|
return BadLength;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
stops = (xFixed *) (stuff + 1);
|
|
|
|
colors = (xRenderColor *) (stops + stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture = CreateLinearGradientPicture(stuff->pid, &stuff->p1, &stuff->p2,
|
|
|
|
stuff->nStops, stops, colors,
|
|
|
|
&error);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pPicture)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2007-08-31 15:55:27 +02:00
|
|
|
/* security creation/labeling check */
|
|
|
|
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture, RT_NONE, NULL, DixCreateAccess);
|
2007-08-31 15:55:27 +02:00
|
|
|
if (error != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2005-07-01 12:05:43 +02:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
ProcRenderCreateRadialGradient(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
int len;
|
|
|
|
int error = 0;
|
|
|
|
xFixed *stops;
|
|
|
|
xRenderColor *colors;
|
|
|
|
|
2005-07-01 12:05:43 +02:00
|
|
|
REQUEST(xRenderCreateRadialGradientReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->pid, client);
|
|
|
|
|
|
|
|
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
|
2005-07-01 12:05:43 +02:00
|
|
|
return BadLength;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
stops = (xFixed *) (stuff + 1);
|
|
|
|
colors = (xRenderColor *) (stops + stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture =
|
|
|
|
CreateRadialGradientPicture(stuff->pid, &stuff->inner, &stuff->outer,
|
|
|
|
stuff->inner_radius, stuff->outer_radius,
|
|
|
|
stuff->nStops, stops, colors, &error);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pPicture)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2007-08-31 15:55:27 +02:00
|
|
|
/* security creation/labeling check */
|
|
|
|
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture, RT_NONE, NULL, DixCreateAccess);
|
2007-08-31 15:55:27 +02:00
|
|
|
if (error != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2005-07-01 12:05:43 +02:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
ProcRenderCreateConicalGradient(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
int len;
|
|
|
|
int error = 0;
|
|
|
|
xFixed *stops;
|
|
|
|
xRenderColor *colors;
|
|
|
|
|
2005-07-01 12:05:43 +02:00
|
|
|
REQUEST(xRenderCreateConicalGradientReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
|
|
|
|
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->pid, client);
|
|
|
|
|
|
|
|
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
|
2005-07-01 12:05:43 +02:00
|
|
|
return BadLength;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
stops = (xFixed *) (stuff + 1);
|
|
|
|
colors = (xRenderColor *) (stops + stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture =
|
|
|
|
CreateConicalGradientPicture(stuff->pid, &stuff->center, stuff->angle,
|
|
|
|
stuff->nStops, stops, colors, &error);
|
2005-07-01 12:05:43 +02:00
|
|
|
if (!pPicture)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2007-08-31 15:55:27 +02:00
|
|
|
/* security creation/labeling check */
|
|
|
|
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
|
2012-03-21 20:55:09 +01:00
|
|
|
pPicture, RT_NONE, NULL, DixCreateAccess);
|
2007-08-31 15:55:27 +02:00
|
|
|
if (error != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return error;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2005-07-01 12:05:43 +02:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderDispatch(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (stuff->data < RenderNumberRequests)
|
2012-03-21 20:55:09 +01:00
|
|
|
return (*ProcRenderVector[stuff->data]) (client);
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadRequest;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderQueryVersion(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderQueryVersionReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->majorVersion);
|
|
|
|
swapl(&stuff->minorVersion);
|
2012-03-21 20:55:09 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderQueryPictFormats(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderQueryPictFormatsReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderQueryPictIndexValues(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderQueryPictIndexValuesReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->format);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderQueryDithers(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreatePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreatePictureReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->pid);
|
|
|
|
swapl(&stuff->drawable);
|
|
|
|
swapl(&stuff->format);
|
|
|
|
swapl(&stuff->mask);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderChangePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderChangePictureReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->picture);
|
|
|
|
swapl(&stuff->mask);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderSetPictureClipRectangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureClipRectanglesReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->picture);
|
|
|
|
swaps(&stuff->xOrigin);
|
|
|
|
swaps(&stuff->yOrigin);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestS(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderFreePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderFreePictureReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->picture);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderComposite(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCompositeReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->mask);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
|
|
|
swaps(&stuff->xMask);
|
|
|
|
swaps(&stuff->yMask);
|
|
|
|
swaps(&stuff->xDst);
|
|
|
|
swaps(&stuff->yDst);
|
|
|
|
swaps(&stuff->width);
|
|
|
|
swaps(&stuff->height);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderScale(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderScaleReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swapl(&stuff->colorScale);
|
|
|
|
swapl(&stuff->alphaScale);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
|
|
|
swaps(&stuff->xDst);
|
|
|
|
swaps(&stuff->yDst);
|
|
|
|
swaps(&stuff->width);
|
|
|
|
swaps(&stuff->height);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderTrapezoids(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderTrapezoidsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swapl(&stuff->maskFormat);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderTriangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderTrianglesReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swapl(&stuff->maskFormat);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderTriStrip(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderTriStripReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTriStripReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swapl(&stuff->maskFormat);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderTriFan(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderTriFanReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderTriFanReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swapl(&stuff->maskFormat);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderColorTrapezoids(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderColorTriangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderTransform(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreateGlyphSet(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateGlyphSetReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->gsid);
|
|
|
|
swapl(&stuff->format);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderReferenceGlyphSet(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderReferenceGlyphSetReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->gsid);
|
|
|
|
swapl(&stuff->existing);
|
2012-03-21 20:55:09 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderFreeGlyphSet(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderFreeGlyphSetReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->glyphset);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderAddGlyphs(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
register int i;
|
2012-03-21 20:55:09 +01:00
|
|
|
CARD32 *gids;
|
|
|
|
void *end;
|
2003-11-14 17:48:57 +01:00
|
|
|
xGlyphInfo *gi;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderAddGlyphsReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->glyphset);
|
|
|
|
swapl(&stuff->nglyphs);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (stuff->nglyphs & 0xe0000000)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
end = (CARD8 *) stuff + (client->req_len << 2);
|
|
|
|
gids = (CARD32 *) (stuff + 1);
|
|
|
|
gi = (xGlyphInfo *) (gids + stuff->nglyphs);
|
|
|
|
if ((char *) end - (char *) (gids + stuff->nglyphs) < 0)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2003-11-14 17:48:57 +01:00
|
|
|
if ((char *) end - (char *) (gi + stuff->nglyphs) < 0)
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderAddGlyphsFromPicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderFreeGlyphs(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderFreeGlyphsReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->glyphset);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCompositeGlyphs(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
xGlyphElt *elt;
|
|
|
|
CARD8 *buffer;
|
|
|
|
CARD8 *end;
|
|
|
|
int space;
|
|
|
|
int i;
|
|
|
|
int size;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCompositeGlyphsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
switch (stuff->renderReqType) {
|
2012-03-21 20:55:09 +01:00
|
|
|
default:
|
|
|
|
size = 1;
|
|
|
|
break;
|
|
|
|
case X_RenderCompositeGlyphs16:
|
|
|
|
size = 2;
|
|
|
|
break;
|
|
|
|
case X_RenderCompositeGlyphs32:
|
|
|
|
size = 4;
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swapl(&stuff->maskFormat);
|
|
|
|
swapl(&stuff->glyphset);
|
|
|
|
swaps(&stuff->xSrc);
|
|
|
|
swaps(&stuff->ySrc);
|
2003-11-14 17:48:57 +01:00
|
|
|
buffer = (CARD8 *) (stuff + 1);
|
|
|
|
end = (CARD8 *) stuff + (client->req_len << 2);
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderFillRectangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderFillRectanglesReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderFillRectanglesReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->dst);
|
|
|
|
swaps(&stuff->color.red);
|
|
|
|
swaps(&stuff->color.green);
|
|
|
|
swaps(&stuff->color.blue);
|
|
|
|
swaps(&stuff->color.alpha);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestS(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreateCursor(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateCursorReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xRenderCreateCursorReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->cid);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
swaps(&stuff->x);
|
|
|
|
swaps(&stuff->y);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderSetPictureTransform(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureTransformReq);
|
|
|
|
REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->picture);
|
|
|
|
swapl(&stuff->transform.matrix11);
|
|
|
|
swapl(&stuff->transform.matrix12);
|
|
|
|
swapl(&stuff->transform.matrix13);
|
|
|
|
swapl(&stuff->transform.matrix21);
|
|
|
|
swapl(&stuff->transform.matrix22);
|
|
|
|
swapl(&stuff->transform.matrix23);
|
|
|
|
swapl(&stuff->transform.matrix31);
|
|
|
|
swapl(&stuff->transform.matrix32);
|
|
|
|
swapl(&stuff->transform.matrix33);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderQueryFilters(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xRenderQueryFiltersReq);
|
|
|
|
REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->drawable);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderSetPictureFilter(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xRenderSetPictureFilterReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->picture);
|
|
|
|
swaps(&stuff->nbytes);
|
2003-11-14 17:48:57 +01:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreateAnimCursor(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xRenderCreateAnimCursorReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->cid);
|
2003-11-14 17:48:57 +01:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2004-08-07 01:42:10 +02:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderAddTraps(ClientPtr client)
|
2004-08-07 01:42:10 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xRenderAddTrapsReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
|
2004-08-07 01:42:10 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->picture);
|
|
|
|
swaps(&stuff->xOff);
|
|
|
|
swaps(&stuff->yOff);
|
2004-08-07 01:42:10 +02:00
|
|
|
SwapRestL(stuff);
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2005-07-01 12:05:43 +02:00
|
|
|
static int
|
|
|
|
SProcRenderCreateSolidFill(ClientPtr client)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xRenderCreateSolidFillReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->pid);
|
|
|
|
swaps(&stuff->color.alpha);
|
|
|
|
swaps(&stuff->color.red);
|
|
|
|
swaps(&stuff->color.green);
|
|
|
|
swaps(&stuff->color.blue);
|
2005-07-01 12:05:43 +02:00
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static void
|
|
|
|
swapStops(void *stuff, int num)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
2011-08-04 21:35:41 +02:00
|
|
|
int i;
|
2005-07-01 12:05:43 +02:00
|
|
|
CARD32 *stops;
|
|
|
|
CARD16 *colors;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
stops = (CARD32 *) (stuff);
|
2008-06-10 20:23:03 +02:00
|
|
|
for (i = 0; i < num; ++i) {
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(stops);
|
2005-07-01 12:05:43 +02:00
|
|
|
++stops;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
colors = (CARD16 *) (stops);
|
|
|
|
for (i = 0; i < 4 * num; ++i) {
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(colors);
|
2010-11-02 20:10:32 +01:00
|
|
|
++colors;
|
2005-07-01 12:05:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreateLinearGradient(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
|
|
|
int len;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
REQUEST(xRenderCreateLinearGradientReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->pid);
|
|
|
|
swapl(&stuff->p1.x);
|
|
|
|
swapl(&stuff->p1.y);
|
|
|
|
swapl(&stuff->p2.x);
|
|
|
|
swapl(&stuff->p2.y);
|
|
|
|
swapl(&stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
|
|
|
|
return BadLength;
|
|
|
|
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
|
2005-07-01 12:05:43 +02:00
|
|
|
return BadLength;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
swapStops(stuff + 1, stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreateRadialGradient(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
|
|
|
int len;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
REQUEST(xRenderCreateRadialGradientReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->pid);
|
|
|
|
swapl(&stuff->inner.x);
|
|
|
|
swapl(&stuff->inner.y);
|
|
|
|
swapl(&stuff->outer.x);
|
|
|
|
swapl(&stuff->outer.y);
|
|
|
|
swapl(&stuff->inner_radius);
|
|
|
|
swapl(&stuff->outer_radius);
|
|
|
|
swapl(&stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
|
|
|
|
return BadLength;
|
|
|
|
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
|
2005-07-01 12:05:43 +02:00
|
|
|
return BadLength;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
swapStops(stuff + 1, stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderCreateConicalGradient(ClientPtr client)
|
2005-07-01 12:05:43 +02:00
|
|
|
{
|
|
|
|
int len;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
REQUEST(xRenderCreateConicalGradientReq);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->pid);
|
|
|
|
swapl(&stuff->center.x);
|
|
|
|
swapl(&stuff->center.y);
|
|
|
|
swapl(&stuff->angle);
|
|
|
|
swapl(&stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
|
|
|
|
return BadLength;
|
|
|
|
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
|
2005-07-01 12:05:43 +02:00
|
|
|
return BadLength;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
swapStops(stuff + 1, stuff->nStops);
|
2005-07-01 12:05:43 +02:00
|
|
|
|
|
|
|
return (*ProcRenderVector[stuff->renderReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcRenderDispatch(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (stuff->data < RenderNumberRequests)
|
2012-03-21 20:55:09 +01:00
|
|
|
return (*SProcRenderVector[stuff->data]) (client);
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadRequest;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
2010-05-06 20:00:38 +02:00
|
|
|
#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
|
2013-12-15 10:05:51 +01:00
|
|
|
int rc = dixLookupResourceByType((void **)&(pPicture), pid,\
|
2009-04-29 07:04:37 +02:00
|
|
|
XRT_PICTURE, client, mode);\
|
|
|
|
if (rc != Success)\
|
2010-04-25 08:56:36 +02:00
|
|
|
return rc;\
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\
|
2003-11-14 17:48:57 +01:00
|
|
|
if (pid == None) \
|
|
|
|
pPicture = 0; \
|
|
|
|
else { \
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_XIN_PICTURE(pPicture, pid, client, mode); \
|
2003-11-14 17:48:57 +01:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int (*PanoramiXSaveRenderVector[RenderNumberRequests]) (ClientPtr);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderCreatePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreatePictureReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *refDraw, *newPict;
|
|
|
|
int result, j;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
|
2013-12-15 10:05:51 +01:00
|
|
|
result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
|
2012-03-21 20:55:09 +01:00
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
2009-04-29 07:04:37 +02:00
|
|
|
if (result != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
|
|
|
if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2003-11-14 17:48:57 +01:00
|
|
|
newPict->type = XRT_PICTURE;
|
2011-03-09 05:53:26 +01:00
|
|
|
panoramix_setup_ids(newPict, client, stuff->pid);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (refDraw->type == XRT_WINDOW &&
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->drawable == screenInfo.screens[0]->root->drawable.id) {
|
|
|
|
newPict->u.pict.root = TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
newPict->u.pict.root = FALSE;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->pid = newPict->info[j].id;
|
|
|
|
stuff->drawable = refDraw->info[j].id;
|
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
|
|
|
|
else
|
|
|
|
free(newPict);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderChangePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *pict;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderChangePictureReq);
|
|
|
|
|
2010-01-21 21:38:47 +01:00
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->picture = pict->info[j].id;
|
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderChangePicture]) (client);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (result != Success)
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderSetPictureClipRectangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureClipRectanglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
PanoramiXRes *pict;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->picture = pict->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result =
|
|
|
|
(*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles])
|
|
|
|
(client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderSetPictureTransform(ClientPtr client)
|
2003-11-25 20:29:01 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureTransformReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
PanoramiXRes *pict;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->picture = pict->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result =
|
|
|
|
(*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderSetPictureFilter(ClientPtr client)
|
2003-11-25 20:29:01 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderSetPictureFilterReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
PanoramiXRes *pict;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->picture = pict->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result =
|
|
|
|
(*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderFreePicture(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
PanoramiXRes *pict;
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderFreePictureReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->picture;
|
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->picture = pict->info[j].id;
|
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Since ProcRenderFreePicture is using FreeResource, it will free
|
2012-03-21 20:55:09 +01:00
|
|
|
our resource for us on the last pass through the loop above */
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderComposite(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *src, *msk, *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
xRenderCompositeReq orig;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCompositeReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRenderCompositeReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess);
|
|
|
|
VERIFY_XIN_ALPHA(msk, stuff->mask, client, DixReadAccess);
|
|
|
|
VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
orig = *stuff;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderCompositeGlyphs(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *src, *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderCompositeGlyphsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
xGlyphElt origElt, *elt;
|
|
|
|
INT16 xSrc, ySrc;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderFillRectangles(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
REQUEST(xRenderFillRectanglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static int
|
|
|
|
PanoramiXRenderTrapezoids(ClientPtr client)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *src, *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
REQUEST(xRenderTrapezoidsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
stuff->src = src->info[j].id;
|
|
|
|
stuff->dst = dst->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client);
|
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(extra);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
PanoramiXRenderTriangles(ClientPtr client)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *src, *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
REQUEST(xRenderTrianglesReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
stuff->src = src->info[j].id;
|
|
|
|
stuff->dst = dst->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client);
|
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(extra);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
PanoramiXRenderTriStrip(ClientPtr client)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *src, *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
REQUEST(xRenderTriStripReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
stuff->src = src->info[j].id;
|
|
|
|
stuff->dst = dst->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client);
|
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(extra);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
PanoramiXRenderTriFan(ClientPtr client)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *src, *dst;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
REQUEST(xRenderTriFanReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
stuff->src = src->info[j].id;
|
|
|
|
stuff->dst = dst->info[j].id;
|
2012-03-21 20:55:09 +01:00
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client);
|
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(extra);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-08-07 01:42:10 +02:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderAddTraps(ClientPtr client)
|
2004-08-07 01:42:10 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *picture;
|
|
|
|
int result = Success, j;
|
|
|
|
|
2004-08-07 01:42:10 +02:00
|
|
|
REQUEST(xRenderAddTrapsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
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);
|
2004-08-07 01:42:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-01-30 04:07:03 +01:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderCreateSolidFill(ClientPtr client)
|
2010-01-30 04:07:03 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateSolidFillReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *newPict;
|
|
|
|
int result = Success, j;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
newPict->type = XRT_PICTURE;
|
2011-03-09 05:53:26 +01:00
|
|
|
panoramix_setup_ids(newPict, client, stuff->pid);
|
2010-01-30 04:07:03 +01:00
|
|
|
newPict->u.pict.root = FALSE;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-01-30 04:07:03 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->pid = newPict->info[j].id;
|
|
|
|
result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-30 04:07:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
free(newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderCreateLinearGradient(ClientPtr client)
|
2010-01-30 04:07:03 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateLinearGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *newPict;
|
|
|
|
int result = Success, j;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
newPict->type = XRT_PICTURE;
|
2011-03-09 05:53:26 +01:00
|
|
|
panoramix_setup_ids(newPict, client, stuff->pid);
|
2010-01-30 04:07:03 +01:00
|
|
|
newPict->u.pict.root = FALSE;
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->pid = newPict->info[j].id;
|
|
|
|
result =
|
|
|
|
(*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-30 04:07:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
free(newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderCreateRadialGradient(ClientPtr client)
|
2010-01-30 04:07:03 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateRadialGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *newPict;
|
|
|
|
int result = Success, j;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
newPict->type = XRT_PICTURE;
|
2011-03-09 05:53:26 +01:00
|
|
|
panoramix_setup_ids(newPict, client, stuff->pid);
|
2010-01-30 04:07:03 +01:00
|
|
|
newPict->u.pict.root = FALSE;
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->pid = newPict->info[j].id;
|
|
|
|
result =
|
|
|
|
(*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-30 04:07:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
free(newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderCreateConicalGradient(ClientPtr client)
|
2010-01-30 04:07:03 +01:00
|
|
|
{
|
|
|
|
REQUEST(xRenderCreateConicalGradientReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRes *newPict;
|
|
|
|
int result = Success, j;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
newPict->type = XRT_PICTURE;
|
2011-03-09 05:53:26 +01:00
|
|
|
panoramix_setup_ids(newPict, client, stuff->pid);
|
2010-01-30 04:07:03 +01:00
|
|
|
newPict->u.pict.root = FALSE;
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->pid = newPict->info[j].id;
|
|
|
|
result =
|
|
|
|
(*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient])
|
|
|
|
(client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-30 04:07:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
free(newPict);
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderInit(void)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
XRT_PICTURE = CreateNewResourceType(XineramaDeleteResource,
|
|
|
|
"XineramaPicture");
|
2010-04-25 08:56:36 +02:00
|
|
|
if (RenderErrBase)
|
2012-03-21 20:55:09 +01:00
|
|
|
SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
|
2003-11-14 17:48:57 +01:00
|
|
|
for (i = 0; i < RenderNumberRequests; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* Stuff in Xinerama aware request processing hooks
|
|
|
|
*/
|
|
|
|
ProcRenderVector[X_RenderCreatePicture] = PanoramiXRenderCreatePicture;
|
|
|
|
ProcRenderVector[X_RenderChangePicture] = PanoramiXRenderChangePicture;
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderVector[X_RenderSetPictureTransform] =
|
|
|
|
PanoramiXRenderSetPictureTransform;
|
|
|
|
ProcRenderVector[X_RenderSetPictureFilter] =
|
|
|
|
PanoramiXRenderSetPictureFilter;
|
|
|
|
ProcRenderVector[X_RenderSetPictureClipRectangles] =
|
|
|
|
PanoramiXRenderSetPictureClipRectangles;
|
2003-11-14 17:48:57 +01:00
|
|
|
ProcRenderVector[X_RenderFreePicture] = PanoramiXRenderFreePicture;
|
|
|
|
ProcRenderVector[X_RenderComposite] = PanoramiXRenderComposite;
|
|
|
|
ProcRenderVector[X_RenderCompositeGlyphs8] = PanoramiXRenderCompositeGlyphs;
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderVector[X_RenderCompositeGlyphs16] =
|
|
|
|
PanoramiXRenderCompositeGlyphs;
|
|
|
|
ProcRenderVector[X_RenderCompositeGlyphs32] =
|
|
|
|
PanoramiXRenderCompositeGlyphs;
|
2003-11-14 17:48:57 +01:00
|
|
|
ProcRenderVector[X_RenderFillRectangles] = PanoramiXRenderFillRectangles;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
ProcRenderVector[X_RenderTrapezoids] = PanoramiXRenderTrapezoids;
|
|
|
|
ProcRenderVector[X_RenderTriangles] = PanoramiXRenderTriangles;
|
|
|
|
ProcRenderVector[X_RenderTriStrip] = PanoramiXRenderTriStrip;
|
|
|
|
ProcRenderVector[X_RenderTriFan] = PanoramiXRenderTriFan;
|
2004-08-07 01:42:10 +02:00
|
|
|
ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps;
|
2010-01-30 04:07:03 +01:00
|
|
|
|
|
|
|
ProcRenderVector[X_RenderCreateSolidFill] = PanoramiXRenderCreateSolidFill;
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderVector[X_RenderCreateLinearGradient] =
|
|
|
|
PanoramiXRenderCreateLinearGradient;
|
|
|
|
ProcRenderVector[X_RenderCreateRadialGradient] =
|
|
|
|
PanoramiXRenderCreateRadialGradient;
|
|
|
|
ProcRenderVector[X_RenderCreateConicalGradient] =
|
|
|
|
PanoramiXRenderCreateConicalGradient;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXRenderReset(void)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
for (i = 0; i < RenderNumberRequests; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
|
2010-04-25 08:56:36 +02:00
|
|
|
RenderErrBase = 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
#endif /* PANORAMIX */
|