Commit a5f71f08 authored by Mike Gabriel's avatar Mike Gabriel

NXAGENT_UPGRADE code cleanup:

NX agent contains/ed two build trees. An old one (probably pre-3.x.y) and a "newer" one. The "newer" code tree used to become enabled by setting NXUpgradeAgentServer in nx-X11/config/cf/host.def to YES. As building the NXUpgradeAgentServer has been the default for years now, we drop all code that does not get used at build time for NXUpgradeAgentServer == YES (i.e., the code that belongs to the pre-3.x.y phase of NX agent).
parent fad840cf
......@@ -89,13 +89,6 @@ XCOMM $XFree86: xc/config/cf/xf86site.def,v 3.186 2003/06/25 18:06:22 eich Exp $
*/
#define NXAgentServer YES
/*
* Assume the new build tree.
*
#define NXUpgradeAgentServer NO
*/
#define NXUpgradeAgentServer YES
#ifdef NXAgentServer
#define BuildRenderLibrary YES
#define SharedLibFreetype2 YES
......
......@@ -24,18 +24,8 @@
#include "Options.h"
#include "Windows.h"
#undef NXAGENT_UPGRADE
#ifndef NXAGENT_UPGRADE
#include "NXcomposite.h"
#else
#include "composite.h"
#endif
/*
* Set here the required log level.
*/
......
......@@ -185,18 +185,12 @@ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
# NXAGENT FULLSCREEN Fullscreen mode
#
#if NXUpgradeAgentServer
UPG_DEFINES=-DNXAGENT_UPGRADE
#else
UPG_DEFINES=
#endif
#if nxVersion
NX_DEFINES=-DNX_VERSION_CURRENT="$(NX_VERSION_CURRENT)" \
-DNX_VERSION_CURRENT_STRING="\"$(NX_VERSION_CURRENT_STRING)\""
#endif
DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) $(NX_DEFINES) \
DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \
-UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER \
-DNXAGENT_SERVER \
-DNXAGENT_CONSTRAINCURSOR \
......
......@@ -135,8 +135,6 @@ void OsVendorEndRedirectErrorFFunction();
static void nxagentGrabServerCallback(CallbackListPtr *callbacks, pointer data,
pointer args);
#ifdef NXAGENT_UPGRADE
void ddxInitGlobals(void)
{
/*
......@@ -149,8 +147,6 @@ void ddxInitGlobals(void)
OsVendorEndRedirectErrorFProc = OsVendorEndRedirectErrorFFunction;
}
#endif
/*
* Set if the remote display supports
* backing store.
......@@ -476,14 +472,10 @@ void ddxGiveUp()
AbortDDX();
}
#ifdef NXAGENT_UPGRADE
void ddxBeforeReset(void)
{
}
#endif
void OsVendorInit()
{
return;
......
#ifndef NXAGENT_UPGRADE
/*
* $Id: Xcomposite.c,v 1.2 2005/07/03 07:00:56 daniels Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef NXAGENT_SERVER
#include "NXcompositeint.h"
#else
#include "compositeint.h"
#endif
XCompositeExtInfo XCompositeExtensionInfo;
const char XCompositeExtensionName[] = COMPOSITE_NAME;
/*
* XCompositeExtRemoveDisplay - remove the indicated display from the
* extension object. (Replaces XextRemoveDisplay.)
*/
static int
XCompositeExtRemoveDisplay (XCompositeExtInfo *extinfo, Display *dpy)
{
XCompositeExtDisplayInfo *info, *prev;
/*
* locate this display and its back link so that it can be removed
*/
_XLockMutex(_Xglobal_lock);
prev = NULL;
for (info = extinfo->head; info; info = info->next) {
if (info->display == dpy) break;
prev = info;
}
if (!info) {
_XUnlockMutex(_Xglobal_lock);
return 0; /* hmm, actually an error */
}
/*
* remove the display from the list; handles going to zero
*/
if (prev)
prev->next = info->next;
else
extinfo->head = info->next;
extinfo->ndisplays--;
if (info == extinfo->cur) extinfo->cur = NULL; /* flush cache */
_XUnlockMutex(_Xglobal_lock);
Xfree ((char *) info);
return 1;
}
static int
XCompositeCloseDisplay (Display *dpy, XExtCodes *codes)
{
return XCompositeExtRemoveDisplay (&XCompositeExtensionInfo, dpy);
}
/*
* XCompositeExtAddDisplay - add a display to this extension. (Replaces
* XextAddDisplay)
*/
static XCompositeExtDisplayInfo *
XCompositeExtAddDisplay (XCompositeExtInfo *extinfo,
Display *dpy,
const char *ext_name)
{
XCompositeExtDisplayInfo *info;
#ifndef NXAGENT_SERVER
int ev;
#endif
info = (XCompositeExtDisplayInfo *) Xmalloc (sizeof (XCompositeExtDisplayInfo));
if (!info) return NULL;
info->display = dpy;
info->codes = XInitExtension (dpy, ext_name);
/*
* if the server has the extension, then we can initialize the
* appropriate function vectors
*/
if (info->codes) {
xCompositeQueryVersionReply rep;
xCompositeQueryVersionReq *req;
XESetCloseDisplay (dpy, info->codes->extension,
XCompositeCloseDisplay);
/*
* Get the version info
*/
LockDisplay (dpy);
GetReq (CompositeQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeQueryVersion;
req->majorVersion = COMPOSITE_MAJOR;
req->minorVersion = COMPOSITE_MINOR;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue))
{
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
info->major_version = rep.majorVersion;
info->minor_version = rep.minorVersion;
UnlockDisplay (dpy);
} else {
/* The server doesn't have this extension.
* Use a private Xlib-internal extension to hang the close_display
* hook on so that the "cache" (extinfo->cur) is properly cleaned.
* (XBUG 7955)
*/
XExtCodes *codes = XAddExtension(dpy);
if (!codes) {
XFree(info);
return NULL;
}
XESetCloseDisplay (dpy, codes->extension, XCompositeCloseDisplay);
}
/*
* now, chain it onto the list
*/
_XLockMutex(_Xglobal_lock);
info->next = extinfo->head;
extinfo->head = info;
extinfo->cur = info;
extinfo->ndisplays++;
_XUnlockMutex(_Xglobal_lock);
return info;
}
/*
* XCompositeExtFindDisplay - look for a display in this extension; keeps a
* cache of the most-recently used for efficiency. (Replaces
* XextFindDisplay.)
*/
static XCompositeExtDisplayInfo *
XCompositeExtFindDisplay (XCompositeExtInfo *extinfo,
Display *dpy)
{
XCompositeExtDisplayInfo *info;
/*
* see if this was the most recently accessed display
*/
if ((info = extinfo->cur) && info->display == dpy)
return info;
/*
* look for display in list
*/
_XLockMutex(_Xglobal_lock);
for (info = extinfo->head; info; info = info->next) {
if (info->display == dpy) {
extinfo->cur = info; /* cache most recently used */
_XUnlockMutex(_Xglobal_lock);
return info;
}
}
_XUnlockMutex(_Xglobal_lock);
return NULL;
}
XCompositeExtDisplayInfo *
XCompositeFindDisplay (Display *dpy)
{
XCompositeExtDisplayInfo *info;
info = XCompositeExtFindDisplay (&XCompositeExtensionInfo, dpy);
if (!info)
info = XCompositeExtAddDisplay (&XCompositeExtensionInfo, dpy,
XCompositeExtensionName);
return info;
}
Bool
XCompositeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
if (XCompositeHasExtension(info))
{
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
return True;
}
else
return False;
}
Status
XCompositeQueryVersion (Display *dpy,
int *major_versionp,
int *minor_versionp)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
XCompositeCheckExtension (dpy, info, 0);
*major_versionp = info->major_version;
*minor_versionp = info->minor_version;
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
int
XCompositeVersion (void)
{
return XCOMPOSITE_VERSION;
}
void
XCompositeRedirectWindow (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeRedirectWindowReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeRedirectWindow, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeRedirectWindow;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
void
XCompositeRedirectSubwindows (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeRedirectSubwindowsReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeRedirectSubwindows, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeRedirectSubwindows;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
void
XCompositeUnredirectWindow (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeUnredirectWindowReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeUnredirectWindow, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeUnredirectWindow;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
void
XCompositeUnredirectSubwindows (Display *dpy, Window window, int update)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeUnredirectSubwindowsReq *req;
XCompositeSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (CompositeUnredirectSubwindows, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeUnredirectSubwindows;
req->window = window;
req->update = update;
UnlockDisplay (dpy);
SyncHandle ();
}
XserverRegion
XCompositeCreateRegionFromBorderClip (Display *dpy, Window window)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeCreateRegionFromBorderClipReq *req;
XserverRegion region;
XCompositeCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (CompositeCreateRegionFromBorderClip, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeCreateRegionFromBorderClip;
req->window = window;
region = req->region = XAllocID (dpy);
UnlockDisplay (dpy);
SyncHandle ();
#ifdef NXAGENT_SERVER
return region;
#else
return region;
#endif
}
Pixmap
XCompositeNameWindowPixmap (Display *dpy, Window window)
{
XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy);
xCompositeNameWindowPixmapReq *req;
Pixmap pixmap;
XCompositeCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (CompositeNameWindowPixmap, req);
req->reqType = info->codes->major_opcode;
req->compositeReqType = X_CompositeNameWindowPixmap;
req->window = window;
pixmap = req->pixmap = XAllocID (dpy);
UnlockDisplay (dpy);
SyncHandle ();
return pixmap;
}
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: Xcomposite.h,v 1.3 2005/07/03 07:00:56 daniels Exp $
*
......@@ -82,5 +80,3 @@ XCompositeNameWindowPixmap (Display *dpy, Window window);
_XFUNCPROTOEND
#endif /* _XCOMPOSITE_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: composite.h,v 1.4 2004/07/08 07:20:55 keithp Exp $
*
......@@ -51,5 +49,3 @@
#define CompositeNumberRequests (X_CompositeNameWindowPixmap + 1)
#endif /* _COMPOSITE_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: xcompositeint.h,v 1.3 2005/07/12 03:10:35 keithp Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _XDAMAGEINT_H_
#define _XDAMAGEINT_H_
#define NEED_EVENTS
#define NEED_REPLIES
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#ifdef NXAGENT_SERVER
#include "NXcompositeproto.h"
#include "NXcomposite.h"
#else
#include <X11/extensions/compositeproto.h>
#include <X11/extensions/Xcomposite.h>
#endif
typedef struct _XCompositeExtDisplayInfo {
struct _XCompositeExtDisplayInfo *next; /* keep a linked list */
Display *display; /* which display this is */
XExtCodes *codes; /* the extension protocol codes */
int major_version; /* -1 means we don't know */
int minor_version; /* -1 means we don't know */
} XCompositeExtDisplayInfo;
/* replaces XExtensionInfo */
typedef struct _XCompositeExtInfo {
XCompositeExtDisplayInfo *head; /* start of the list */
XCompositeExtDisplayInfo *cur; /* most recently used */
int ndisplays; /* number of displays */
} XCompositeExtInfo;
extern XCompositeExtInfo XCompositeExtensionInfo;
extern const char XCompositeExtensionName[];
XCompositeExtDisplayInfo *
XCompositeFindDisplay (Display *dpy);
#define XCompositeHasExtension(i) ((i) && ((i)->codes))
#define XCompositeCheckExtension(dpy,i,val) \
if (!XCompositeHasExtension(i)) { return val; }
#define XCompositeSimpleCheckExtension(dpy,i) \
if (!XCompositeHasExtension(i)) { return; }
#endif /* _XDAMAGEINT_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifndef NXAGENT_UPGRADE
/*
* $Id: compositeproto.h,v 1.4 2004/07/08 07:20:55 keithp Exp $
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _COMPOSITEPROTO_H_
#define _COMPOSITEPROTO_H_
#include <X11/Xmd.h>
#ifdef NXAGENT_SERVER
#include "NXcomposite.h"
#else
#include <X11/extensions/composite.h>
#endif
#define Window CARD32
#define Region CARD32
/*
* requests and replies
*/
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
} xCompositeQueryVersionReq;
#define sz_xCompositeQueryVersionReq 12
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xCompositeQueryVersionReply;
#define sz_xCompositeQueryVersionReply 32
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeRedirectWindowReq;
#define sz_xCompositeRedirectWindowReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeRedirectSubwindowsReq;
#define sz_xCompositeRedirectSubwindowsReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeUnredirectWindowReq;
#define sz_xCompositeUnredirectWindowReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
CARD8 update;
CARD8 pad1;
CARD16 pad2 B16;
} xCompositeUnredirectSubwindowsReq;
#define sz_xCompositeUnredirectSubwindowsReq 12
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Region region B32;
Window window B32;
} xCompositeCreateRegionFromBorderClipReq;
#define sz_xCompositeCreateRegionFromBorderClipReq 12
/* Version 0.2 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length;
Window window B32;
Pixmap pixmap B32;
} xCompositeNameWindowPixmapReq;
#define sz_xCompositeNameWindowPixmapReq 12
#undef Window
#undef Region
#endif /* _COMPOSITEPROTO_H_ */
#endif /* #ifndef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXextension.c"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
......@@ -21,7 +15,7 @@
/* */
/**************************************************************************/
/* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.12 2002/02/19 11:09:22 alanh Exp $ */
/* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.11 2001/12/14 19:59:31 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
......@@ -70,10 +64,14 @@ SOFTWARE.
******************************************************************/
/* $Xorg: extension.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include "X.h"
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#define NEED_EVENTS
#define NEED_REPLIES
#include "Xproto.h"
#include <X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
......@@ -82,7 +80,7 @@ SOFTWARE.
#include "../../dix/dispatch.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include "security.h"
#include <X11/extensions/security.h>
#endif
#ifdef LBX
#include "lbxserve.h"
......@@ -181,9 +179,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
return(ext);
}
Bool AddExtensionAlias(alias, ext)
char *alias;
ExtensionEntry *ext;
Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
{
char *name;
char **aliases;
......@@ -244,9 +240,7 @@ CheckExtension(const char *extname)
}
void
DeclareExtensionSecurity(extname, secure)
char *extname;
Bool secure;
DeclareExtensionSecurity(char *extname, Bool secure)
{
#ifdef XCSECURITY
int i = FindExtension(extname, strlen(extname));
......@@ -272,15 +266,13 @@ DeclareExtensionSecurity(extname, secure)
}
unsigned short
StandardMinorOpcode(client)
ClientPtr client;
StandardMinorOpcode(ClientPtr client)
{
return ((xReq *)client->requestBuffer)->data;
}
unsigned short
MinorOpcodeOfRequest(client)
ClientPtr client;
MinorOpcodeOfRequest(ClientPtr client)
{
unsigned char major;
......@@ -332,8 +324,7 @@ CloseDownExtensions()
int
ProcQueryExtension(client)
ClientPtr client;
ProcQueryExtension(ClientPtr client)
{
xQueryExtensionReply reply;
int i;
......@@ -379,8 +370,7 @@ ProcQueryExtension(client)
}
int
ProcListExtensions(client)
ClientPtr client;
ProcListExtensions(ClientPtr client)
{
xListExtensionsReply reply;
char *bufptr, *buffer;
......@@ -453,9 +443,7 @@ ProcListExtensions(client)
ExtensionLookupProc
LookupProc(name, pGC)
char *name;
GCPtr pGC;
LookupProc(char *name, GCPtr pGC)
{
register int i;
register ScreenProcEntry *spentry;
......@@ -470,19 +458,13 @@ LookupProc(name, pGC)
}
Bool
RegisterProc(name, pGC, proc)
char *name;
GC *pGC;
ExtensionLookupProc proc;
RegisterProc(char *name, GC *pGC, ExtensionLookupProc proc)
{
return RegisterScreenProc(name, pGC->pScreen, proc);
}
Bool
RegisterScreenProc(name, pScreen, proc)
char *name;
ScreenPtr pScreen;
ExtensionLookupProc proc;
RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc)
{
register ScreenProcEntry *spentry;
register ProcEntryPtr procEntry = (ProcEntryPtr)NULL;
......@@ -524,5 +506,3 @@ RegisterScreenProc(name, pScreen, proc)
}
return TRUE;
}
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXglxext.c"
#else
/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.8 2001/08/23 18:25:40 alanh Exp $
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
......@@ -25,6 +36,10 @@
*/
#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "glxserver.h"
#include <windowstr.h>
#include <propertyst.h>
......@@ -42,9 +57,11 @@
#undef TEST
#undef DEBUG
extern __GLXextensionInfo __glDDXExtensionInfo;
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
void GlxSetVisualConfigs(int nconfigs,
__GLXvisualConfig *configs, void **privates);
__GLXextensionInfo *__glXExt = &__glDDXExtensionInfo;
static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */;
/*
** Forward declarations.
......@@ -126,7 +143,7 @@ static int ClientGone(int clientIndex, XID id)
for (i=0; i < cl->numCurrentContexts; i++) {
cx = cl->currentContexts[i];
if (cx) {
__glXDeassociateContext(cx, cx->glxPriv);
__glXDeassociateContext(cx);
cx->isCurrent = GL_FALSE;
if (!cx->idExists) {
__glXFreeContext(cx);
......@@ -186,6 +203,18 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
return GL_TRUE;
}
extern RESTYPE __glXSwapBarrierRes;
static int SwapBarrierGone(int screen, XID drawable)
{
if (__glXSwapBarrierFuncs &&
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc != NULL) {
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, 0);
}
FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE);
return True;
}
/************************************************************************/
/*
......@@ -231,15 +260,9 @@ void GlxExtensionInit(void)
ExtensionEntry *extEntry;
int i;
#ifdef X11R5
__glXContextRes = CreateNewResourceType(ContextGone);
__glXClientRes = CreateNewResourceType(ClientGone);
__glXPixmapRes = CreateNewResourceType(PixmapGone);
#else
__glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
__glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
__glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
#endif
/*
** Add extension to server extensions.
......@@ -268,6 +291,8 @@ void GlxExtensionInit(void)
__glXUnsupportedPrivateRequest = extEntry->errorBase +
GLXUnsupportedPrivateRequest;
__glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
/*
** Initialize table of client state. There is never a client 0.
*/
......@@ -323,6 +348,8 @@ GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
{
saveInitVisualsProc = *initVisProc;
*initVisProc = GlxInitVisuals;
/* HACK: this shouldn't be done here but it's the earliest time */
__glXExt = __glXglDDXExtensionInfo(); /* from GLcore */
}
/************************************************************************/
......@@ -355,7 +382,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
}
if (!cx->isDirect) {
if (cx->glxPriv == NULL) {
if (cx->drawPriv == NULL) {
/*
** The drawable has vanished. It must be a window, because only
** windows can be destroyed from under us; GLX pixmaps are
......@@ -546,5 +573,3 @@ void __glXNoSuchRenderOpcode(GLbyte *pc)
{
return;
}
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXglyph.c"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
......@@ -22,9 +16,9 @@
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/glyph.c,v 1.6 2001/10/28 03:34:19 tsi Exp $
* $XFree86: xc/programs/Xserver/render/glyph.c,v 1.5 2001/01/30 07:01:22 keithp Exp $
*
* Copyright 2000 SuSE, Inc.
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
......@@ -46,6 +40,10 @@
* Author: Keith Packard, SuSE, Inc.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
......@@ -71,6 +69,17 @@
#undef DEBUG
#undef TEST
#else
#include "picturestr.h"
#include "glyphstr.h"
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
#define UINT32_MAX 0xffffffffU
#endif
/*
......@@ -123,6 +132,50 @@ FindGlyphHashSet (CARD32 filled)
return 0;
}
static int _GlyphSetPrivateAllocateIndex = 0;
int
AllocateGlyphSetPrivateIndex (void)
{
return _GlyphSetPrivateAllocateIndex++;
}
void
ResetGlyphSetPrivateIndex (void)
{
_GlyphSetPrivateAllocateIndex = 0;
}
Bool
_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr)
{
pointer *new;
if (n > glyphSet->maxPrivate) {
if (glyphSet->devPrivates &&
glyphSet->devPrivates != (pointer)(&glyphSet[1])) {
new = (pointer *) xrealloc (glyphSet->devPrivates,
(n + 1) * sizeof (pointer));
if (!new)
return FALSE;
} else {
new = (pointer *) xalloc ((n + 1) * sizeof (pointer));
if (!new)
return FALSE;
if (glyphSet->devPrivates)
memcpy (new,
glyphSet->devPrivates,
(glyphSet->maxPrivate + 1) * sizeof (pointer));
}
glyphSet->devPrivates = new;
/* Zero out new, uninitialize privates */
while (++glyphSet->maxPrivate < n)
glyphSet->devPrivates[glyphSet->maxPrivate] = (pointer)0;
}
glyphSet->devPrivates[n] = ptr;
return TRUE;
}
Bool
GlyphInit (ScreenPtr pScreen)
{
......@@ -359,8 +412,12 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth)
{
int size;
GlyphPtr glyph;
size = gi->height * PixmapBytePad (gi->width, glyphDepths[fdepth]);
size_t padded_width;
padded_width = PixmapBytePad (gi->width, glyphDepths[fdepth]);
if (gi->height && padded_width > (UINT32_MAX - sizeof(GlyphRec))/gi->height)
return 0;
size = gi->height * padded_width;
glyph = (GlyphPtr) xalloc (size + sizeof (GlyphRec));
if (!glyph)
return 0;
......@@ -456,15 +513,24 @@ GlyphSetPtr
AllocateGlyphSet (int fdepth, PictFormatPtr format)
{
GlyphSetPtr glyphSet;
int size;
if (!globalGlyphs[fdepth].hashSet)
{
if (!AllocateGlyphHash (&globalGlyphs[fdepth], &glyphHashSets[0]))
return FALSE;
}
glyphSet = xalloc (sizeof (GlyphSetRec));
size = (sizeof (GlyphSetRec) +
(sizeof (pointer) * _GlyphSetPrivateAllocateIndex));
glyphSet = xalloc (size);
if (!glyphSet)
return FALSE;
bzero((char *)glyphSet, size);
glyphSet->maxPrivate = _GlyphSetPrivateAllocateIndex - 1;
if (_GlyphSetPrivateAllocateIndex)
glyphSet->devPrivates = (pointer)(&glyphSet[1]);
if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
{
xfree (glyphSet);
......@@ -503,9 +569,13 @@ FreeGlyphSet (pointer value,
else
ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE);
xfree (table);
if (glyphSet->devPrivates &&
glyphSet->devPrivates != (pointer)(&glyphSet[1]))
xfree(glyphSet->devPrivates);
xfree (glyphSet);
}
return Success;
}
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXglyphcurs.c"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
......@@ -70,8 +64,12 @@ SOFTWARE.
/* $Xorg: glyphcurs.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "misc.h"
#include "fontstruct.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
......@@ -100,11 +98,7 @@ cursor metrics.
*/
int
ServerBitsFromGlyph(pfont, ch, cm, ppbits)
FontPtr pfont;
unsigned int ch;
register CursorMetricPtr cm;
unsigned char **ppbits;
ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits)
{
register ScreenPtr pScreen;
register GCPtr pGC;
......@@ -194,10 +188,7 @@ ServerBitsFromGlyph(pfont, ch, cm, ppbits)
Bool
CursorMetricsFromGlyph( pfont, ch, cm)
register FontPtr pfont;
unsigned ch;
register CursorMetricPtr cm;
CursorMetricsFromGlyph(register FontPtr pfont, unsigned ch, register CursorMetricPtr cm)
{
CharInfoPtr pci;
unsigned long nglyphs;
......@@ -248,5 +239,3 @@ CursorMetricsFromGlyph( pfont, ch, cm)
}
return TRUE;
}
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXglyphstr.h"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
......@@ -22,9 +16,9 @@
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.4 2001/01/21 21:19:39 tsi Exp $
* $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3 2000/11/20 07:13:13 keithp Exp $
*
* Copyright 2000 SuSE, Inc.
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
......@@ -56,7 +50,7 @@
#ifndef _GLYPHSTR_H_
#define _GLYPHSTR_H_
#include "renderproto.h"
#include <X11/extensions/renderproto.h>
#include "../../render/picture.h"
#include "screenint.h"
......@@ -99,9 +93,21 @@ typedef struct _GlyphSet {
PictFormatPtr format;
int fdepth;
GlyphHashRec hash;
int maxPrivate;
pointer *devPrivates;
CARD32 remoteID;
} GlyphSetRec, *GlyphSetPtr;
#define GlyphSetGetPrivate(pGlyphSet,n) \
((n) > (pGlyphSet)->maxPrivate ? \
(pointer) 0 : \
(pGlyphSet)->devPrivates[n])
#define GlyphSetSetPrivate(pGlyphSet,n,ptr) \
((n) > (pGlyphSet)->maxPrivate ? \
_GlyphSetSetNewPrivate(pGlyphSet, n, ptr) : \
((((pGlyphSet)->devPrivates[n] = (ptr)) != 0) || TRUE))
typedef struct _GlyphList {
INT16 xOff;
INT16 yOff;
......@@ -114,6 +120,15 @@ extern GlyphHashRec globalGlyphs[GlyphFormatNum];
GlyphHashSetPtr
FindGlyphHashSet (CARD32 filled);
int
AllocateGlyphSetPrivateIndex (void);
void
ResetGlyphSetPrivateIndex (void);
Bool
_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr);
Bool
GlyphInit (ScreenPtr pScreen);
......@@ -157,5 +172,3 @@ FreeGlyphSet (pointer value,
#endif /* _GLYPHSTR_H_ */
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXmiexpose.c"
#else
/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.9 2001/12/14 20:00:22 dawes Exp $ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/* $XdotOrg: xc/programs/Xserver/mi/miexpose.c,v 1.6 2005/07/03 08:53:51 daniels Exp $ */
/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.9tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
......@@ -51,13 +63,44 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* $Xorg: miexpose.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */
#include "X.h"
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#define NEED_EVENTS
#include "Xproto.h"
#include "Xprotostr.h"
#include <X11/Xproto.h>
#include <X11/Xprotostr.h>
#include "misc.h"
#include "regionstr.h"
......@@ -69,7 +112,7 @@ SOFTWARE.
#include "dixstruct.h"
#include "mi.h"
#include "Xmd.h"
#include <X11/Xmd.h>
#include "globals.h"
......@@ -190,7 +233,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
if ((RECT_IN_REGION(pscr, &pSrcWin->clipList, &TsrcBox)) == rgnIN)
return NULL;
prgnSrcClip = &rgnSrcRec;
REGION_INIT(pscr, prgnSrcClip, NullBox, 0);
REGION_NULL(pscr, prgnSrcClip);
REGION_COPY(pscr, prgnSrcClip, &pSrcWin->clipList);
}
REGION_TRANSLATE(pscr, prgnSrcClip,
......@@ -227,7 +270,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
else
{
prgnDstClip = &rgnDstRec;
REGION_INIT(pscr, prgnDstClip, NullBox, 0);
REGION_NULL(pscr, prgnDstClip);
REGION_COPY(pscr, prgnDstClip,
&((WindowPtr)pDstDrawable)->clipList);
}
......@@ -934,5 +977,3 @@ miClearDrawable(pDraw, pGC)
DoChangeGC(pGC, GCForeground, &fg, 0);
ValidateGC(pDraw, pGC);
}
#endif /* NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXmiglyph.c"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
......@@ -22,9 +16,9 @@
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.6 2000/12/05 03:13:31 keithp Exp $
* $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.4 2000/11/20 07:13:13 keithp Exp $
*
* Copyright 2000 SuSE, Inc.
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
......@@ -46,6 +40,10 @@
* Author: Keith Packard, SuSE, Inc.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "scrnintstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
......@@ -318,5 +316,3 @@ miGlyphs (CARD8 op,
}
}
#endif /* NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXmitrap.c"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.9 2002/11/05 23:39:16 keithp Exp $
* $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.8 2002/09/03 19:28:28 keithp Exp $
*
* Copyright 2002 Keith Packard, member of The XFree86 Project, Inc.
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
......@@ -28,6 +39,10 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "scrnintstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
......@@ -37,6 +52,12 @@
#include "picturestr.h"
#include "mipict.h"
#ifdef NXAGENT_SERVER
#include "Render.h"
#endif
PicturePtr
miCreateAlphaPicture (ScreenPtr pScreen,
PicturePtr pDst,
......@@ -142,17 +163,46 @@ miTrapezoids (CARD8 op,
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen);
PicturePtr pPicture = 0;
BoxRec bounds;
INT16 xDst, yDst;
INT16 xRel, yRel;
xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16;
if (maskFormat)
/*
* Check for solid alpha add
*/
if (op == PictOpAdd && miIsSolidAlpha (pSrc))
{
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
}
else if (maskFormat)
{
miTrapezoidBounds (ntrap, traps, &bounds);
PicturePtr pPicture;
BoxRec bounds;
INT16 xDst, yDst;
INT16 xRel, yRel;
xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16;
#ifdef NXAGENT_SERVER
if (nxagentTrapezoidExtents != NullBox)
{
memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec));
}
else
{
nxagentTrapezoidExtents = (BoxPtr) xalloc(sizeof(BoxRec));
miTrapezoidBounds (ntrap, traps, &bounds);
memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec));
}
#else
miTrapezoidBounds (ntrap, traps, &bounds);
#endif
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
return;
pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
......@@ -160,37 +210,9 @@ miTrapezoids (CARD8 op,
bounds.y2 - bounds.y1);
if (!pPicture)
return;
}
for (; ntrap; ntrap--, traps++)
{
if (!xTrapezoidValid(traps))
continue;
if (!maskFormat)
{
miTrapezoidBounds (1, traps, &bounds);
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
continue;
pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
if (!pPicture)
continue;
}
(*ps->RasterizeTrapezoid) (pPicture, traps,
-bounds.x1, -bounds.y1);
if (!maskFormat)
{
xRel = bounds.x1 + xSrc - xDst;
yRel = bounds.y1 + ySrc - yDst;
CompositePicture (op, pSrc, pPicture, pDst,
xRel, yRel, 0, 0, bounds.x1, bounds.y1,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
FreePicture (pPicture, 0);
}
}
if (maskFormat)
{
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pPicture, traps,
-bounds.x1, -bounds.y1);
xRel = bounds.x1 + xSrc - xDst;
yRel = bounds.y1 + ySrc - yDst;
CompositePicture (op, pSrc, pPicture, pDst,
......@@ -199,6 +221,13 @@ miTrapezoids (CARD8 op,
bounds.y2 - bounds.y1);
FreePicture (pPicture, 0);
}
else
{
if (pDst->polyEdge == PolyEdgeSharp)
maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
else
maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
for (; ntrap; ntrap--, traps++)
miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
}
}
#endif /* NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXmiwindow.c"
#else
/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.7 2001/12/14 20:00:28 dawes Exp $ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.9tsi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
......@@ -52,8 +63,12 @@ SOFTWARE.
******************************************************************/
/* $Xorg: miwindow.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */
#include "X.h"
#include "miscstruct.h"
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "regionstr.h"
#include "region.h"
#include "mi.h"
#include "windowstr.h"
......@@ -202,7 +217,7 @@ miCheckSubSaveUnder(
{
if (!subInited)
{
REGION_INIT(pScreen, &SubRegion, NullBox, 0);
REGION_NULL(pScreen, &SubRegion);
subInited = TRUE;
}
REGION_COPY(pScreen, &SubRegion, pRegion);
......@@ -285,7 +300,7 @@ miChangeSaveUnder(pWin, first)
numSaveUndersViewable += deltaSaveUndersViewable;
deltaSaveUndersViewable = 0;
pScreen = pWin->drawable.pScreen;
REGION_INIT(pScreen, &rgn, NullBox, 1);
REGION_NULL(pScreen, &rgn);
res = miCheckSubSaveUnder (pWin->parent,
pWin->saveUnder ? first : pWin->nextSib,
&rgn);
......@@ -889,8 +904,14 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
/* and move those bits */
if (oldpt.x != x || oldpt.y != y)
if (oldpt.x != x || oldpt.y != y
#ifdef COMPOSITE
|| pWin->redirectDraw
#endif
)
{
(*pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, gravitate[g]);
}
/* remove any overwritten bits from the remaining useful bits */
......@@ -1103,7 +1124,6 @@ miChangeBorderWidth(pWin, width)
register WindowPtr pWin;
unsigned int width;
{
WindowPtr pParent;
int oldwidth;
Bool anyMarked = FALSE;
register ScreenPtr pScreen;
......@@ -1119,7 +1139,6 @@ miChangeBorderWidth(pWin, width)
return;
HadBorder = HasBorder(pWin);
pScreen = pWin->drawable.pScreen;
pParent = pWin->parent;
if (WasViewable && width < oldwidth)
anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
......@@ -1201,5 +1220,3 @@ miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
miSegregateChildren(pChild, pReg, depth);
}
}
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#include "X/NXproperty.c"
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
......@@ -70,10 +64,14 @@ SOFTWARE.
******************************************************************/
/* $Xorg: property.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include "X.h"
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include "Xproto.h"
#include <X11/Xproto.h>
#include "windowstr.h"
#include "propertyst.h"
#include "dixstruct.h"
......@@ -81,7 +79,7 @@ SOFTWARE.
#include "swaprep.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include "security.h"
#include <X11/extensions/security.h>
#endif
#ifdef LBX
#include "lbxserve.h"
......@@ -91,16 +89,27 @@ SOFTWARE.
#include "Options.h"
#include "Rootless.h"
#include "Client.h"
#include "Windows.h"
#if defined(LBX) || defined(LBX_COMPAT)
int fWriteToClient(client, len, buf)
ClientPtr client;
int len;
char *buf;
#if 0 /* no header in X11 environment, not used in X11 environment */
int fWriteToClient(ClientPtr client, int len, char *buf)
{
return WriteToClient(client, len, buf);
}
#endif
#endif
extern Atom clientCutProperty;
#ifdef NXAGENT_SERVER
typedef struct
{
CARD32 state;
Window icon;
}
nxagentWMStateRec;
#endif
/*****************************************************************
* Property Stuff
......@@ -115,8 +124,7 @@ int fWriteToClient(client, len, buf)
#ifdef notdef
static void
PrintPropertys(pWin)
WindowPtr pWin;
PrintPropertys(WindowPtr pWin)
{
PropertyPtr pProp;
register int j;
......@@ -135,8 +143,7 @@ PrintPropertys(pWin)
#endif
int
ProcRotateProperties(client)
ClientPtr client;
ProcRotateProperties(ClientPtr client)
{
int i, j, delta;
REQUEST(xRotatePropertiesReq);
......@@ -228,8 +235,7 @@ found:
}
int
ProcChangeProperty(client)
ClientPtr client;
ProcChangeProperty(ClientPtr client)
{
WindowPtr pWin;
char format, mode;
......@@ -330,18 +336,18 @@ ProcChangeProperty(client)
nxagentGuessShadowHint(client, stuff->property);
#ifdef NX_DEBUG_INPUT
nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]);
#endif
return client->noClientException;
}
}
int
ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent)
WindowPtr pWin;
Atom property, type;
int format, mode;
unsigned long len;
pointer value;
Bool sendevent;
ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int mode, unsigned long len, pointer value,
Bool sendevent)
{
#ifdef LBX
return LbxChangeWindowProperty(NULL, pWin, property, type,
......@@ -353,10 +359,23 @@ ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent)
int sizeInBytes;
int totalSize;
pointer data;
int copySize;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
copySize = nxagentOption(CopyBufferSize);
if (copySize != COPY_UNLIMITED && property == clientCutProperty)
{
if (totalSize > copySize)
{
totalSize = copySize;
totalSize = totalSize - (totalSize % sizeInBytes);
len = totalSize / sizeInBytes;
}
}
/* first see if property already exists */
pProp = wUserProps (pWin);
......@@ -458,9 +477,7 @@ ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent)
}
int
DeleteProperty(pWin, propName)
WindowPtr pWin;
Atom propName;
DeleteProperty(WindowPtr pWin, Atom propName)
{
PropertyPtr pProp, prevProp;
xEvent event;
......@@ -503,8 +520,7 @@ DeleteProperty(pWin, propName)
}
void
DeleteAllWindowProperties(pWin)
WindowPtr pWin;
DeleteAllWindowProperties(WindowPtr pWin)
{
PropertyPtr pProp, pNextProp;
xEvent event;
......@@ -530,11 +546,11 @@ DeleteAllWindowProperties(pWin)
}
static int
NullPropertyReply(client, propertyType, format, reply)
ClientPtr client;
ATOM propertyType;
int format;
xGetPropertyReply *reply;
NullPropertyReply(
ClientPtr client,
ATOM propertyType,
int format,
xGetPropertyReply *reply)
{
reply->nItems = 0;
reply->length = 0;
......@@ -556,9 +572,13 @@ NullPropertyReply(client, propertyType, format, reply)
*****************/
int
ProcGetProperty(client)
ClientPtr client;
ProcGetProperty(ClientPtr client)
{
#ifdef NXAGENT_SERVER
nxagentWMStateRec wmState;
nxagentWMStateRec *wmsP = &wmState;
#endif
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
WindowPtr pWin;
......@@ -566,6 +586,7 @@ ProcGetProperty(client)
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
......@@ -601,6 +622,59 @@ ProcGetProperty(client)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
#ifdef NXAGENT_SERVER
/*
* Creating a reply for WM_STATE property if it doesn't exist.
* This is intended to allow drag & drop work in JAva 1.6 when
* the agent is connected to NXWin in multiwindow mode.
*/
if (nxagentOption(Rootless) &&
nxagentWindowTopLevel(pWin) &&
(!pProp) &&
strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
{
wmState.state = 1;
wmState.icon = None;
if (ChangeWindowProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState, 1) == Success)
{
nxagentExportProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState);
}
n = 8;
ind = stuff->longOffset << 2;
if (n < ind)
{
client->errorValue = stuff->longOffset;
return BadValue;
}
len = min(n - ind, 4 * stuff->longLength);
reply.bytesAfter = n - (ind + len);
reply.length = (len + 3) >> 2;
reply.format = 32;
reply.nItems = len / 4;
reply.propertyType = stuff->property;
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
if (len)
{
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient(client, len, (char *)wmsP + ind);
}
return(client->noClientException);
}
#endif
if (!pProp)
return NullPropertyReply(client, None, 0, &reply);
......@@ -832,8 +906,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
#endif
int
ProcListProperties(client)
ClientPtr client;
ProcListProperties(ClientPtr client)
{
Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
......@@ -880,8 +953,7 @@ ProcListProperties(client)
}
int
ProcDeleteProperty(client)
register ClientPtr client;
ProcDeleteProperty(register ClientPtr client)
{
WindowPtr pWin;
REQUEST(xDeletePropertyReq);
......@@ -918,4 +990,3 @@ ProcDeleteProperty(client)
return(result);
}
#endif /* #ifdef NXAGENT_UPGRADE */
#ifdef NXAGENT_UPGRADE
#if !defined(__sun) && !defined(__CYGWIN__)
#include "X/NXxvdisp.c"
#endif
#else
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/* $XdotOrg: xc/programs/Xserver/Xext/xvdisp.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
......@@ -31,7 +39,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.25 2001/11/18 23:55:48 mvojkovi Exp $ */
/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.27 2003/07/16 01:38:31 dawes Exp $ */
/*
** File:
......@@ -57,8 +65,14 @@ SOFTWARE.
**
*/
#include "X.h"
#include "Xproto.h"
#if !defined(__sun) && !defined(__CYGWIN__)
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
......@@ -68,12 +82,12 @@ SOFTWARE.
#include "resource.h"
#include "opaque.h"
#include "Xv.h"
#include "Xvproto.h"
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef MITSHM
#define _XSHM_SERVER_
#include "shmstr.h"
#include <X11/extensions/shmstr.h>
#endif
#include "Trap.h"
......@@ -85,6 +99,8 @@ SOFTWARE.
#include "xf86_ansic.h"
#endif
#include "xvdisp.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
......@@ -261,17 +277,19 @@ ProcXvDispatch(ClientPtr client)
case xv_PutVideo:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
result = (XineramaXvPutVideo(client)); break;
result = (XineramaXvPutVideo(client));
else
#endif
result = (ProcXvPutVideo(client)); break;
result = (ProcXvPutVideo(client));
break;
case xv_PutStill:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
result = (XineramaXvPutStill(client)); break
result = (XineramaXvPutStill(client));
else
#endif
result = (ProcXvPutStill(client)); break;
result = (ProcXvPutStill(client));
break;
case xv_GetVideo: result = (ProcXvGetVideo(client)); break;
case xv_GetStill: result = (ProcXvGetStill(client)); break;
case xv_GrabPort: result = (ProcXvGrabPort(client)); break;
......@@ -281,35 +299,39 @@ ProcXvDispatch(ClientPtr client)
case xv_StopVideo:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
result = (XineramaXvStopVideo(client)); break;
result = (XineramaXvStopVideo(client));
else
#endif
result = (ProcXvStopVideo(client)); break;
result = (ProcXvStopVideo(client));
break;
case xv_SetPortAttribute:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
result = (XineramaXvSetPortAttribute(client)); break;
result = (XineramaXvSetPortAttribute(client));
else
#endif
result = (ProcXvSetPortAttribute(client)); break;
result = (ProcXvSetPortAttribute(client));
break;
case xv_GetPortAttribute: result = (ProcXvGetPortAttribute(client)); break;
case xv_QueryBestSize: result = (ProcXvQueryBestSize(client)); break;
case xv_QueryPortAttributes: result = (ProcXvQueryPortAttributes(client)); break;
case xv_PutImage:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
result = (XineramaXvPutImage(client)); break;
result = (XineramaXvPutImage(client));
else
#endif
result = (ProcXvPutImage(client)); break;
result = (ProcXvPutImage(client));
break;
#ifdef MITSHM
case xv_ShmPutImage:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
result = (XineramaXvShmPutImage(client)); break;
result = (XineramaXvShmPutImage(client));
else
#endif
result = (ProcXvShmPutImage(client)); break;
result = (ProcXvShmPutImage(client));
break;
#endif
case xv_QueryImageAttributes: result = (ProcXvQueryImageAttributes(client)); break;
case xv_ListImageFormats: result = (ProcXvListImageFormats(client)); break;
......@@ -1268,7 +1290,7 @@ ProcXvShmPutImage(ClientPtr client)
#endif
#ifdef XvMCExtension
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
#include "xvmcext.h"
#endif
static int
......@@ -2000,8 +2022,7 @@ XineramaXvShmPutImage(ClientPtr client)
client, stuff->port, XvXRTPort, SecurityReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) &&
(stuff->drawable == WindowTable[0]->drawable.id);
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
x = stuff->drw_x;
y = stuff->drw_y;
......@@ -2048,8 +2069,7 @@ XineramaXvPutImage(ClientPtr client)
client, stuff->port, XvXRTPort, SecurityReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) &&
(stuff->drawable == WindowTable[0]->drawable.id);
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
x = stuff->drw_x;
y = stuff->drw_y;
......@@ -2094,8 +2114,7 @@ XineramaXvPutVideo(ClientPtr client)
client, stuff->port, XvXRTPort, SecurityReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) &&
(stuff->drawable == WindowTable[0]->drawable.id);
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
x = stuff->drw_x;
y = stuff->drw_y;
......@@ -2140,8 +2159,7 @@ XineramaXvPutStill(ClientPtr client)
client, stuff->port, XvXRTPort, SecurityReadAccess)))
return _XvBadPort;
isRoot = (draw->type == XRT_WINDOW) &&
(stuff->drawable == WindowTable[0]->drawable.id);
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
x = stuff->drw_x;
y = stuff->drw_y;
......@@ -2274,4 +2292,4 @@ void XineramifyXv(void)
#endif
#endif /* #ifdef NXAGENT_UPGRADE */
#endif /* !defined(__sun) && !defined(__CYGWIN__) */
......@@ -101,10 +101,6 @@ int nxagentRenderVersionMinor;
int nxagentPicturePrivateIndex = 0;
#ifndef NXAGENT_UPGRADE
static int picturePrivateCount = 0;
#endif
static int nxagentNumFormats = 0;
static XRenderPictFormat nxagentArrayFormats[MAX_FORMATS];
......@@ -2066,62 +2062,6 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
#endif
}
#ifndef NXAGENT_UPGRADE
/*
FIXME: In the 3.0.0 port these functions have been moved
to Picture.c. We can remove them when the port is
is complete.
*/
int AllocatePicturePrivateIndex()
{
return picturePrivateCount++;
}
Bool AllocatePicturePrivate(register ScreenPtr pScreen, int index2, unsigned amount)
{
unsigned oldamount;
PictureScreenPtr ps = GetPictureScreen(pScreen);
/*
* Round up the size for proper alignment.
*/
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
if (index2 >= ps -> PicturePrivateLen)
{
unsigned *nsizes = (unsigned *) xrealloc(ps -> PicturePrivateSizes,
(index2 + 1) * sizeof(unsigned));
if (nsizes == 0)
{
return 0;
}
while (ps -> PicturePrivateLen <= index2)
{
nsizes[ps -> PicturePrivateLen++] = 0;
ps -> totalPictureSize += sizeof(DevUnion);
}
ps -> PicturePrivateSizes = nsizes;
}
oldamount = ps -> PicturePrivateSizes[index2];
if (amount > oldamount)
{
ps -> PicturePrivateSizes[index2] = amount;
ps -> totalPictureSize += (amount - oldamount);
}
return 1;
}
#endif
void nxagentQueryFormats()
{
XRenderInfo *xri;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/************************************************************************
Copyright 1987, 1998 The Open Group
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.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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.
************************************************************************/
/* $Xorg: glyphcurs.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "misc.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
#include "resource.h"
#include "dix.h"
#include "cursorstr.h"
#include "opaque.h"
#include "servermd.h"
#include "../../fb/fb.h"
#include "Pixmaps.h"
#ifndef True
#define True 1
#endif
/*
get the bits out of the font in a portable way. to avoid
dealing with padding and such-like, we draw the glyph into
a bitmap, then read the bits out with GetImage, which
uses server-natural format.
since all screens return the same bitmap format, we'll just use
the first one we find.
the character origin lines up with the hotspot in the
cursor metrics.
*/
int
ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits)
{
register ScreenPtr pScreen;
register GCPtr pGC;
xRectangle rect;
PixmapPtr ppix;
long nby;
char *pbits;
ChangeGCVal gcval[3];
unsigned char char2b[2];
/* turn glyph index into a protocol-format char2b */
char2b[0] = (unsigned char)(ch >> 8);
char2b[1] = (unsigned char)(ch & 0xff);
pScreen = screenInfo.screens[0];
nby = BitmapBytePad(cm->width) * (long)cm->height;
pbits = (char *)xalloc(nby);
if (!pbits)
return BadAlloc;
/* zeroing the (pad) bits seems to help some ddx cursor handling */
bzero(pbits, nby);
ppix = fbCreatePixmap(pScreen, cm->width, cm->height, 1);
pGC = GetScratchGC(1, pScreen);
if (!ppix || !pGC)
{
if (ppix)
fbDestroyPixmap(ppix);
if (pGC)
FreeScratchGC(pGC);
xfree(pbits);
return BadAlloc;
}
#ifdef TEST
fprintf(stderr, "ServerBitsFromGlyph: Created virtual pixmap at [%p] with width [%d] height [%d] depth [%d].\n",
(void *) ppix, cm->width, cm->height, 1);
#endif
nxagentPixmapPriv(ppix) -> id = 0;
nxagentPixmapPriv(ppix) -> mid = 0;
nxagentPixmapPriv(ppix) -> isVirtual = True;
nxagentPixmapPriv(ppix) -> pRealPixmap = NULL;
nxagentPixmapPriv(ppix) -> pVirtualPixmap = NULL;
rect.x = 0;
rect.y = 0;
rect.width = cm->width;
rect.height = cm->height;
pGC->stateChanges |= GCFunction | GCForeground | GCFont;
pGC->alu = GXcopy;
pGC->fgPixel = 0;
pfont->refcnt++;
if (pGC->font)
CloseFont(pGC->font, (Font)0);
pGC->font = pfont;
ValidateGC((DrawablePtr)ppix, pGC);
fbPolyFillRect((DrawablePtr)ppix, pGC, 1, &rect);
/* draw the glyph */
gcval[0].val = 1;
pGC->fgPixel = 1;
pGC->stateChanges |= GCForeground;
ValidateGC((DrawablePtr)ppix, pGC);
miPolyText16((DrawablePtr)ppix, pGC, (int)cm->xhot, (int)cm->yhot, (int)1, (unsigned short*)char2b);
fbGetImage((DrawablePtr)ppix, 0, 0, cm->width, cm->height,
XYPixmap, 1, pbits);
*ppbits = (unsigned char *)pbits;
FreeScratchGC(pGC);
fbDestroyPixmap(ppix);
#ifdef TEST
fprintf(stderr, "ServerBitsFromGlyph: Destroyed virtual pixmap at [%p].\n",
(void *) ppix);
#endif
return Success;
}
Bool
CursorMetricsFromGlyph(register FontPtr pfont, unsigned ch, register CursorMetricPtr cm)
{
CharInfoPtr pci;
unsigned long nglyphs;
CARD8 chs[2];
FontEncoding encoding;
chs[0] = ch >> 8;
chs[1] = ch;
encoding = (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit;
if (encoding == Linear16Bit)
{
if (ch < pfont->info.firstCol || pfont->info.lastCol < ch)
return FALSE;
}
else
{
if (chs[0] < pfont->info.firstRow || pfont->info.lastRow < chs[0])
return FALSE;
if (chs[1] < pfont->info.firstCol || pfont->info.lastCol < chs[1])
return FALSE;
}
(*pfont->get_glyphs) (pfont, 1, chs, encoding, &nglyphs, &pci);
if (nglyphs == 0)
return FALSE;
cm->width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
cm->height = pci->metrics.descent + pci->metrics.ascent;
if (pci->metrics.leftSideBearing > 0)
{
cm->width += pci->metrics.leftSideBearing;
cm->xhot = 0;
}
else
{
cm->xhot = -pci->metrics.leftSideBearing;
if (pci->metrics.rightSideBearing < 0)
cm->width -= pci->metrics.rightSideBearing;
}
if (pci->metrics.ascent < 0)
{
cm->height -= pci->metrics.ascent;
cm->yhot = 0;
}
else
{
cm->yhot = pci->metrics.ascent;
if (pci->metrics.descent < 0)
cm->height -= pci->metrics.descent;
}
return TRUE;
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3 2000/11/20 07:13:13 keithp Exp $
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
/*
* This must keep the same symbol as the original glyphstr.h
* or symbols will be redefined. The code here adds a field
* to _GlyphSet. This should be done by defining a new type
* and casting when appropriate.
*/
#ifndef _GLYPHSTR_H_
#define _GLYPHSTR_H_
#include <X11/extensions/renderproto.h>
#include "../../render/picture.h"
#include "screenint.h"
#define GlyphFormat1 0
#define GlyphFormat4 1
#define GlyphFormat8 2
#define GlyphFormat16 3
#define GlyphFormat32 4
#define GlyphFormatNum 5
typedef struct _Glyph {
CARD32 refcnt;
CARD32 size; /* info + bitmap */
xGlyphInfo info;
/* bits follow */
} GlyphRec, *GlyphPtr;
typedef struct _GlyphRef {
CARD32 signature;
GlyphPtr glyph;
CARD16 corruptedGlyph;
} GlyphRefRec, *GlyphRefPtr;
#define DeletedGlyph ((GlyphPtr) 1)
typedef struct _GlyphHashSet {
CARD32 entries;
CARD32 size;
CARD32 rehash;
} GlyphHashSetRec, *GlyphHashSetPtr;
typedef struct _GlyphHash {
GlyphRefPtr table;
GlyphHashSetPtr hashSet;
CARD32 tableEntries;
} GlyphHashRec, *GlyphHashPtr;
typedef struct _GlyphSet {
CARD32 refcnt;
PictFormatPtr format;
int fdepth;
GlyphHashRec hash;
int maxPrivate;
pointer *devPrivates;
CARD32 remoteID;
} GlyphSetRec, *GlyphSetPtr;
#define GlyphSetGetPrivate(pGlyphSet,n) \
((n) > (pGlyphSet)->maxPrivate ? \
(pointer) 0 : \
(pGlyphSet)->devPrivates[n])
#define GlyphSetSetPrivate(pGlyphSet,n,ptr) \
((n) > (pGlyphSet)->maxPrivate ? \
_GlyphSetSetNewPrivate(pGlyphSet, n, ptr) : \
((((pGlyphSet)->devPrivates[n] = (ptr)) != 0) || TRUE))
typedef struct _GlyphList {
INT16 xOff;
INT16 yOff;
CARD8 len;
PictFormatPtr format;
} GlyphListRec, *GlyphListPtr;
extern GlyphHashRec globalGlyphs[GlyphFormatNum];
GlyphHashSetPtr
FindGlyphHashSet (CARD32 filled);
int
AllocateGlyphSetPrivateIndex (void);
void
ResetGlyphSetPrivateIndex (void);
Bool
_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr);
Bool
GlyphInit (ScreenPtr pScreen);
GlyphRefPtr
FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare);
CARD32
HashGlyph (GlyphPtr glyph);
void
FreeGlyph (GlyphPtr glyph, int format);
void
AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id);
Bool
DeleteGlyph (GlyphSetPtr glyphSet, Glyph id);
GlyphPtr
FindGlyph (GlyphSetPtr glyphSet, Glyph id);
GlyphPtr
AllocateGlyph (xGlyphInfo *gi, int format);
Bool
AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet);
Bool
ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global);
Bool
ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change);
GlyphSetPtr
AllocateGlyphSet (int fdepth, PictFormatPtr format);
int
FreeGlyphSet (pointer value,
XID gid);
#endif /* _GLYPHSTR_H_ */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.4 2000/11/20 07:13:13 keithp Exp $
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "scrnintstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "mi.h"
#include "picturestr.h"
#include "mipict.h"
#ifdef NXAGENT_SERVER
#include "Render.h"
#endif
void
miGlyphExtents (int nlist,
GlyphListPtr list,
GlyphPtr *glyphs,
BoxPtr extents)
{
int x1, x2, y1, y2;
int n;
GlyphPtr glyph;
int x, y;
x = 0;
y = 0;
extents->x1 = MAXSHORT;
extents->x2 = MINSHORT;
extents->y1 = MAXSHORT;
extents->y2 = MINSHORT;
while (nlist--)
{
x += list->xOff;
y += list->yOff;
n = list->len;
list++;
while (n--)
{
glyph = *glyphs++;
x1 = x - glyph->info.x;
if (x1 < MINSHORT)
x1 = MINSHORT;
y1 = y - glyph->info.y;
if (y1 < MINSHORT)
y1 = MINSHORT;
x2 = x1 + glyph->info.width;
if (x2 > MAXSHORT)
x2 = MAXSHORT;
y2 = y1 + glyph->info.height;
if (y2 > MAXSHORT)
y2 = MAXSHORT;
if (x1 < extents->x1)
extents->x1 = x1;
if (x2 > extents->x2)
extents->x2 = x2;
if (y1 < extents->y1)
extents->y1 = y1;
if (y2 > extents->y2)
extents->y2 = y2;
x += glyph->info.xOff;
y += glyph->info.yOff;
}
}
}
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
void
miGlyphs (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc,
int nlist,
GlyphListPtr list,
GlyphPtr *glyphs)
{
PixmapPtr pPixmap = 0;
PicturePtr pPicture;
PixmapPtr pMaskPixmap = 0;
PicturePtr pMask;
ScreenPtr pScreen = pDst->pDrawable->pScreen;
int width = 0, height = 0;
int x, y;
int xDst = list->xOff, yDst = list->yOff;
int n;
GlyphPtr glyph;
int error;
BoxRec extents;
CARD32 component_alpha;
#ifdef NXAGENT_SERVER
/*
* Get rid of the warning.
*/
extents.x1 = 0;
extents.y1 = 0;
#endif
if (maskFormat)
{
GCPtr pGC;
xRectangle rect;
#ifdef NXAGENT_SERVER
if (nxagentGlyphsExtents != NullBox)
{
memcpy(&extents, nxagentGlyphsExtents, sizeof(BoxRec));
}
else
{
nxagentGlyphsExtents = (BoxPtr) xalloc(sizeof(BoxRec));
miGlyphExtents (nlist, list, glyphs, &extents);
memcpy(nxagentGlyphsExtents, &extents, sizeof(BoxRec));
}
#else
miGlyphExtents (nlist, list, glyphs, &extents);
#endif
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
return;
width = extents.x2 - extents.x1;
height = extents.y2 - extents.y1;
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth);
if (!pMaskPixmap)
return;
component_alpha = NeedsComponent(maskFormat->format);
pMask = CreatePicture (0, &pMaskPixmap->drawable,
maskFormat, CPComponentAlpha, &component_alpha,
serverClient, &error);
if (!pMask)
{
(*pScreen->DestroyPixmap) (pMaskPixmap);
return;
}
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
ValidateGC (&pMaskPixmap->drawable, pGC);
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
FreeScratchGC (pGC);
x = -extents.x1;
y = -extents.y1;
}
else
{
pMask = pDst;
x = 0;
y = 0;
}
pPicture = 0;
while (nlist--)
{
x += list->xOff;
y += list->yOff;
n = list->len;
while (n--)
{
glyph = *glyphs++;
if (!pPicture)
{
pPixmap = GetScratchPixmapHeader (pScreen, glyph->info.width, glyph->info.height,
list->format->depth,
list->format->depth,
0, (pointer) (glyph + 1));
if (!pPixmap)
return;
component_alpha = NeedsComponent(list->format->format);
pPicture = CreatePicture (0, &pPixmap->drawable, list->format,
CPComponentAlpha, &component_alpha,
serverClient, &error);
if (!pPicture)
{
FreeScratchPixmapHeader (pPixmap);
return;
}
}
(*pScreen->ModifyPixmapHeader) (pPixmap,
glyph->info.width, glyph->info.height,
0, 0, -1, (pointer) (glyph + 1));
#ifdef NXAGENT_SERVER
/*
* The following line fixes a problem with glyphs that appeared
* as clipped. It was a side effect due the validate function
* "ValidatePicture" that makes a check on the Drawable serial
* number instead of the picture serial number, failing thus
* the clip mask update.
*/
pPicture->pDrawable->serialNumber = NEXT_SERIAL_NUMBER;
#endif
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (maskFormat)
{
CompositePicture (PictOpAdd,
pPicture,
None,
pMask,
0, 0,
0, 0,
x - glyph->info.x,
y - glyph->info.y,
glyph->info.width,
glyph->info.height);
}
else
{
CompositePicture (op,
pSrc,
pPicture,
pDst,
xSrc + (x - glyph->info.x) - xDst,
ySrc + (y - glyph->info.y) - yDst,
0, 0,
x - glyph->info.x,
y - glyph->info.y,
glyph->info.width,
glyph->info.height);
}
x += glyph->info.xOff;
y += glyph->info.yOff;
}
list++;
if (pPicture)
{
FreeScratchPixmapHeader (pPixmap);
FreePicture ((pointer) pPicture, 0);
pPicture = 0;
pPixmap = 0;
}
}
if (maskFormat)
{
x = extents.x1;
y = extents.y1;
CompositePicture (op,
pSrc,
pMask,
pDst,
xSrc + x - xDst,
ySrc + y - yDst,
0, 0,
x, y,
width, height);
FreePicture ((pointer) pMask, (XID) 0);
(*pScreen->DestroyPixmap) (pMaskPixmap);
}
}
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
/*
* $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.8 2002/09/03 19:28:28 keithp Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "scrnintstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "servermd.h"
#include "mi.h"
#include "picturestr.h"
#include "mipict.h"
#ifdef NXAGENT_SERVER
#include "Render.h"
#endif
PicturePtr
miCreateAlphaPicture (ScreenPtr pScreen,
PicturePtr pDst,
PictFormatPtr pPictFormat,
CARD16 width,
CARD16 height)
{
PixmapPtr pPixmap;
PicturePtr pPicture;
GCPtr pGC;
int error;
xRectangle rect;
if (width > 32767 || height > 32767)
return 0;
if (!pPictFormat)
{
if (pDst->polyEdge == PolyEdgeSharp)
pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
else
pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
if (!pPictFormat)
return 0;
}
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
pPictFormat->depth);
if (!pPixmap)
return 0;
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
if (!pGC)
{
(*pScreen->DestroyPixmap) (pPixmap);
return 0;
}
ValidateGC (&pPixmap->drawable, pGC);
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
(*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
FreeScratchGC (pGC);
pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
0, 0, serverClient, &error);
(*pScreen->DestroyPixmap) (pPixmap);
return pPicture;
}
static xFixed
miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
{
xFixed dx = l->p2.x - l->p1.x;
xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
xFixed dy = l->p2.y - l->p1.y;
if (ceil)
ex += (dy - 1);
return l->p1.x + (xFixed) (ex / dy);
}
void
miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box)
{
box->y1 = MAXSHORT;
box->y2 = MINSHORT;
box->x1 = MAXSHORT;
box->x2 = MINSHORT;
for (; ntrap; ntrap--, traps++)
{
INT16 x1, y1, x2, y2;
if (!xTrapezoidValid(traps))
continue;
y1 = xFixedToInt (traps->top);
if (y1 < box->y1)
box->y1 = y1;
y2 = xFixedToInt (xFixedCeil (traps->bottom));
if (y2 > box->y2)
box->y2 = y2;
x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE),
miLineFixedX (&traps->left, traps->bottom, FALSE)));
if (x1 < box->x1)
box->x1 = x1;
x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE),
miLineFixedX (&traps->right, traps->bottom, TRUE))));
if (x2 > box->x2)
box->x2 = x2;
}
}
void
miTrapezoids (CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc,
INT16 ySrc,
int ntrap,
xTrapezoid *traps)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen);
/*
* Check for solid alpha add
*/
if (op == PictOpAdd && miIsSolidAlpha (pSrc))
{
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
}
else if (maskFormat)
{
PicturePtr pPicture;
BoxRec bounds;
INT16 xDst, yDst;
INT16 xRel, yRel;
xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16;
#ifdef NXAGENT_SERVER
if (nxagentTrapezoidExtents != NullBox)
{
memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec));
}
else
{
nxagentTrapezoidExtents = (BoxPtr) xalloc(sizeof(BoxRec));
miTrapezoidBounds (ntrap, traps, &bounds);
memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec));
}
#else
miTrapezoidBounds (ntrap, traps, &bounds);
#endif
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
return;
pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
if (!pPicture)
return;
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pPicture, traps,
-bounds.x1, -bounds.y1);
xRel = bounds.x1 + xSrc - xDst;
yRel = bounds.y1 + ySrc - yDst;
CompositePicture (op, pSrc, pPicture, pDst,
xRel, yRel, 0, 0, bounds.x1, bounds.y1,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
FreePicture (pPicture, 0);
}
else
{
if (pDst->polyEdge == PolyEdgeSharp)
maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
else
maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
for (; ntrap; ntrap--, traps++)
miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment