Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2

Conflicts:

	Makefile.am
	hw/xfree86/Makefile.am
This commit is contained in:
Alan Hourihane 2008-04-15 10:43:23 +01:00
commit f098c460bf
286 changed files with 6170 additions and 34348 deletions

5
.gitignore vendored
View file

@ -8,11 +8,12 @@ Makefile.in
*.a
*.o
*~
.*.swp
.*sw?
*.pbxuser
*.mode1v3
obj*
build*
local
aclocal.m4
autom4te.cache
compile
@ -23,12 +24,14 @@ config.sub
configure
configure.lineno
depcomp
doltcompile
install-sh
libtool
ltmain.sh
missing
TAGS
tags
cscope*
ylwrap
xorg-server.pc
stamp-h?

View file

@ -11,10 +11,10 @@ AM_CPPFLAGS = \
if HAVE_AGL_FRAMEWORK
noinst_LIBRARIES = libAGLcore.a
libAGLcore_a_SOURCES = aglGlx.c \
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.c \
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.h \
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.c \
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \
$(top_srcdir)/hw/xquartz/xpr/x-list.c \
$(top_srcdir)/hw/xquartz/xpr/x-list.h \
$(top_srcdir)/hw/xquartz/xpr/x-hash.c \
$(top_srcdir)/hw/xquartz/xpr/x-hash.h \
$(top_srcdir)/hw/dmx/glxProxy/compsize.c
endif

View file

@ -31,8 +31,6 @@ INCLUDES = \
nodist_libglx_la_SOURCES = indirect_size.h \
glapi.c \
glcontextmodes.c \
glcontextmode.h \
glthread.c \
indirect_dispatch.c \
indirect_dispatch.h \

View file

@ -50,7 +50,6 @@
#include <windowstr.h>
#include "glxutil.h"
#include "glxext.h"
#include "glcontextmodes.h"
#include "glapitable.h"
#include "glapi.h"
#include "glthread.h"
@ -83,9 +82,9 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
static int
validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
__GLcontextModes **config, int *err)
__GLXconfig **config, int *err)
{
__GLcontextModes *m;
__GLXconfig *m;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
if (m->fbconfigID == id) {
@ -101,7 +100,7 @@ validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
static int
validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
__GLcontextModes **config, int *err)
__GLXconfig **config, int *err)
{
int i;
@ -118,7 +117,7 @@ validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
}
static int
validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config,
validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
DrawablePtr pDraw, int *err)
{
ScreenPtr pScreen = pDraw->pScreen;
@ -135,7 +134,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config,
}
/* FIXME: What exactly should we check here... */
if (pVisual->class != _gl_convert_to_x_visual_type(config->visualType) ||
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
!(config->drawableType & GLX_WINDOW_BIT)) {
client->errorValue = pDraw->id;
*err = BadMatch;
@ -161,7 +160,7 @@ static void __glXdirectContextDestroy(__GLXcontext *context)
}
static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
__GLcontextModes *modes,
__GLXconfig *modes,
__GLXcontext *shareContext)
{
__GLXcontext *context;
@ -186,7 +185,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
static int
DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
GLXContextID shareList, __GLcontextModes *config,
GLXContextID shareList, __GLXconfig *config,
__GLXscreen *pGlxScreen, GLboolean isDirect)
{
ClientPtr client = cl->client;
@ -248,7 +247,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
** a GL core that needs windowing information (e.g., Mesa).
*/
glxc->pGlxScreen = pGlxScreen;
glxc->modes = config;
glxc->config = config;
/*
** Register this context as a resource.
@ -276,7 +275,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@ -292,7 +291,7 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@ -309,7 +308,7 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateContextWithConfigSGIXReq *req =
(xGLXCreateContextWithConfigSGIXReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@ -462,7 +461,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
* GLXPixmap and we just return the __GLXdrawable. */
pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes);
if (pGlxDraw != NULL) {
if (glxc != NULL && pGlxDraw->modes != glxc->modes) {
if (glxc != NULL && pGlxDraw->config != glxc->config) {
client->errorValue = drawId;
*error = BadMatch;
return NULL;
@ -479,7 +478,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
* resource ID clashes. Effectively, the X Window is now also a
* GLXWindow. */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = drawId;
*error = __glXError(GLXBadDrawable);
@ -497,12 +496,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
* the context screen and that the context fbconfig is compatible
* with the window visual. */
if (pDraw->pScreen != glxc->pGlxScreen->pScreen ||
!validGlxFBConfigForWindow(client, glxc->modes, pDraw, error))
!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
return NULL;
pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
pDraw, GLX_DRAWABLE_WINDOW,
drawId, glxc->modes);
drawId, glxc->config);
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
@ -878,7 +877,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client;
xGLXGetVisualConfigsReply reply;
__GLXscreen *pGlxScreen;
__GLcontextModes *modes;
__GLXconfig *modes;
CARD32 buf[__GLX_TOTAL_CONFIG];
int p, i, err;
__GLX_DECLARE_SWAP_VARIABLES;
@ -907,7 +906,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
p = 0;
buf[p++] = modes->visualID;
buf[p++] = _gl_convert_to_x_visual_type( modes->visualType );
buf[p++] = glxConvertToXVisualType( modes->visualType );
buf[p++] = modes->rgbMode;
buf[p++] = modes->redBits;
@ -944,6 +943,12 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
buf[p++] = modes->transparentAlpha;
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
buf[p++] = modes->transparentIndex;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
@ -954,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
return Success;
}
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28)
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (33)
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
/**
* Send the set of GLXFBConfigs to the client. There is not currently
@ -974,7 +979,7 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
__GLXscreen *pGlxScreen;
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
int p, err;
__GLcontextModes *modes;
__GLXconfig *modes;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@ -1032,6 +1037,11 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
@ -1056,7 +1066,7 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
}
static int
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config,
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
DrawablePtr pDraw, XID glxDrawableId, int type)
{
__GLXdrawable *pGlxDraw;
@ -1080,13 +1090,13 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes
}
static int
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config,
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
XID drawableId, XID glxDrawableId)
{
DrawablePtr pDraw;
int err;
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixUnknownAccess);
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
if (err != Success || pDraw->type != DRAWABLE_PIXMAP) {
client->errorValue = drawableId;
return BadPixmap;
@ -1138,7 +1148,7 @@ determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs)
int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@ -1154,7 +1164,7 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@ -1178,7 +1188,7 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateGLXPixmapWithConfigSGIXReq *req =
(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
@ -1240,7 +1250,7 @@ static int
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
int width, int height, XID glxDrawableId)
{
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
PixmapPtr pPixmap;
int err;
@ -1353,7 +1363,7 @@ int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
{
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
__GLcontextModes *config;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
ClientPtr client = cl->client;
DrawablePtr pDraw;
@ -1364,7 +1374,7 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
return err;
err = dixLookupDrawable(&pDraw, req->window, client, 0, DixUnknownAccess);
err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = req->window;
return BadWindow;
@ -1467,7 +1477,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
*pSendBuf++ = (int)(ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
*pSendBuf++ = (int)(ctx->modes->visualID);
*pSendBuf++ = (int)(ctx->config->visualID);
*pSendBuf++ = GLX_SCREEN_EXT;
*pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
@ -2004,7 +2014,7 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
int screen, rc;
__GLXscreen *pGlxScreen;
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess);
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
pGlxScreen = glxGetScreen(pDraw->pScreen);
if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
screen = pDraw->pScreen->myNum;

View file

@ -40,8 +40,6 @@
**
*/
#include "GL/internal/glcore.h"
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
struct __GLXtextureFromPixmap {
int (*bindTexImage) (__GLXcontext *baseContext,
@ -77,9 +75,9 @@ struct __GLXcontext {
__GLXcontext *nextReadPriv;
/*
** mode struct for this context
** config struct for this context
*/
__GLcontextModes *modes;
__GLXconfig *config;
/*
** Pointer to screen info data for this context. This is set

View file

@ -74,7 +74,7 @@ struct __GLXdrawable {
/*
** Configuration of the visual to which this drawable was created.
*/
__GLcontextModes *modes;
__GLXconfig *config;
/*
** Lists of contexts bound to this drawable. There are two lists here.

View file

@ -52,7 +52,6 @@
#define DRI_NEW_INTERFACE_ONLY
#include "glxserver.h"
#include "glxutil.h"
#include "glcontextmodes.h"
#include "g_disptab.h"
#include "glapitable.h"
@ -61,26 +60,26 @@
#include "dispatch.h"
#include "extension_string.h"
#define containerOf(ptr, type, member) \
(type *)( (char *)ptr - offsetof(type,member) )
typedef struct __GLXDRIscreen __GLXDRIscreen;
typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
typedef struct __GLXDRIconfig __GLXDRIconfig;
struct __GLXDRIscreen {
__GLXscreen base;
__DRIscreen driScreen;
__DRIscreen *driScreen;
void *driver;
xf86EnterVTProc *enterVT;
xf86LeaveVTProc *leaveVT;
__DRIcopySubBufferExtension *copySubBuffer;
__DRIswapControlExtension *swapControl;
const __DRIcoreExtension *core;
const __DRIlegacyExtension *legacy;
const __DRIcopySubBufferExtension *copySubBuffer;
const __DRIswapControlExtension *swapControl;
#ifdef __DRI_TEX_OFFSET
__DRItexOffsetExtension *texOffset;
const __DRItexOffsetExtension *texOffset;
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
__GLXDRIdrawable *texOffsetOverride[16];
@ -92,13 +91,13 @@ struct __GLXDRIscreen {
struct __GLXDRIcontext {
__GLXcontext base;
__DRIcontext driContext;
__DRIcontext *driContext;
XID hwContextID;
};
struct __GLXDRIdrawable {
__GLXdrawable base;
__DRIdrawable driDrawable;
__DRIdrawable *driDrawable;
/* Pulled in from old __GLXpixmap */
#ifdef __DRI_TEX_OFFSET
@ -109,7 +108,10 @@ struct __GLXDRIdrawable {
#endif
};
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI_CREATE_NEW_SCREEN_STRING;
struct __GLXDRIconfig {
__GLXconfig config;
__DRIconfig *driConfig;
};
static void
__glXDRIleaveServer(GLboolean rendering)
@ -151,7 +153,7 @@ __glXDRIleaveServer(GLboolean rendering)
__GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
if (pGlxPix && pGlxPix->texname) {
screen->texOffset->setTexOffset(&pGlxPix->ctx->driContext,
screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
pGlxPix->texname,
pGlxPix->offset,
pGlxPix->base.pDraw->depth,
@ -219,24 +221,24 @@ static void
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
__GLXDRIscreen *screen;
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
glxGetScreen(screenInfo.screens[i]),
private);
screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
__glXDRIdoReleaseTexImage(screen, private);
}
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
/* If the X window was destroyed, the dri DestroyWindow hook will
* aready have taken care of this, so only call if pDraw isn't NULL. */
if (drawable->pDraw != NULL) {
__glXenterServer(GL_FALSE);
DRIDestroyDrawable(drawable->pDraw->pScreen,
serverClient, drawable->pDraw);
__glXleaveServer(GL_FALSE);
screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
(*screen->core->destroyDrawable)(private->driDrawable);
__glXenterServer(GL_FALSE);
DRIDestroyDrawable(drawable->pDraw->pScreen,
serverClient, drawable->pDraw);
__glXleaveServer(GL_FALSE);
}
xfree(private);
@ -255,8 +257,10 @@ static GLboolean
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIscreen *screen =
(__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
(*private->driDrawable.swapBuffers)(&private->driDrawable);
(*screen->core->swapBuffers)(private->driDrawable);
return TRUE;
}
@ -266,11 +270,11 @@ static int
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
{
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(baseDrawable->pDraw->pScreen);
__GLXDRIscreen *screen =
(__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
if (screen->swapControl)
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
screen->swapControl->setSwapInterval(draw->driDrawable, interval);
return 0;
}
@ -285,20 +289,21 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
glxGetScreen(basePrivate->pDraw->pScreen);
if (screen->copySubBuffer)
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
x, y, w, h);
screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
}
static void
__glXDRIcontextDestroy(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
Bool retval;
context->driContext.destroyContext(&context->driContext);
screen->core->destroyContext(context->driContext);
__glXenterServer(GL_FALSE);
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen, context->hwContextID);
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen,
context->hwContextID);
__glXleaveServer(GL_FALSE);
__glXContextDestroy(&context->base);
@ -309,20 +314,22 @@ static int
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
return (*context->driContext.bindContext)(&context->driContext,
&draw->driDrawable,
&read->driDrawable);
return (*screen->core->bindContext)(context->driContext,
draw->driDrawable,
read->driDrawable);
}
static int
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
return (*context->driContext.unbindContext)(&context->driContext);
return (*screen->core->unbindContext)(context->driContext);
}
static int
@ -331,13 +338,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
/* FIXME: We will need to add DRIcontext::copyContext for this. */
(void) dst;
(void) src;
return FALSE;
return (*screen->core->copyContext)(dst->driContext,
src->driContext, mask);
}
static int
@ -346,10 +350,11 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
return (*context->driContext.bindContext)(&context->driContext,
&draw->driDrawable,
&read->driDrawable);
return (*screen->core->bindContext)(context->driContext,
draw->driDrawable,
read->driDrawable);
}
static void
@ -392,10 +397,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
int bpp, override = 0, texname;
GLenum format, type;
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
__GLXDRIdrawable *driDraw =
containerOf(glxPixmap, __GLXDRIdrawable, base);
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) glxGetScreen(pScreen);
__GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap;
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
GL_TEXTURE_BINDING_2D :
@ -439,7 +442,7 @@ alreadyin:
driDraw->texname = texname;
screen->texOffset->setTexOffset(&driDraw->ctx->driContext, texname, 0,
screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
pixmap->drawable.depth,
pixmap->devKind);
}
@ -568,9 +571,11 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
int buffer,
__GLXdrawable *pixmap)
{
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
glxGetScreen(pixmap->pDraw->pScreen),
containerOf(pixmap, __GLXDRIdrawable, base));
__GLXDRIscreen *screen =
(__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap;
__glXDRIdoReleaseTexImage(screen, drawable);
return Success;
}
@ -585,7 +590,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
screen->driScreen.destroyScreen(&screen->driScreen);
screen->core->destroyScreen(screen->driScreen);
dlclose(screen->driver);
@ -596,11 +601,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
__GLcontextModes *modes,
__GLXconfig *glxConfig,
__GLXcontext *baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
VisualPtr visual;
int i;
GLboolean retval;
@ -610,7 +616,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = &shareContext->driContext;
driShare = shareContext->driContext;
else
driShare = NULL;
@ -632,7 +638,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
/* Find the requested X visual */
visual = pScreen->visuals;
for (i = 0; i < pScreen->numVisuals; i++, visual++)
if (visual->vid == modes->visualID)
if (visual->vid == glxConfig->visualID)
break;
if (i == pScreen->numVisuals)
return GL_FALSE;
@ -644,15 +650,15 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
context->hwContextID, &hwContext);
__glXleaveServer(GL_FALSE);
context->driContext.private =
screen->driScreen.createNewContext(&screen->driScreen,
modes,
0, /* render type */
driShare,
hwContext,
&context->driContext);
context->driContext =
screen->legacy->createNewContext(screen->driScreen,
config->driConfig,
0, /* render type */
driShare,
hwContext,
context);
if (context->driContext.private == NULL) {
if (context->driContext == NULL) {
__glXenterServer(GL_FALSE);
retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
__glXleaveServer(GL_FALSE);
@ -668,9 +674,10 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
DrawablePtr pDraw,
int type,
XID drawId,
__GLcontextModes *modes)
__GLXconfig *glxConfig)
{
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
GLboolean retval;
drm_drawable_t hwDrawable;
@ -682,7 +689,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
memset(private, 0, sizeof *private);
if (!__glXDrawableInit(&private->base, screen,
pDraw, type, drawId, modes)) {
pDraw, type, drawId, glxConfig)) {
xfree(private);
return NULL;
}
@ -700,13 +707,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
/* The last argument is 'attrs', which is used with pbuffers which
* we currently don't support. */
private->driDrawable.private =
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
modes,
&private->driDrawable,
hwDrawable, 0, NULL);
private->driDrawable =
(driScreen->legacy->createNewDrawable)(driScreen->driScreen,
config->driConfig,
hwDrawable, 0, NULL, private);
if (private->driDrawable.private == NULL) {
if (private->driDrawable == NULL) {
__glXenterServer(GL_FALSE);
DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
__glXleaveServer(GL_FALSE);
@ -723,10 +729,10 @@ getDrawableInfo(__DRIdrawable *driDrawable,
int *x, int *y, int *width, int *height,
int *numClipRects, drm_clip_rect_t **ppClipRects,
int *backX, int *backY,
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects)
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects,
void *data)
{
__GLXDRIdrawable *drawable = containerOf(driDrawable,
__GLXDRIdrawable, driDrawable);
__GLXDRIdrawable *drawable = data;
ScreenPtr pScreen;
drm_clip_rect_t *pClipRects, *pBackClipRects;
GLboolean retval;
@ -810,10 +816,10 @@ getUST(int64_t *ust)
static void __glXReportDamage(__DRIdrawable *driDraw,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
GLboolean front_buffer)
GLboolean front_buffer,
void *data)
{
__GLXDRIdrawable *drawable =
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
__GLXDRIdrawable *drawable = data;
DrawablePtr pDraw = drawable->base.pDraw;
RegionRec region;
@ -827,19 +833,31 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
__glXleaveServer(GL_FALSE);
}
/* Table of functions that we export to the driver. */
static const __DRIinterfaceMethods interface_methods = {
_gl_context_modes_create,
_gl_context_modes_destroy,
getDrawableInfo,
static const __DRIsystemTimeExtension systemTimeExtension = {
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
getUST,
NULL, /* glXGetMscRateOML, */
NULL,
};
static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
{ __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION },
getDrawableInfo
};
static const __DRIdamageExtension damageExtension = {
{ __DRI_DAMAGE, __DRI_DAMAGE_VERSION },
__glXReportDamage,
};
static const __DRIextension *loader_extensions[] = {
&systemTimeExtension.base,
&getDrawableInfoExtension.base,
&damageExtension.base,
NULL
};
static const char dri_driver_path[] = DRI_DRIVER_PATH;
static Bool
@ -877,7 +895,8 @@ initializeExtensions(__GLXDRIscreen *screen)
const __DRIextension **extensions;
int i;
extensions = screen->driScreen.getExtensions(&screen->driScreen);
extensions = screen->core->getExtensions(screen->driScreen);
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
@ -911,12 +930,12 @@ initializeExtensions(__GLXDRIscreen *screen)
}
}
#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
extern __GLXconfig *
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
PFNCREATENEWSCREENFUNC createNewScreen;
drm_handle_t hSAREA;
drmAddress pSAREA = NULL;
char *BusID;
@ -926,7 +945,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__DRIframebuffer framebuffer;
int fd = -1;
int status;
int api_ver = 20070121;
drm_magic_t magic;
drmVersionPtr version;
int newlyopened;
@ -934,11 +952,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
drm_handle_t hFB;
int junk;
__GLXDRIscreen *screen;
void *dev_priv = NULL;
char filename[128];
Bool isCapable;
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
const __DRIconfig **driConfigs;
const __DRIextension **extensions;
int i;
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
!DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
@ -966,9 +986,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
dri_version.minor = XF86DRI_MINOR_VERSION;
dri_version.patch = XF86DRI_PATCH_VERSION;
framebuffer.base = NULL;
framebuffer.dev_priv = NULL;
if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
goto handle_error;
@ -1027,11 +1044,30 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
if (createNewScreen == NULL) {
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
CREATE_NEW_SCREEN_FUNC, dlerror());
goto handle_error;
extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS);
if (extensions == NULL) {
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
driverName, dlerror());
goto handle_error;
}
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
extensions[i]->version >= __DRI_CORE_VERSION) {
screen->core = (__DRIcoreExtension *) extensions[i];
}
if (strcmp(extensions[i]->name, __DRI_LEGACY) == 0 &&
extensions[i]->version >= __DRI_LEGACY_VERSION) {
screen->legacy = (__DRIlegacyExtension *) extensions[i];
}
}
if (screen->core == NULL || screen->legacy == NULL) {
LogMessage(X_ERROR,
"AIGLX error: %s does not export required DRI extension\n",
driverName);
goto handle_error;
}
/*
@ -1047,19 +1083,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
/* Sigh... the DRI interface is broken; the DRI driver will free
* the dev private pointer using _mesa_free() on screen destroy,
* but we can't use _mesa_malloc() here. In fact, the DRI driver
* shouldn't free data it didn't allocate itself, but what can you
* do... */
dev_priv = xalloc(framebuffer.dev_priv_size);
if (dev_priv == NULL) {
LogMessage(X_ERROR, "AIGLX error: dev_priv allocation failed");
goto handle_error;
}
memcpy(dev_priv, framebuffer.dev_priv, framebuffer.dev_priv_size);
framebuffer.dev_priv = dev_priv;
framebuffer.width = pScreen->width;
framebuffer.height = pScreen->height;
@ -1082,29 +1105,30 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
screen->driScreen.private =
(*createNewScreen)(pScreen->myNum,
&screen->driScreen,
&ddx_version,
&dri_version,
&drm_version,
&framebuffer,
pSAREA,
fd,
api_ver,
&interface_methods,
&screen->base.fbconfigs);
screen->driScreen =
(*screen->legacy->createNewScreen)(pScreen->myNum,
&ddx_version,
&dri_version,
&drm_version,
&framebuffer,
pSAREA,
fd,
loader_extensions,
&driConfigs,
screen);
if (screen->driScreen.private == NULL) {
if (screen->driScreen == NULL) {
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
goto handle_error;
}
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
&screen->texOffsetFinish);
screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
initializeExtensions(screen);
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
&screen->texOffsetFinish);
__glXScreenInit(&screen->base, pScreen);
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
@ -1137,9 +1161,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
if (framebuffer.base != NULL)
drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
if (dev_priv != NULL)
xfree(dev_priv);
if (fd >= 0)
drmCloseOnce(fd);

View file

@ -35,20 +35,18 @@
#include <drm.h>
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#include <GL/glxtokens.h>
#include <windowstr.h>
#include <os.h>
#define _XF86DRI_SERVER_
#include <xf86drm.h>
#include <xf86dristr.h>
#include <xf86str.h>
#include <xf86.h>
#include <dri2.h>
#include "glxserver.h"
#include "glxutil.h"
#include "glcontextmodes.h"
#include "g_disptab.h"
#include "glapitable.h"
@ -57,53 +55,56 @@
#include "dispatch.h"
#include "extension_string.h"
#define containerOf(ptr, type, member) \
(type *)( (char *)ptr - offsetof(type,member) )
typedef struct __GLXDRIscreen __GLXDRIscreen;
typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
typedef struct __GLXDRIconfig __GLXDRIconfig;
struct __GLXDRIscreen {
__GLXscreen base;
__DRIscreen driScreen;
__DRIscreen *driScreen;
void *driver;
int fd;
xf86EnterVTProc *enterVT;
xf86LeaveVTProc *leaveVT;
__DRIcopySubBufferExtension *copySubBuffer;
__DRIswapControlExtension *swapControl;
__DRItexBufferExtension *texBuffer;
const __DRIcoreExtension *core;
const __DRIcopySubBufferExtension *copySubBuffer;
const __DRIswapControlExtension *swapControl;
const __DRItexBufferExtension *texBuffer;
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
};
struct __GLXDRIcontext {
__GLXcontext base;
__DRIcontext driContext;
drm_context_t hwContext;
__GLXcontext base;
__DRIcontext *driContext;
};
struct __GLXDRIdrawable {
__GLXdrawable base;
__DRIdrawable driDrawable;
__GLXdrawable base;
__DRIdrawable *driDrawable;
__GLXDRIscreen *screen;
};
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI2_CREATE_NEW_SCREEN_STRING;
struct __GLXDRIconfig {
__GLXconfig config;
const __DRIconfig *driConfig;
};
static void
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
const __DRIcoreExtension *core = private->screen->core;
(*core->destroyDrawable)(private->driDrawable);
/* If the X window was destroyed, the dri DestroyWindow hook will
* aready have taken care of this, so only call if pDraw isn't NULL. */
if (drawable->pDraw != NULL)
DRI2DestroyDrawable(drawable->pDraw->pScreen, drawable->pDraw);
DRI2DestroyDrawable(drawable->pDraw);
xfree(private);
}
@ -118,25 +119,25 @@ __glXDRIdrawableResize(__GLXdrawable *glxPriv)
}
static GLboolean
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
__glXDRIdrawableSwapBuffers(__GLXdrawable *drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
const __DRIcoreExtension *core = private->screen->core;
(*private->driDrawable.swapBuffers)(&private->driDrawable);
(*core->swapBuffers)(private->driDrawable);
return TRUE;
}
static int
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
{
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(baseDrawable->pDraw->pScreen);
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
const __DRIswapControlExtension *swapControl = private->screen->swapControl;
if (screen->swapControl)
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
if (swapControl)
swapControl->setSwapInterval(private->driDrawable, interval);
return 0;
}
@ -147,22 +148,20 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
__GLXDRIscreen *screen = (__GLXDRIscreen *)
glxGetScreen(basePrivate->pDraw->pScreen);
const __DRIcopySubBufferExtension *copySubBuffer =
private->screen->copySubBuffer;
if (screen->copySubBuffer)
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
x, y, w, h);
if (copySubBuffer)
(*copySubBuffer->copySubBuffer)(private->driDrawable, x, y, w, h);
}
static void
__glXDRIcontextDestroy(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseContext->pGlxScreen;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
context->driContext.destroyContext(&context->driContext);
drmDestroyContext(screen->fd, context->hwContext);
(*screen->core->destroyContext)(context->driContext);
__glXContextDestroy(&context->base);
xfree(context);
}
@ -173,18 +172,20 @@ __glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
return (*context->driContext.bindContext)(&context->driContext,
&draw->driDrawable,
&read->driDrawable);
return (*screen->core->bindContext)(context->driContext,
draw->driDrawable,
read->driDrawable);
}
static int
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
return (*context->driContext.unbindContext)(&context->driContext);
return (*screen->core->unbindContext)(context->driContext);
}
static int
@ -193,13 +194,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
/* FIXME: We will need to add DRIcontext::copyContext for this. */
(void) dst;
(void) src;
return FALSE;
return (*screen->core->copyContext)(dst->driContext,
src->driContext, mask);
}
static int
@ -208,46 +206,30 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
return (*context->driContext.bindContext)(&context->driContext,
&draw->driDrawable,
&read->driDrawable);
return (*screen->core->bindContext)(context->driContext,
draw->driDrawable,
read->driDrawable);
}
#ifdef __DRI_TEX_BUFFER
#define isPowerOfTwo(n) (((n) & ((n) - 1 )) == 0)
static int
__glXDRIbindTexImage(__GLXcontext *baseContext,
int buffer,
__GLXdrawable *glxPixmap)
{
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
PixmapPtr pixmap;
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
unsigned int flags;
int w, h, target;
if (screen->texBuffer == NULL)
if (texBuffer == NULL)
return Success;
pixmap = (PixmapPtr) glxPixmap->pDraw;
w = pixmap->drawable.width;
h = pixmap->drawable.height;
if (!isPowerOfTwo(w) || !isPowerOfTwo(h))
target = GL_TEXTURE_RECTANGLE_ARB;
else
target = GL_TEXTURE_2D;
screen->texBuffer->setTexBuffer(&context->driContext,
target,
DRI2GetPixmapHandle(pixmap, &flags),
pixmap->drawable.depth,
pixmap->devKind,
h);
texBuffer->setTexBuffer(context->driContext,
glxPixmap->target,
drawable->driDrawable);
return Success;
}
@ -291,7 +273,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
screen->driScreen.destroyScreen(&screen->driScreen);
(*screen->core->destroyScreen)(screen->driScreen);
dlclose(screen->driver);
@ -302,16 +284,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
__GLcontextModes *modes,
__GLXconfig *glxConfig,
__GLXcontext *baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
const __DRIcoreExtension *core = screen->core;
__DRIcontext *driShare;
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = &shareContext->driContext;
driShare = shareContext->driContext;
else
driShare = NULL;
@ -327,16 +311,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
context->base.forceCurrent = __glXDRIcontextForceCurrent;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
if (drmCreateContext(screen->fd, &context->hwContext))
return GL_FALSE;
context->driContext.private =
screen->driScreen.createNewContext(&screen->driScreen,
modes,
0, /* render type */
driShare,
context->hwContext,
&context->driContext);
context->driContext =
(*core->createNewContext)(screen->driScreen,
config->driConfig, driShare, context);
return &context->base;
}
@ -346,12 +323,13 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
DrawablePtr pDraw,
int type,
XID drawId,
__GLcontextModes *modes)
__GLXconfig *glxConfig)
{
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
GLboolean retval;
drm_drawable_t hwDrawable;
unsigned int handle, head;
private = xalloc(sizeof *private);
if (private == NULL)
@ -359,8 +337,9 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
memset(private, 0, sizeof *private);
private->screen = driScreen;
if (!__glXDrawableInit(&private->base, screen,
pDraw, type, drawId, modes)) {
pDraw, type, drawId, glxConfig)) {
xfree(private);
return NULL;
}
@ -370,13 +349,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
retval = DRI2CreateDrawable(screen->pScreen, pDraw, &hwDrawable);
retval = DRI2CreateDrawable(pDraw, &handle, &head);
private->driDrawable.private =
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
modes,
&private->driDrawable,
hwDrawable, 0, NULL);
private->driDrawable =
(*driScreen->core->createNewDrawable)(driScreen->driScreen,
config->driConfig,
handle, head, private);
return &private->base;
}
@ -397,33 +375,44 @@ getUST(int64_t *ust)
}
}
static void __glXReportDamage(__DRIdrawable *driDraw,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
GLboolean front_buffer)
static const __DRIsystemTimeExtension systemTimeExtension = {
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
getUST,
NULL,
};
static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail,
void *loaderPrivate)
{
__GLXDRIdrawable *drawable =
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
__GLXDRIdrawable *pdraw = loaderPrivate;
DRI2ReemitDrawableInfo(pdraw->base.pDraw, tail);
}
static void dri2PostDamage(__DRIdrawable *draw,
struct drm_clip_rect *rects,
int numRects, void *loaderPrivate)
{
__GLXDRIdrawable *drawable = loaderPrivate;
DrawablePtr pDraw = drawable->base.pDraw;
RegionRec region;
REGION_INIT(pDraw->pScreen, &region, (BoxPtr) rects, num_rects);
REGION_INIT(pDraw->pScreen, &region, (BoxPtr) rects, numRects);
REGION_TRANSLATE(pScreen, &region, pDraw->x, pDraw->y);
DamageDamageRegion(pDraw, &region);
REGION_UNINIT(pDraw->pScreen, &region);
}
/* Table of functions that we export to the driver. */
static const __DRIinterfaceMethods interface_methods = {
_gl_context_modes_create,
_gl_context_modes_destroy,
static const __DRIloaderExtension loaderExtension = {
{ __DRI_LOADER, __DRI_LOADER_VERSION },
dri2ReemitDrawableInfo,
dri2PostDamage
};
NULL,
getUST,
NULL,
__glXReportDamage,
static const __DRIextension *loader_extensions[] = {
&systemTimeExtension.base,
&loaderExtension.base,
NULL
};
static const char dri_driver_path[] = DRI_DRIVER_PATH;
@ -463,11 +452,13 @@ initializeExtensions(__GLXDRIscreen *screen)
const __DRIextension **extensions;
int i;
extensions = screen->driScreen.getExtensions(&screen->driScreen);
extensions = screen->core->getExtensions(screen->driScreen);
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
screen->copySubBuffer =
(const __DRIcopySubBufferExtension *) extensions[i];
__glXEnableExtension(screen->glx_enable_bits,
"GLX_MESA_copy_sub_buffer");
@ -477,7 +468,8 @@ initializeExtensions(__GLXDRIscreen *screen)
#ifdef __DRI_SWAP_CONTROL
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
screen->swapControl = (__DRIswapControlExtension *) extensions[i];
screen->swapControl =
(const __DRIswapControlExtension *) extensions[i];
__glXEnableExtension(screen->glx_enable_bits,
"GLX_SGI_swap_control");
__glXEnableExtension(screen->glx_enable_bits,
@ -489,7 +481,8 @@ initializeExtensions(__GLXDRIscreen *screen)
#ifdef __DRI_TEX_BUFFER
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
screen->texBuffer = (__DRItexBufferExtension *) extensions[i];
screen->texBuffer =
(const __DRItexBufferExtension *) extensions[i];
/* GLX_EXT_texture_from_pixmap is always enabled. */
LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
}
@ -498,34 +491,176 @@ initializeExtensions(__GLXDRIscreen *screen)
}
}
#define __ATTRIB(attrib, field) \
{ attrib, offsetof(__GLXconfig, field) }
static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
__ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode),
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
};
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
static void
setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value)
{
int i;
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
if (attribMap[i].attrib == attrib) {
*(unsigned int *) ((char *) config + attribMap[i].offset) = value;
return;
}
}
static __GLXconfig *
createModeFromConfig(const __DRIcoreExtension *core,
const __DRIconfig *driConfig,
unsigned int visualType)
{
__GLXDRIconfig *config;
unsigned int attrib, value;
int i;
config = xalloc(sizeof *config);
config->driConfig = driConfig;
i = 0;
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
switch (attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
if (value & __DRI_ATTRIB_RGBA_BIT) {
config->config.renderType |= GLX_RGBA_BIT;
config->config.rgbMode = GL_TRUE;
} else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
config->config.renderType |= GLX_COLOR_INDEX_BIT;
config->config.rgbMode = GL_FALSE;
} else {
config->config.renderType = 0;
config->config.rgbMode = GL_FALSE;
}
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
config->config.visualRating = GLX_NON_CONFORMANT_CONFIG;
else if (value & __DRI_ATTRIB_SLOW_BIT)
config->config.visualRating = GLX_SLOW_CONFIG;
else
config->config.visualRating = GLX_NONE;
break;
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
config->config.bindToTextureTargets = 0;
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT;
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT;
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
break;
default:
setScalar(&config->config, attrib, value);
break;
}
}
config->config.next = NULL;
config->config.xRenderable = GL_TRUE;
config->config.visualType = visualType;
config->config.drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
return &config->config;
}
__GLXconfig *
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
__GLXconfig *
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs)
{
__GLXconfig head, *tail;
int i;
tail = &head;
head.next = NULL;
for (i = 0; configs[i]; i++) {
tail->next = createModeFromConfig(core,
configs[i], GLX_TRUE_COLOR);
if (tail->next == NULL)
break;
tail = tail->next;
}
for (i = 0; configs[i]; i++) {
tail->next = createModeFromConfig(core,
configs[i], GLX_DIRECT_COLOR);
if (tail->next == NULL)
break;
tail = tail->next;
}
return head.next;
}
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
__DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen;
__DRIversion ddx_version;
__DRIversion dri_version;
__DRIversion drm_version;
drmVersionPtr version;
const char *driverName;
__GLXDRIscreen *screen;
char filename[128];
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
unsigned int sareaHandle;
const __DRIextension **extensions;
const __DRIconfig **driConfigs;
int i;
screen = xalloc(sizeof *screen);
if (screen == NULL)
return NULL;
return NULL;
memset(screen, 0, sizeof *screen);
if (!xf86LoaderCheckSymbol("DRI2Connect") ||
!DRI2Connect(pScreen,
&screen->fd,
&driverName,
&ddx_version.major,
&ddx_version.minor,
&ddx_version.patch,
&sareaHandle)) {
!DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle)) {
LogMessage(X_INFO,
"AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
return NULL;
@ -539,26 +674,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__glXInitExtensionEnableBits(screen->glx_enable_bits);
/* DRI protocol version. */
dri_version.major = XF86DRI_MAJOR_VERSION;
dri_version.minor = XF86DRI_MINOR_VERSION;
dri_version.patch = XF86DRI_PATCH_VERSION;
version = drmGetVersion(screen->fd);
if (version) {
drm_version.major = version->version_major;
drm_version.minor = version->version_minor;
drm_version.patch = version->version_patchlevel;
drmFreeVersion(version);
}
else {
drm_version.major = -1;
drm_version.minor = -1;
drm_version.patch = -1;
}
snprintf(filename, sizeof filename, "%s/%s_dri.so",
dri_driver_path, driverName);
snprintf(filename, sizeof filename,
"%s/%s_dri.so", dri_driver_path, driverName);
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
if (screen->driver == NULL) {
@ -567,31 +684,43 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
if (createNewScreen == NULL) {
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
CREATE_NEW_SCREEN_FUNC, dlerror());
goto handle_error;
extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS);
if (extensions == NULL) {
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
driverName, dlerror());
goto handle_error;
}
screen->driScreen.private =
(*createNewScreen)(pScreen->myNum,
&screen->driScreen,
&ddx_version,
&dri_version,
&drm_version,
screen->fd,
sareaHandle,
&interface_methods,
&screen->base.fbconfigs);
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
extensions[i]->version >= __DRI_CORE_VERSION) {
screen->core = (const __DRIcoreExtension *) extensions[i];
}
}
if (screen->driScreen.private == NULL) {
if (screen->core == NULL) {
LogMessage(X_ERROR, "AIGLX error: %s exports no DRI extension\n",
driverName);
goto handle_error;
}
screen->driScreen =
(*screen->core->createNewScreen)(pScreen->myNum,
screen->fd,
sareaHandle,
loader_extensions,
&driConfigs,
screen);
if (screen->driScreen == NULL) {
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
goto handle_error;
}
initializeExtensions(screen);
screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
__glXScreenInit(&screen->base, pScreen);
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);

View file

@ -46,7 +46,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <glxcontext.h>
#include <glxutil.h>
#include "glcontextmodes.h"
#include "os.h"
typedef struct __GLXMESAscreen __GLXMESAscreen;
@ -120,7 +119,7 @@ static __GLXdrawable *
__glXMesaScreenCreateDrawable(__GLXscreen *screen,
DrawablePtr pDraw, int type,
XID drawId,
__GLcontextModes *modes)
__GLXconfig *modes)
{
__GLXMESAdrawable *glxPriv;
XMesaVisual xm_vis;
@ -217,7 +216,7 @@ __glXMesaContextForceCurrent(__GLXcontext *baseContext)
static __GLXcontext *
__glXMesaScreenCreateContext(__GLXscreen *screen,
__GLcontextModes *modes,
__GLXconfig *config,
__GLXcontext *baseShareContext)
{
__GLXMESAcontext *context;
@ -232,7 +231,7 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
memset(context, 0, sizeof *context);
context->base.pGlxScreen = screen;
context->base.modes = modes;
context->base.config = config;
context->base.destroy = __glXMesaContextDestroy;
context->base.makeCurrent = __glXMesaContextMakeCurrent;
@ -240,10 +239,10 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
context->base.copy = __glXMesaContextCopy;
context->base.forceCurrent = __glXMesaContextForceCurrent;
xm_vis = find_mesa_visual(screen, modes->fbconfigID);
xm_vis = find_mesa_visual(screen, config->fbconfigID);
if (!xm_vis) {
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
modes->visualID);
config->visualID);
xfree(context);
return NULL;
}
@ -282,11 +281,11 @@ static XMesaVisual
find_mesa_visual(__GLXscreen *screen, XID fbconfigID)
{
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
const __GLcontextModes *modes;
const __GLXconfig *config;
unsigned i = 0;
for (modes = screen->fbconfigs; modes != NULL; modes = modes->next) {
if (modes->fbconfigID == fbconfigID)
for (config = screen->fbconfigs; config != NULL; config = config->next) {
if (config->fbconfigID == fbconfigID)
return mesaScreen->xm_vis[i];
i++;
}
@ -298,9 +297,18 @@ const static int numBack = 2;
const static int numDepth = 2;
const static int numStencil = 2;
static __GLcontextModes *
static const int glx_visual_types[] = {
GLX_STATIC_GRAY,
GLX_GRAY_SCALE,
GLX_STATIC_COLOR,
GLX_PSEUDO_COLOR,
GLX_TRUE_COLOR,
GLX_DIRECT_COLOR
};
static __GLXconfig *
createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
VisualPtr visual, __GLcontextModes *config)
VisualPtr visual, __GLXconfig *config)
{
int back, depth, stencil;
@ -309,7 +317,11 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
for (back = numBack - 1; back >= 0; back--)
for (depth = 0; depth < numDepth; depth++)
for (stencil = 0; stencil < numStencil; stencil++) {
config->visualType = _gl_convert_from_x_visual_type(visual->class);
config->next = xcalloc(sizeof(*config), 1);
config = config->next;
config->visualRating = GLX_NONE;
config->visualType = glx_visual_types[visual->class];
config->xRenderable = GL_TRUE;
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
config->rgbMode = (visual->class >= TrueColor);
@ -333,7 +345,6 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
config->alphaMask = 0;
config->rgbBits = config->rgbMode ? visual->nplanes : 0;
config->indexBits = config->colorIndexMode ? visual->nplanes : 0;
config = config->next;
}
return config;
@ -342,26 +353,27 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
static void
createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
{
__GLcontextModes *configs;
__GLXconfig head, *tail;
int i;
/* We assume here that each existing visual correspond to a
* different visual class. Note, this runs before COMPOSITE adds
* its visual, so it's not entirely crazy. */
pGlxScreen->numFBConfigs = pScreen->numVisuals * numBack * numDepth * numStencil;
pGlxScreen->fbconfigs = _gl_context_modes_create(pGlxScreen->numFBConfigs,
sizeof *configs);
configs = pGlxScreen->fbconfigs;
head.next = NULL;
tail = &head;
for (i = 0; i < pScreen->numVisuals; i++)
configs = createFBConfigsForVisual(pGlxScreen, pScreen,
&pScreen->visuals[i], configs);
tail = createFBConfigsForVisual(pGlxScreen, pScreen,
&pScreen->visuals[i], tail);
pGlxScreen->fbconfigs = head.next;
}
static void
createMesaVisuals(__GLXMESAscreen *pMesaScreen)
{
__GLcontextModes *config;
__GLXconfig *config;
ScreenPtr pScreen;
VisualPtr visual = NULL;
int i, j;

View file

@ -37,6 +37,7 @@
#include <dix-config.h>
#endif
#include <GL/glxtokens.h>
#include <string.h>
#include <windowstr.h>
#include <os.h>
@ -46,7 +47,6 @@
#include "glxserver.h"
#include "glxutil.h"
#include "glxext.h"
#include "glcontextmodes.h"
static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey;
@ -280,10 +280,23 @@ void GlxSetVisualConfigs(int nconfigs,
* call it. */
}
GLint glxConvertToXVisualType(int visualType)
{
static const int x_visual_types[] = {
TrueColor, DirectColor,
PseudoColor, StaticColor,
GrayScale, StaticGray
};
return ( (unsigned) (visualType - GLX_TRUE_COLOR) < 6 )
? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
}
static void
filterOutNativeConfigs(__GLXscreen *pGlxScreen)
{
__GLcontextModes *m, *next, *native_modes, **last;
__GLXconfig *m, *next, **last;
ScreenPtr pScreen = pGlxScreen->pScreen;
int i, depth;
@ -305,12 +318,12 @@ filterOutNativeConfigs(__GLXscreen *pGlxScreen)
}
static XID
findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m)
findVisualForConfig(ScreenPtr pScreen, __GLXconfig *m)
{
int i;
for (i = 0; i < pScreen->numVisuals; i++) {
if (_gl_convert_to_x_visual_type(m->visualType) == pScreen->visuals[i].class)
if (glxConvertToXVisualType(m->visualType) == pScreen->visuals[i].class)
return pScreen->visuals[i].vid;
}
@ -405,10 +418,10 @@ findFirstSet(unsigned int v)
}
static void
initGlxVisual(VisualPtr visual, __GLcontextModes *config)
initGlxVisual(VisualPtr visual, __GLXconfig *config)
{
config->visualID = visual->vid;
visual->class = _gl_convert_to_x_visual_type(config->visualType);
visual->class = glxConvertToXVisualType(config->visualType);
visual->bitsPerRGBValue = config->redBits;
visual->ColormapEntries = 1 << config->redBits;
visual->nplanes = config->redBits + config->greenBits + config->blueBits;
@ -426,15 +439,15 @@ typedef struct {
GLboolean depthBuffer;
} FBConfigTemplateRec, *FBConfigTemplatePtr;
static __GLcontextModes *
static __GLXconfig *
pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
{
__GLcontextModes *config;
__GLXconfig *config;
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
if (config->visualRating != GLX_NONE)
continue;
if (_gl_convert_to_x_visual_type(config->visualType) != class)
if (glxConvertToXVisualType(config->visualType) != class)
continue;
if ((config->doubleBufferMode > 0) != template->doubleBuffer)
continue;
@ -450,32 +463,36 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
static void
addMinimalSet(__GLXscreen *pGlxScreen)
{
__GLcontextModes *config;
__GLXconfig *config;
VisualPtr visuals;
int i;
int i, j;
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE };
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE };
pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
sizeof (__GLcontextModes *));
sizeof (__GLXconfig *));
if (pGlxScreen->visuals == NULL) {
ErrorF("Failed to allocate for minimal set of GLX visuals\n");
return;
}
pGlxScreen->numVisuals = pGlxScreen->pScreen->numVisuals;
visuals = pGlxScreen->pScreen->visuals;
for (i = 0; i < pGlxScreen->numVisuals; i++) {
for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
if (visuals[i].nplanes == 32)
config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
else
config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
if (config == NULL)
config = pGlxScreen->fbconfigs;
pGlxScreen->visuals[i] = config;
if (config == NULL)
continue;
pGlxScreen->visuals[j] = config;
config->visualID = visuals[i].vid;
j++;
}
pGlxScreen->numVisuals = j;
}
static void
@ -487,12 +504,12 @@ addTypicalSet(__GLXscreen *pGlxScreen)
static void
addFullSet(__GLXscreen *pGlxScreen)
{
__GLcontextModes *config;
__GLXconfig *config;
VisualPtr visuals;
int i, depth;
pGlxScreen->visuals =
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLcontextModes *));
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
if (pGlxScreen->visuals == NULL) {
ErrorF("Failed to allocate for full set of GLX visuals\n");
return;
@ -522,7 +539,7 @@ void GlxSetVisualConfig(int config)
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
{
__GLcontextModes *m;
__GLXconfig *m;
int i;
pGlxScreen->pScreen = pScreen;

View file

@ -40,8 +40,6 @@
**
*/
#include "GL/internal/glcore.h"
typedef struct {
void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
@ -57,6 +55,84 @@ typedef struct {
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
typedef struct __GLXconfig __GLXconfig;
struct __GLXconfig {
__GLXconfig *next;
GLboolean rgbMode;
GLboolean floatMode;
GLboolean colorIndexMode;
GLuint doubleBufferMode;
GLuint stereoMode;
GLboolean haveAccumBuffer;
GLboolean haveDepthBuffer;
GLboolean haveStencilBuffer;
GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
GLuint redMask, greenMask, blueMask, alphaMask;
GLint rgbBits; /* total bits for rgb */
GLint indexBits; /* total bits for colorindex */
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
GLint depthBits;
GLint stencilBits;
GLint numAuxBuffers;
GLint level;
GLint pixmapMode;
/* GLX */
GLint visualID;
GLint visualType; /**< One of the GLX X visual types. (i.e.,
* \c GLX_TRUE_COLOR, etc.)
*/
/* EXT_visual_rating / GLX 1.2 */
GLint visualRating;
/* EXT_visual_info / GLX 1.2 */
GLint transparentPixel;
/* colors are floats scaled to ints */
GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
GLint transparentIndex;
/* ARB_multisample / SGIS_multisample */
GLint sampleBuffers;
GLint samples;
/* SGIX_fbconfig / GLX 1.3 */
GLint drawableType;
GLint renderType;
GLint xRenderable;
GLint fbconfigID;
/* SGIX_pbuffer / GLX 1.3 */
GLint maxPbufferWidth;
GLint maxPbufferHeight;
GLint maxPbufferPixels;
GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
/* SGIX_visual_select_group */
GLint visualSelectGroup;
/* OML_swap_method */
GLint swapMethod;
GLint screen;
/* EXT_texture_from_pixmap */
GLint bindToTextureRgb;
GLint bindToTextureRgba;
GLint bindToMipmapTexture;
GLint bindToTextureTargets;
GLint yInverted;
};
GLint glxConvertToXVisualType(int visualType);
/*
** Screen dependent data. These methods are the interface between the DIX
** and DDX layers of the GLX server extension. The methods provide an
@ -67,14 +143,14 @@ struct __GLXscreen {
void (*destroy) (__GLXscreen *screen);
__GLXcontext *(*createContext) (__GLXscreen *screen,
__GLcontextModes *modes,
__GLXconfig *modes,
__GLXcontext *shareContext);
__GLXdrawable *(*createDrawable)(__GLXscreen *context,
DrawablePtr pDraw,
int type,
XID drawId,
__GLcontextModes *modes);
__GLXconfig *modes);
int (*swapInterval) (__GLXdrawable *drawable,
int interval);
@ -84,11 +160,11 @@ struct __GLXscreen {
ScreenPtr pScreen;
/* Linked list of valid fbconfigs for this screen. */
__GLcontextModes *fbconfigs;
__GLXconfig *fbconfigs;
int numFBConfigs;
/* Subset of fbconfigs that are exposed as GLX visuals. */
__GLcontextModes **visuals;
__GLXconfig **visuals;
GLint numVisuals;
char *GLextensions;

View file

@ -49,7 +49,6 @@
#include "glxutil.h"
#include "GL/internal/glcore.h"
#include "GL/glxint.h"
#include "glcontextmodes.h"
/************************************************************************/
/* Context stuff */
@ -140,13 +139,13 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
GLboolean
__glXDrawableInit(__GLXdrawable *drawable,
__GLXscreen *screen, DrawablePtr pDraw, int type,
XID drawId, __GLcontextModes *modes)
XID drawId, __GLXconfig *config)
{
drawable->pDraw = pDraw;
drawable->type = type;
drawable->drawId = drawId;
drawable->refCount = 1;
drawable->modes = modes;
drawable->config = config;
drawable->eventMask = 0;
return GL_TRUE;

View file

@ -51,7 +51,7 @@ extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
__GLXscreen *screen,
DrawablePtr pDraw, int type, XID drawID,
__GLcontextModes *modes);
__GLXconfig *config);
/* context helper routines */
extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);

View file

@ -1,9 +1,10 @@
SUBDIRS = main math swrast swrast_setup tnl shader X glapi vbo
SUBDIRS = X
SUBDIRS += main math swrast swrast_setup tnl shader glapi vbo
noinst_LTLIBRARIES = libGLcore.la
libGLcore_la_SOURCES = dummy.c
libGLcore_la_LIBADD = main/libmain.la \
MESA_LIBS = main/libmain.la \
math/libmath.la \
swrast/libswrast.la \
swrast_setup/libss.la \
@ -11,5 +12,7 @@ libGLcore_la_LIBADD = main/libmain.la \
shader/libshader.la \
shader/grammar/libgrammar.la \
shader/slang/libslang.la \
vbo/libvbo.la \
vbo/libvbo.la
libGLcore_la_LIBADD = $(MESA_LIBS) \
X/libX.la

View file

@ -1,19 +1,10 @@
noinst_LTLIBRARIES = libX.la
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I../../glx \
-I$(top_srcdir)/GL/glx \
-I$(top_srcdir)/GL/include \
-I$(top_srcdir)/hw/xfree86/os-support
-I. \
-I@MESA_SOURCE@/src/mesa/glapi \
-I@MESA_SOURCE@/src/mesa/main \
-I@MESA_SOURCE@/src/mesa
# -DXFree86Server is required because the X11 driver in Mesa thinks that
# symbol means "being built in the server"
@ -22,12 +13,15 @@ AM_CFLAGS = \
-DXFree86Server \
@GLX_DEFINES@
nodist_libX_la_SOURCES = \
xm_api.c \
xm_buffer.c \
xm_dd.c \
xm_image.c \
xm_line.c \
xm_span.c \
xm_tri.c \
drivers/common/driverfuncs.c
XM_SOURCES = \
xm_api.c \
xm_buffer.c \
xm_dd.c \
xm_image.c \
xm_line.c \
xm_span.c \
xm_tri.c
XM_SOURCES += drivers/common/driverfuncs.c
nodist_libX_la_SOURCES = $(XM_SOURCES)

View file

@ -227,8 +227,6 @@ symlink_glx() {
dst_dir glx
action indirect_size.h
action glcontextmodes.c
action glcontextmodes.h
action indirect_dispatch.c
action indirect_dispatch.h
action indirect_dispatch_swap.c

View file

@ -9,11 +9,6 @@ if XTRAP
XTRAP_DIR=XTrap
endif
if CFB
CFB_DIR=cfb
CFB32_DIR=cfb32
endif
if AFB
AFB_DIR=afb
endif
@ -39,6 +34,10 @@ XGL_DIR=xgl
GLUCOSE_DIR=glucose
endif
if RECORD
RECORD_DIR=record
endif
SUBDIRS = \
doc \
include \
@ -55,9 +54,7 @@ SUBDIRS = \
$(DBE_DIR) \
$(MFB_DIR) \
$(AFB_DIR) \
$(CFB_DIR) \
$(CFB32_DIR) \
record \
$(RECORD_DIR) \
xfixes \
damageext \
$(XTRAP_DIR) \
@ -103,8 +100,6 @@ DIST_SUBDIRS = \
dbe \
mfb \
afb \
cfb \
cfb32 \
record \
xfixes \
damageext \

View file

@ -188,12 +188,15 @@ static int
ProcDPMSEnable(client)
register ClientPtr client;
{
/* REQUEST(xDPMSEnableReq); */
Bool was_enabled = DPMSEnabled;
REQUEST_SIZE_MATCH(xDPMSEnableReq);
if (DPMSCapableFlag)
if (DPMSCapableFlag) {
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
}
return(client->noClientException);
}

View file

@ -919,7 +919,7 @@ ProcPanoramiXGetState(ClientPtr client)
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -946,7 +946,7 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -972,7 +972,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;

View file

@ -525,7 +525,7 @@ int PanoramiXGetGeometry(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixUnknownAccess);
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -1024,7 +1024,7 @@ int PanoramiXCopyArea(ClientPtr client)
FOR_NSCREENS(j) {
rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
DixUnknownAccess);
DixGetAttrAccess);
if (rc != Success)
return rc;
}
@ -1779,7 +1779,7 @@ int PanoramiXGetImage(ClientPtr client)
return (*SavedProcVector[X_GetImage])(client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
DixReadAccess);
if (rc != Success)
return rc;
@ -1817,7 +1817,7 @@ int PanoramiXGetImage(ClientPtr client)
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++) {
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
DixUnknownAccess);
DixGetAttrAccess);
if (rc != Success)
return rc;
}

View file

@ -910,7 +910,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XacePropertyAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
ATOM name = rec->pProp->propertyName;
ATOM name = (*rec->ppProp)->propertyName;
Mask requested = rec->access_mode;
Mask allowed = SecurityResourceMask | DixReadAccess;

View file

@ -655,7 +655,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return ProcShmGetImage(client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
DixReadAccess);
if (rc != Success)
return rc;
@ -692,7 +692,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++) {
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
DixUnknownAccess);
DixReadAccess);
if (rc != Success)
return rc;
}
@ -767,7 +767,7 @@ ProcPanoramiXShmCreatePixmap(
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
DixUnknownAccess);
DixGetAttrAccess);
if (rc != Success)
return rc;

View file

@ -56,16 +56,17 @@ int XaceHookDispatch(ClientPtr client, int major)
}
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
PropertyPtr pProp, Mask access_mode)
PropertyPtr *ppProp, Mask access_mode)
{
XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success };
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
return rec.status;
}
int XaceHookSelectionAccess(ClientPtr client, Atom name, Mask access_mode)
int XaceHookSelectionAccess(ClientPtr client,
Selection **ppSel, Mask access_mode)
{
XaceSelectionAccessRec rec = { client, name, access_mode, Success };
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
return rec.status;
}

View file

@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "region.h"
#include "window.h"
#include "property.h"
#include "selection.h"
/* Default window background */
#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
@ -68,9 +69,9 @@ extern int XaceHook(
*/
extern int XaceHookDispatch(ClientPtr ptr, int major);
extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
PropertyPtr pProp, Mask access_mode);
extern int XaceHookSelectionAccess(ClientPtr ptr, Atom name,
Mask access_mode);
PropertyPtr *ppProp, Mask access_mode);
extern int XaceHookSelectionAccess(ClientPtr ptr,
Selection **ppSel, Mask access_mode);
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
/* Register a callback for a given hook.

View file

@ -59,7 +59,7 @@ typedef struct {
typedef struct {
ClientPtr client;
WindowPtr pWin;
PropertyPtr pProp;
PropertyPtr *ppProp;
Mask access_mode;
int status;
} XacePropertyAccessRec;
@ -110,7 +110,7 @@ typedef struct {
/* XACE_SELECTION_ACCESS */
typedef struct {
ClientPtr client;
Atom name;
Selection **ppSel;
Mask access_mode;
int status;
} XaceSelectionAccessRec;

View file

@ -63,11 +63,13 @@ extern Bool noXkbExtension;
#endif
extern int xeviegrabState;
static int ProcDispatch (register ClientPtr client), SProcDispatch (register ClientPtr client);
static void ResetProc (ExtensionEntry *extEntry);
static DISPATCH_PROC(ProcXevieDispatch);
static DISPATCH_PROC(SProcXevieDispatch);
static unsigned char ReqCode = 0;
static int ErrorBase;
static void XevieResetProc (ExtensionEntry *extEntry);
static unsigned char XevieReqCode = 0;
static int XevieErrorBase;
int xevieFlag = 0;
int xevieClientIndex = 0;
@ -77,7 +79,7 @@ Mask xevieMask = 0;
int xevieEventSent = 0;
int xevieKBEventSent = 0;
static DevPrivateKey xevieDevicePrivateKey = &xevieDevicePrivateKey;
static Bool xevieModifiersOn = FALSE;
static Bool xevieModifiersOn = FALSE;
#define XEVIEINFO(dev) ((xevieDeviceInfoPtr) \
dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey))
@ -108,11 +110,6 @@ typedef struct {
static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}};
static int keycqHead = 0, keycqTail = 0;
static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr);
static void ResetProc (ExtensionEntry*);
static int ErrorBase;
static Bool XevieStart(void);
static void XevieEnd(int clientIndex);
static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
@ -140,25 +137,23 @@ XevieExtensionInit (void)
if ((extEntry = AddExtension (XEVIENAME,
0,
XevieNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
ProcXevieDispatch,
SProcXevieDispatch,
XevieResetProc,
StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
XevieReqCode = (unsigned char)extEntry->base;
XevieErrorBase = extEntry->errorBase;
}
/* PC servers initialize the desktop colors (citems) here! */
}
/*ARGSUSED*/
static
void ResetProc (ExtensionEntry *extEntry)
void XevieResetProc (ExtensionEntry *extEntry)
{
}
static
int ProcQueryVersion (register ClientPtr client)
int ProcXevieQueryVersion (register ClientPtr client)
{
xXevieQueryVersionReply rep;
@ -173,7 +168,7 @@ int ProcQueryVersion (register ClientPtr client)
}
static
int ProcStart (register ClientPtr client)
int ProcXevieStart (register ClientPtr client)
{
xXevieStartReply rep;
@ -214,10 +209,12 @@ int ProcStart (register ClientPtr client)
}
static
int ProcEnd (register ClientPtr client)
int ProcXevieEnd (register ClientPtr client)
{
xXevieEndReply rep;
REQUEST_SIZE_MATCH (xXevieEndReq);
if (xevieFlag) {
if (client->index != xevieClientIndex)
return BadAccess;
@ -233,13 +230,15 @@ int ProcEnd (register ClientPtr client)
}
static
int ProcSend (register ClientPtr client)
int ProcXevieSend (register ClientPtr client)
{
REQUEST (xXevieSendReq);
xXevieSendReply rep;
xEvent *xE;
static unsigned char lastDetail = 0, lastType = 0;
REQUEST_SIZE_MATCH (xXevieSendReq);
if (client->index != xevieClientIndex)
return BadAccess;
@ -279,15 +278,17 @@ int ProcSend (register ClientPtr client)
}
static
int ProcSelectInput (register ClientPtr client)
int ProcXevieSelectInput (register ClientPtr client)
{
REQUEST (xXevieSelectInputReq);
xXevieSelectInputReply rep;
REQUEST_SIZE_MATCH (xXevieSelectInputReq);
if (client->index != xevieClientIndex)
return BadAccess;
xevieMask = (long)stuff->event_mask;
xevieMask = stuff->event_mask;
rep.type = X_Reply;
rep.sequence_number = client->sequence;
WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
@ -295,101 +296,114 @@ int ProcSelectInput (register ClientPtr client)
}
static
int ProcDispatch (register ClientPtr client)
int ProcXevieDispatch (register ClientPtr client)
{
REQUEST (xReq);
switch (stuff->data)
{
case X_XevieQueryVersion:
return ProcQueryVersion (client);
return ProcXevieQueryVersion (client);
case X_XevieStart:
return ProcStart (client);
return ProcXevieStart (client);
case X_XevieEnd:
return ProcEnd (client);
return ProcXevieEnd (client);
case X_XevieSend:
return ProcSend (client);
return ProcXevieSend (client);
case X_XevieSelectInput:
return ProcSelectInput(client);
return ProcXevieSelectInput(client);
default:
return BadRequest;
}
}
static
int SProcQueryVersion (register ClientPtr client)
int SProcXevieQueryVersion (register ClientPtr client)
{
register int n;
REQUEST(xXevieQueryVersionReq);
swaps(&stuff->length, n);
return ProcQueryVersion(client);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
swaps (&stuff->client_major_version, n);
swaps (&stuff->client_minor_version, n);
return ProcXevieQueryVersion(client);
}
static
int SProcStart (ClientPtr client)
int SProcXevieStart (ClientPtr client)
{
register int n;
REQUEST (xXevieStartReq);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH (xXevieStartReq);
swapl (&stuff->screen, n);
REQUEST_AT_LEAST_SIZE (xXevieStartReq);
return ProcStart (client);
return ProcXevieStart (client);
}
static
int SProcEnd (ClientPtr client)
int SProcXevieEnd (ClientPtr client)
{
register int n;
REQUEST (xXevieEndReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieEndReq);
swapl(&stuff->cmap, n);
return ProcEnd (client);
REQUEST_SIZE_MATCH (xXevieEndReq);
swapl (&stuff->cmap, n);
return ProcXevieEnd (client);
}
static
int SProcSend (ClientPtr client)
int SProcXevieSend (ClientPtr client)
{
register int n;
xEvent eventT;
EventSwapPtr proc;
REQUEST (xXevieSendReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieSendReq);
swapl(&stuff->event, n);
return ProcSend (client);
REQUEST_SIZE_MATCH (xXevieSendReq);
swapl (&stuff->dataType, n);
/* Swap event */
proc = EventSwapVector[stuff->event.u.u.type & 0177];
if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
return (BadValue);
(*proc)(&stuff->event, &eventT);
stuff->event = eventT;
return ProcXevieSend (client);
}
static
int SProcSelectInput (ClientPtr client)
int SProcXevieSelectInput (ClientPtr client)
{
register int n;
REQUEST (xXevieSelectInputReq);
swaps (&stuff->length, n);
REQUEST_AT_LEAST_SIZE (xXevieSelectInputReq);
swapl(&stuff->event_mask, n);
return ProcSelectInput (client);
REQUEST_SIZE_MATCH (xXevieSelectInputReq);
swapl (&stuff->event_mask, n);
return ProcXevieSelectInput (client);
}
static
int SProcDispatch (register ClientPtr client)
int SProcXevieDispatch (register ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case X_XevieQueryVersion:
return SProcQueryVersion (client);
return SProcXevieQueryVersion (client);
case X_XevieStart:
return SProcStart (client);
return SProcXevieStart (client);
case X_XevieEnd:
return SProcEnd (client);
return SProcXevieEnd (client);
case X_XevieSend:
return SProcSend (client);
return SProcXevieSend (client);
case X_XevieSelectInput:
return SProcSelectInput(client);
return SProcXevieSelectInput(client);
default:
return BadRequest;
}

View file

@ -1800,7 +1800,7 @@ ProcXpPutDocumentData(ClientPtr client)
if (pContext->state & DOC_RAW_STARTED)
return BadDrawable;
result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
DixWriteAccess);
if (result != Success)
return result;
if (pDraw->pScreen->myNum != pContext->screenNum)

View file

@ -64,7 +64,7 @@ ProcXResQueryClients (ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = xalloc((currentMaxClients - 1) * sizeof(int));
current_clients = xalloc(currentMaxClients * sizeof(int));
num_clients = 0;
for(i = 0; i < currentMaxClients; i++) {

File diff suppressed because it is too large Load diff

View file

@ -31,21 +31,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Extension protocol */
#define X_SELinuxQueryVersion 0
#define X_SELinuxSetSecurityManager 1
#define X_SELinuxGetSecurityManager 2
#define X_SELinuxSetDeviceCreateContext 3
#define X_SELinuxGetDeviceCreateContext 4
#define X_SELinuxSetDeviceContext 5
#define X_SELinuxGetDeviceContext 6
#define X_SELinuxSetPropertyCreateContext 7
#define X_SELinuxGetPropertyCreateContext 8
#define X_SELinuxGetPropertyContext 9
#define X_SELinuxSetWindowCreateContext 10
#define X_SELinuxGetWindowCreateContext 11
#define X_SELinuxGetWindowContext 12
#define X_SELinuxSetSelectionCreateContext 13
#define X_SELinuxGetSelectionCreateContext 14
#define X_SELinuxGetSelectionContext 15
#define X_SELinuxSetDeviceCreateContext 1
#define X_SELinuxGetDeviceCreateContext 2
#define X_SELinuxSetDeviceContext 3
#define X_SELinuxGetDeviceContext 4
#define X_SELinuxSetWindowCreateContext 5
#define X_SELinuxGetWindowCreateContext 6
#define X_SELinuxGetWindowContext 7
#define X_SELinuxSetPropertyCreateContext 8
#define X_SELinuxGetPropertyCreateContext 9
#define X_SELinuxSetPropertyUseContext 10
#define X_SELinuxGetPropertyUseContext 11
#define X_SELinuxGetPropertyContext 12
#define X_SELinuxGetPropertyDataContext 13
#define X_SELinuxListProperties 14
#define X_SELinuxSetSelectionCreateContext 15
#define X_SELinuxGetSelectionCreateContext 16
#define X_SELinuxSetSelectionUseContext 17
#define X_SELinuxGetSelectionUseContext 18
#define X_SELinuxGetSelectionContext 19
#define X_SELinuxGetSelectionDataContext 20
#define X_SELinuxListSelections 21
#define X_SELinuxGetClientContext 22
typedef struct {
CARD8 reqType;
@ -53,7 +60,6 @@ typedef struct {
CARD16 length;
CARD8 client_major;
CARD8 client_minor;
CARD16 unused;
} SELinuxQueryVersionReq;
typedef struct {
@ -74,35 +80,7 @@ typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 window;
} SELinuxSetSecurityManagerReq;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
} SELinuxGetSecurityManagerReq;
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 window;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxGetSecurityManagerReply;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD8 permanent;
CARD8 unused;
CARD16 context_len;
CARD32 context_len;
} SELinuxSetCreateContextReq;
typedef struct {
@ -111,27 +89,12 @@ typedef struct {
CARD16 length;
} SELinuxGetCreateContextReq;
typedef struct {
CARD8 type;
CARD8 permanent;
CARD16 sequenceNumber;
CARD32 length;
CARD16 context_len;
CARD16 pad1;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxGetCreateContextReply;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 id;
CARD16 unused;
CARD16 context_len;
CARD32 context_len;
} SELinuxSetContextReq;
typedef struct {
@ -154,15 +117,27 @@ typedef struct {
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 context_len;
CARD16 pad2;
CARD32 context_len;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} SELinuxGetContextReply;
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 count;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxListItemsReply;
/* Private Flask definitions */
#define SECCLASS_X_DRAWABLE 1

View file

@ -77,11 +77,46 @@ int
SProcXChangeDeviceControl(ClientPtr client)
{
char n;
xDeviceCtl *ctl;
xDeviceAbsCalibCtl *calib;
xDeviceAbsAreaCtl *area;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
swaps(&stuff->control, n);
ctl = (xDeviceCtl*)&stuff[1];
swaps(&ctl->control, n);
swaps(&ctl->length, n);
switch(stuff->control) {
case DEVICE_ABS_CALIB:
calib = (xDeviceAbsCalibCtl*)ctl;
swaps(&calib->length, n);
swapl(&calib->min_x, n);
swapl(&calib->max_x, n);
swapl(&calib->min_y, n);
swapl(&calib->max_y, n);
swapl(&calib->flip_x, n);
swapl(&calib->flip_y, n);
swapl(&calib->rotation, n);
swapl(&calib->button_threshold, n);
break;
case DEVICE_ABS_AREA:
area = (xDeviceAbsAreaCtl*)ctl;
swapl(&area->offset_x, n);
swapl(&area->offset_y, n);
swapl(&area->width, n);
swapl(&area->height, n);
swapl(&area->screen, n);
swapl(&area->following, n);
break;
case DEVICE_CORE:
case DEVICE_ENABLE:
case DEVICE_RESOLUTION:
/* hmm. beer. *drool* */
break;
}
return (ProcXChangeDeviceControl(client));
}

View file

@ -833,7 +833,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
} else
effectiveFocus = pWin = inputFocus;
} else
dixLookupWindow(&pWin, dest, client, DixUnknownAccess);
dixLookupWindow(&pWin, dest, client, DixSendAccess);
if (!pWin)
return BadWindow;
if ((propagate != xFalse) && (propagate != xTrue)) {

View file

@ -1,3 +1,145 @@
dnl dolt, a replacement for libtool
dnl Copyright © 2007-2008 Josh Triplett <josh@freedesktop.org>
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright
dnl notice and this notice are preserved.
dnl
dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
dnl installed when running autoconf on your project.
dnl
dnl git snapshot: 198a3026b347b9220a2f2e2ae23a3049c35af262
AC_DEFUN([DOLT], [
AC_REQUIRE([AC_CANONICAL_HOST])
# dolt, a replacement for libtool
# Josh Triplett <josh@freedesktop.org>
AC_PATH_PROG(DOLT_BASH, bash)
AC_MSG_CHECKING([if libtool sucks])
AC_MSG_RESULT([yup, it does])
AC_MSG_CHECKING([if dolt supports this host])
dolt_supported=yes
if test x$DOLT_BASH = x; then
dolt_supported=no
fi
if test x$GCC != xyes; then
dolt_supported=no
fi
case $host in
i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*) ;;
amd64-*-freebsd*|i386-*-freebsd*|ia64-*-freebsd*) ;;
*) dolt_supported=no ;;
esac
if test x$dolt_supported = xno ; then
AC_MSG_RESULT([no, falling back to libtool])
else
AC_MSG_RESULT([yes, replacing libtool])
dnl Start writing out doltcompile.
cat <<__DOLTCOMPILE__EOF__ >doltcompile
#!$DOLT_BASH
__DOLTCOMPILE__EOF__
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
args=("$[]@")
for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
if test x"${args@<:@$arg@:>@}" = x-o ; then
objarg=$((arg+1))
break
fi
done
if test x$objarg = x ; then
echo 'Error: no -o on compiler command line' 1>&2
exit 1
fi
lo="${args@<:@$objarg@:>@}"
obj="${lo%.lo}"
if test x"$lo" = x"$obj" ; then
echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
exit 1
fi
objbase="${obj##*/}"
__DOLTCOMPILE__EOF__
dnl Write out shared compilation code.
if test x$enable_shared = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
libobjdir="${obj%$objbase}.libs"
if test ! -d "$libobjdir" ; then
mkdir -p "$libobjdir"
mkdir_ret=$?
if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
exit $mkdir_ret
fi
fi
pic_object="$libobjdir/$objbase.o"
args@<:@$objarg@:>@="$pic_object"
"${args@<:@@@:>@}" -fPIC -DPIC || exit $?
__DOLTCOMPILE__EOF__
fi
dnl Write out static compilation code.
dnl Avoid duplicate compiler output if also building shared objects.
if test x$enable_static = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
non_pic_object="$obj.o"
args@<:@$objarg@:>@="$non_pic_object"
__DOLTCOMPILE__EOF__
if test x$enable_shared = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
__DOLTCOMPILE__EOF__
else
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
"${args@<:@@@:>@}" || exit $?
__DOLTCOMPILE__EOF__
fi
fi
dnl Write out the code to write the .lo file.
dnl The second line of the .lo file must match "^# Generated by .*libtool"
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
{
echo "# $lo - a libtool object file"
echo "# Generated by doltcompile, not libtool"
__DOLTCOMPILE__EOF__
if test x$enable_shared = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo "pic_object='$pic_object'"
__DOLTCOMPILE__EOF__
else
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo pic_object=none
__DOLTCOMPILE__EOF__
fi
if test x$enable_static = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo "non_pic_object='$non_pic_object'"
__DOLTCOMPILE__EOF__
else
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo non_pic_object=none
__DOLTCOMPILE__EOF__
fi
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
} > "$lo"
__DOLTCOMPILE__EOF__
dnl Done writing out doltcompile; substitute it for libtool compilation.
chmod +x doltcompile
LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
AC_SUBST(LTCOMPILE)
LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
AC_SUBST(LTCXXCOMPILE)
fi
# end dolt
])
##### http://autoconf-archive.cryp.to/ac_define_dir.html
#
# SYNOPSIS

View file

@ -1,21 +0,0 @@
noinst_LTLIBRARIES = libcfb.la
include Makefile.am.inc
DISTCLEANFILES += cfbglrop8.c
libcfb_la_SOURCES = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c \
$(libcfb_gen_sources) $(libcfb_common_sources)
libcfb_la_LIBADD = ../mfb/libmfb.la
AM_CFLAGS = -DPSZ=8 $(DIX_CFLAGS) $(PLATFORMDEFS)
INCLUDES = $(CFB_INCLUDES) -I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/common
EXTRA_DIST = cfbline.c cfbfillarc.c cfbzerarc.c cfbblt.c cfbsolid.c \
cfbtileodd.c cfbtile32.c cfb8line.c cfbply1rct.c cfbglblt8.c \
cfb16.h cfb24.h cfb32.h cfb8bit.h cfbrrop.h \
stip68kgnu.h stipmips.s stipsparc.s stipsprc32.s
sdk_HEADERS = cfb.h cfb32.h cfb16.h cfbmap.h cfbunmap.h cfbmskbits.h

View file

@ -1,153 +0,0 @@
libcfb_gen_sources = cfbseg.c cfbfillarcC.c cfbfillarcG.c cfbzerarcC.c cfbzerarcX.c cfbzerarcG.c \
cfbbltC.c cfbbltX.c cfbbltO.c cfbbltG.c cfbsolidC.c cfbsolidX.c cfbsolidG.c cfbtileoddC.c \
cfbtileoddG.c cfbtile32C.c cfbtile32G.c cfb8lineCO.c cfb8lineCP.c cfb8lineX.c cfb8lineG.c \
cfb8segCS.c cfb8segC.c cfb8segX.c cfb8setG.c cfbply1rctC.c cfbply1rctG.c
DISTCLEANFILES = $(libcfb_gen_sources)
CFB_INCLUDES = -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
libcfb_common_sources = $(top_srcdir)/cfb/cfbgc.c $(top_srcdir)/cfb/cfbrrop.c \
$(top_srcdir)/cfb/cfbwindow.c \
$(top_srcdir)/cfb/cfbmskbits.c $(top_srcdir)/cfb/cfbpixmap.c \
$(top_srcdir)/cfb/cfbbitblt.c $(top_srcdir)/cfb/cfbfillsp.c \
$(top_srcdir)/cfb/cfbsetsp.c $(top_srcdir)/cfb/cfbscrinit.c \
$(top_srcdir)/cfb/cfballpriv.c $(top_srcdir)/cfb/cfbgetsp.c \
$(top_srcdir)/cfb/cfbfillrct.c $(top_srcdir)/cfb/cfbigblt8.c \
$(top_srcdir)/cfb/cfbglblt8.c $(top_srcdir)/cfb/cfbtegblt.c \
$(top_srcdir)/cfb/cfbpolypnt.c \
$(top_srcdir)/cfb/cfbbres.c $(top_srcdir)/cfb/cfbline.c \
$(top_srcdir)/cfb/cfbhrzvert.c $(top_srcdir)/cfb/cfbbresd.c \
$(top_srcdir)/cfb/cfbimage.c $(top_srcdir)/cfb/cfbcppl.c \
$(top_srcdir)/cfb/cfbcmap.c
cfbseg.c:
echo "#define POLYSEGMENT" > $@
echo "#include \"$(top_srcdir)/cfb/cfbline.c\"" >> $@
cfbfillarcC.c:
echo "#define RROP GXcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbfillarc.c\"" >> $@
cfbfillarcG.c:
echo "#define RROP GXset" > $@
echo "#include \"$(top_srcdir)/cfb/cfbfillarc.c\"" >> $@
cfbzerarcC.c:
echo "#define RROP GXcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@
cfbzerarcX.c:
echo "#define RROP GXxor" > $@
echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@
cfbzerarcG.c:
echo "#define RROP GXset" > $@
echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@
cfbbltC.c:
echo "#define MROP Mcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
cfbbltX.c:
echo "#define MROP Mxor" > $@
echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
cfbbltO.c:
echo "#define MROP Mor" > $@
echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
cfbbltG.c:
echo "#define MROP 0" > $@
echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
cfbsolidC.c:
echo "#define RROP GXcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@
cfbsolidX.c:
echo "#define RROP GXxor" > $@
echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@
cfbsolidG.c:
echo "#define RROP GXset" > $@
echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@
cfbtileoddC.c:
echo "#define MROP Mcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbtileodd.c\"" >> $@
cfbtileoddG.c:
echo "#define MROP 0" > $@
echo "#include \"$(top_srcdir)/cfb/cfbtileodd.c\"" >> $@
cfbtile32C.c:
echo "#define MROP Mcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbtile32.c\"" >> $@
cfbtile32G.c:
echo "#define MROP 0" > $@
echo "#include \"$(top_srcdir)/cfb/cfbtile32.c\"" >> $@
cfb8lineCO.c:
echo "#define RROP GXcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8lineCP.c:
echo "#define RROP GXcopy" > $@
echo "#define PREVIOUS" >> $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8lineX.c:
echo "#define RROP GXxor" > $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8lineG.c:
echo "#define RROP GXset" > $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8segCS.c:
echo "#define RROP GXcopy" > $@
echo "#define POLYSEGMENT" >> $@
echo "#define WIDTH_SHIFT" >> $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8segC.c:
echo "#define RROP GXcopy" > $@
echo "#define POLYSEGMENT" >> $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8segX.c:
echo "#define RROP GXxor" > $@
echo "#define POLYSEGMENT" >> $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfb8setG.c:
echo "#define RROP GXset" > $@
echo "#define POLYSEGMENT" >> $@
echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
cfbply1rctC.c:
echo "#define RROP GXcopy" > $@
echo "#include \"$(top_srcdir)/cfb/cfbply1rct.c\"" >> $@
cfbply1rctG.c:
echo "#define RROP GXset" > $@
echo "#include \"$(top_srcdir)/cfb/cfbply1rct.c\"" >> $@
cfbglrop8.c:
echo "#define GLYPHROP" > $@
echo "#include \"$(top_srcdir)/cfb/cfbglblt8.c\"" >> $@
if XPRINT
PLATFORMDEFS = -DXFREE86
cfb8bit.o: compiler.h
compiler.h:
echo "#include \"$(top_srcdir)/hw/xfree86/common/compiler.h\"" >> $@
endif

1268
cfb/cfb.h

File diff suppressed because it is too large Load diff

View file

@ -1,93 +0,0 @@
/*
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
*
* 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, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 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
* XFREE86 PROJECT 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 XFree86 Project 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
* XFree86 Project.
*/
#ifndef _CFB16_H_
#define _CFB16_H_
/*
* C's preprocessing language substitutes >text<, not values...
*/
#ifdef OLDPSZ
# undef OLDPSZ
#endif
#ifdef PSZ
# if (PSZ == 8)
# define OLDPSZ 8
# endif
# if (PSZ == 16)
# define OLDPSZ 16
# endif
# if (PSZ == 24)
# define OLDPSZ 24
# endif
# if (PSZ == 32)
# define OLDPSZ 32
# endif
# ifndef OLDPSZ
/* Maybe an #error here ? */
# endif
# undef PSZ
#endif
#define PSZ 16
#define CFB_PROTOTYPES_ONLY
#include "cfb.h"
#undef CFB_PROTOTYPES_ONLY
#include "cfbunmap.h"
#undef PSZ
#ifdef OLDPSZ
# if (OLDPSZ == 8)
# define PSZ 8
# endif
# if (OLDPSZ == 16)
# define PSZ 16
# endif
# if (OLDPSZ == 24)
# define PSZ 24
# endif
# if (OLDPSZ == 32)
# define PSZ 32
# endif
# undef OLDPSZ
#endif
#endif /* _CFB16_H_ */

View file

@ -1,97 +0,0 @@
/*
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
*
* 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, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 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
* XFREE86 PROJECT 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 XFree86 Project 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
* XFree86 Project.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _CFB24_H_
#define _CFB24_H_
/*
* C's preprocessing language substitutes >text<, not values...
*/
#ifdef OLDPSZ
# undef OLDPSZ
#endif
#ifdef PSZ
# if (PSZ == 8)
# define OLDPSZ 8
# endif
# if (PSZ == 16)
# define OLDPSZ 16
# endif
# if (PSZ == 24)
# define OLDPSZ 24
# endif
# if (PSZ == 32)
# define OLDPSZ 32
# endif
# ifndef OLDPSZ
/* Maybe an #error here ? */
# endif
# undef PSZ
#endif
#define PSZ 24
#define CFB_PROTOTYPES_ONLY
#include "cfb.h"
#undef CFB_PROTOTYPES_ONLY
#include "cfbunmap.h"
#undef PSZ
#ifdef OLDPSZ
# if (OLDPSZ == 8)
# define PSZ 8
# endif
# if (OLDPSZ == 16)
# define PSZ 16
# endif
# if (OLDPSZ == 24)
# define PSZ 24
# endif
# if (OLDPSZ == 32)
# define PSZ 32
# endif
# undef OLDPSZ
#endif
#endif /* _CFB24_H_ */

View file

@ -1,93 +0,0 @@
/*
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
*
* 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, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 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
* XFREE86 PROJECT 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 XFree86 Project 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
* XFree86 Project.
*/
#ifndef _CFB32_H_
#define _CFB32_H_
/*
* C's preprocessing language substitutes >text<, not values...
*/
#ifdef OLDPSZ
# undef OLDPSZ
#endif
#ifdef PSZ
# if (PSZ == 8)
# define OLDPSZ 8
# endif
# if (PSZ == 16)
# define OLDPSZ 16
# endif
# if (PSZ == 24)
# define OLDPSZ 24
# endif
# if (PSZ == 32)
# define OLDPSZ 32
# endif
# ifndef OLDPSZ
/* Maybe an #error here ? */
# endif
# undef PSZ
#endif
#define PSZ 32
#define CFB_PROTOTYPES_ONLY
#include "cfb.h"
#undef CFB_PROTOTYPES_ONLY
#include "cfbunmap.h"
#undef PSZ
#ifdef OLDPSZ
# if (OLDPSZ == 8)
# define PSZ 8
# endif
# if (OLDPSZ == 16)
# define PSZ 16
# endif
# if (OLDPSZ == 24)
# define PSZ 24
# endif
# if (OLDPSZ == 32)
# define PSZ 32
# endif
# undef OLDPSZ
#endif
#endif /* _CFB32_H_ */

View file

@ -1,469 +0,0 @@
/*
Copyright 1989, 1994, 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.
*/
/*
* cfb8bit.c
*
* 8 bit color frame buffer utility routines
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#if PSZ == 8
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
PixelGroup cfb8StippleMasks[NUM_MASKS] = {
#if NUM_MASKS == 16
0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff
#else /* NUM_MASKS == 256 */
0x0000000000000000, 0x00000000000000ff,
0x000000000000ff00, 0x000000000000ffff,
0x0000000000ff0000, 0x0000000000ff00ff,
0x0000000000ffff00, 0x0000000000ffffff,
0x00000000ff000000, 0x00000000ff0000ff,
0x00000000ff00ff00, 0x00000000ff00ffff,
0x00000000ffff0000, 0x00000000ffff00ff,
0x00000000ffffff00, 0x00000000ffffffff,
0x000000ff00000000, 0x000000ff000000ff,
0x000000ff0000ff00, 0x000000ff0000ffff,
0x000000ff00ff0000, 0x000000ff00ff00ff,
0x000000ff00ffff00, 0x000000ff00ffffff,
0x000000ffff000000, 0x000000ffff0000ff,
0x000000ffff00ff00, 0x000000ffff00ffff,
0x000000ffffff0000, 0x000000ffffff00ff,
0x000000ffffffff00, 0x000000ffffffffff,
0x0000ff0000000000, 0x0000ff00000000ff,
0x0000ff000000ff00, 0x0000ff000000ffff,
0x0000ff0000ff0000, 0x0000ff0000ff00ff,
0x0000ff0000ffff00, 0x0000ff0000ffffff,
0x0000ff00ff000000, 0x0000ff00ff0000ff,
0x0000ff00ff00ff00, 0x0000ff00ff00ffff,
0x0000ff00ffff0000, 0x0000ff00ffff00ff,
0x0000ff00ffffff00, 0x0000ff00ffffffff,
0x0000ffff00000000, 0x0000ffff000000ff,
0x0000ffff0000ff00, 0x0000ffff0000ffff,
0x0000ffff00ff0000, 0x0000ffff00ff00ff,
0x0000ffff00ffff00, 0x0000ffff00ffffff,
0x0000ffffff000000, 0x0000ffffff0000ff,
0x0000ffffff00ff00, 0x0000ffffff00ffff,
0x0000ffffffff0000, 0x0000ffffffff00ff,
0x0000ffffffffff00, 0x0000ffffffffffff,
0x00ff000000000000, 0x00ff0000000000ff,
0x00ff00000000ff00, 0x00ff00000000ffff,
0x00ff000000ff0000, 0x00ff000000ff00ff,
0x00ff000000ffff00, 0x00ff000000ffffff,
0x00ff0000ff000000, 0x00ff0000ff0000ff,
0x00ff0000ff00ff00, 0x00ff0000ff00ffff,
0x00ff0000ffff0000, 0x00ff0000ffff00ff,
0x00ff0000ffffff00, 0x00ff0000ffffffff,
0x00ff00ff00000000, 0x00ff00ff000000ff,
0x00ff00ff0000ff00, 0x00ff00ff0000ffff,
0x00ff00ff00ff0000, 0x00ff00ff00ff00ff,
0x00ff00ff00ffff00, 0x00ff00ff00ffffff,
0x00ff00ffff000000, 0x00ff00ffff0000ff,
0x00ff00ffff00ff00, 0x00ff00ffff00ffff,
0x00ff00ffffff0000, 0x00ff00ffffff00ff,
0x00ff00ffffffff00, 0x00ff00ffffffffff,
0x00ffff0000000000, 0x00ffff00000000ff,
0x00ffff000000ff00, 0x00ffff000000ffff,
0x00ffff0000ff0000, 0x00ffff0000ff00ff,
0x00ffff0000ffff00, 0x00ffff0000ffffff,
0x00ffff00ff000000, 0x00ffff00ff0000ff,
0x00ffff00ff00ff00, 0x00ffff00ff00ffff,
0x00ffff00ffff0000, 0x00ffff00ffff00ff,
0x00ffff00ffffff00, 0x00ffff00ffffffff,
0x00ffffff00000000, 0x00ffffff000000ff,
0x00ffffff0000ff00, 0x00ffffff0000ffff,
0x00ffffff00ff0000, 0x00ffffff00ff00ff,
0x00ffffff00ffff00, 0x00ffffff00ffffff,
0x00ffffffff000000, 0x00ffffffff0000ff,
0x00ffffffff00ff00, 0x00ffffffff00ffff,
0x00ffffffffff0000, 0x00ffffffffff00ff,
0x00ffffffffffff00, 0x00ffffffffffffff,
0xff00000000000000, 0xff000000000000ff,
0xff0000000000ff00, 0xff0000000000ffff,
0xff00000000ff0000, 0xff00000000ff00ff,
0xff00000000ffff00, 0xff00000000ffffff,
0xff000000ff000000, 0xff000000ff0000ff,
0xff000000ff00ff00, 0xff000000ff00ffff,
0xff000000ffff0000, 0xff000000ffff00ff,
0xff000000ffffff00, 0xff000000ffffffff,
0xff0000ff00000000, 0xff0000ff000000ff,
0xff0000ff0000ff00, 0xff0000ff0000ffff,
0xff0000ff00ff0000, 0xff0000ff00ff00ff,
0xff0000ff00ffff00, 0xff0000ff00ffffff,
0xff0000ffff000000, 0xff0000ffff0000ff,
0xff0000ffff00ff00, 0xff0000ffff00ffff,
0xff0000ffffff0000, 0xff0000ffffff00ff,
0xff0000ffffffff00, 0xff0000ffffffffff,
0xff00ff0000000000, 0xff00ff00000000ff,
0xff00ff000000ff00, 0xff00ff000000ffff,
0xff00ff0000ff0000, 0xff00ff0000ff00ff,
0xff00ff0000ffff00, 0xff00ff0000ffffff,
0xff00ff00ff000000, 0xff00ff00ff0000ff,
0xff00ff00ff00ff00, 0xff00ff00ff00ffff,
0xff00ff00ffff0000, 0xff00ff00ffff00ff,
0xff00ff00ffffff00, 0xff00ff00ffffffff,
0xff00ffff00000000, 0xff00ffff000000ff,
0xff00ffff0000ff00, 0xff00ffff0000ffff,
0xff00ffff00ff0000, 0xff00ffff00ff00ff,
0xff00ffff00ffff00, 0xff00ffff00ffffff,
0xff00ffffff000000, 0xff00ffffff0000ff,
0xff00ffffff00ff00, 0xff00ffffff00ffff,
0xff00ffffffff0000, 0xff00ffffffff00ff,
0xff00ffffffffff00, 0xff00ffffffffffff,
0xffff000000000000, 0xffff0000000000ff,
0xffff00000000ff00, 0xffff00000000ffff,
0xffff000000ff0000, 0xffff000000ff00ff,
0xffff000000ffff00, 0xffff000000ffffff,
0xffff0000ff000000, 0xffff0000ff0000ff,
0xffff0000ff00ff00, 0xffff0000ff00ffff,
0xffff0000ffff0000, 0xffff0000ffff00ff,
0xffff0000ffffff00, 0xffff0000ffffffff,
0xffff00ff00000000, 0xffff00ff000000ff,
0xffff00ff0000ff00, 0xffff00ff0000ffff,
0xffff00ff00ff0000, 0xffff00ff00ff00ff,
0xffff00ff00ffff00, 0xffff00ff00ffffff,
0xffff00ffff000000, 0xffff00ffff0000ff,
0xffff00ffff00ff00, 0xffff00ffff00ffff,
0xffff00ffffff0000, 0xffff00ffffff00ff,
0xffff00ffffffff00, 0xffff00ffffffffff,
0xffffff0000000000, 0xffffff00000000ff,
0xffffff000000ff00, 0xffffff000000ffff,
0xffffff0000ff0000, 0xffffff0000ff00ff,
0xffffff0000ffff00, 0xffffff0000ffffff,
0xffffff00ff000000, 0xffffff00ff0000ff,
0xffffff00ff00ff00, 0xffffff00ff00ffff,
0xffffff00ffff0000, 0xffffff00ffff00ff,
0xffffff00ffffff00, 0xffffff00ffffffff,
0xffffffff00000000, 0xffffffff000000ff,
0xffffffff0000ff00, 0xffffffff0000ffff,
0xffffffff00ff0000, 0xffffffff00ff00ff,
0xffffffff00ffff00, 0xffffffff00ffffff,
0xffffffffff000000, 0xffffffffff0000ff,
0xffffffffff00ff00, 0xffffffffff00ffff,
0xffffffffffff0000, 0xffffffffffff00ff,
0xffffffffffffff00, 0xffffffffffffffff
#endif
};
int cfb8StippleMode, cfb8StippleAlu, cfb8StippleRRop;
PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm;
PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
int
cfb8SetStipple (alu, fg, planemask)
int alu;
CfbBits fg, planemask;
{
CfbBits and, xor, rrop;
int s;
CfbBits c;
cfb8StippleMode = FillStippled;
cfb8StippleAlu = alu;
cfb8StippleFg = fg & PMSK;
cfb8StipplePm = planemask & PMSK;
rrop = cfbReduceRasterOp (alu, fg, planemask, &and, &xor);
cfb8StippleRRop = rrop;
/*
* create the appropriate pixel-fill bits for current
* foreground
*/
for (s = 0; s < NUM_MASKS; s++)
{
c = cfb8StippleMasks[s];
cfb8StippleAnd[s] = and | ~c;
cfb8StippleXor[s] = xor & c;
}
return TRUE;
}
int
cfb8SetOpaqueStipple (alu, fg, bg, planemask)
int alu;
CfbBits fg, bg, planemask;
{
CfbBits andfg, xorfg, andbg, xorbg, rropfg, rropbg;
int s;
CfbBits c;
cfb8StippleMode = FillOpaqueStippled;
cfb8StippleAlu = alu;
cfb8StippleFg = fg & PMSK;
cfb8StippleBg = bg & PMSK;
cfb8StipplePm = planemask & PMSK;
rropfg = cfbReduceRasterOp (alu, cfb8StippleFg, cfb8StipplePm, &andfg, &xorfg);
rropbg = cfbReduceRasterOp (alu, cfb8StippleBg, cfb8StipplePm, &andbg, &xorbg);
if (rropfg == rropbg)
cfb8StippleRRop = rropfg;
else
cfb8StippleRRop = GXset;
/*
* create the appropriate pixel-fill bits for current
* foreground
*/
for (s = 0; s < NUM_MASKS; s++)
{
c = cfb8StippleMasks[s];
cfb8StippleAnd[s] = (andfg | ~c) & (andbg | c);
cfb8StippleXor[s] = (xorfg & c) | (xorbg & ~c);
}
return TRUE;
}
/*
* a grungy little routine. This computes clip masks
* for partial character blts. Returns rgnOUT if the
* entire character is clipped; returns rgnIN if the entire
* character is unclipped; returns rgnPART if a portion of
* the character is visible. Computes clip masks for each
* longword of the character -- and those with the
* contents of the glyph to compute the visible bits.
*/
#if PGSZ == 32
#if (BITMAP_BIT_ORDER == MSBFirst)
PixelGroup cfb8BitLenMasks[PGSZ] = {
0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff,
0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff,
0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff,
0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff,
0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff,
0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff,
0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f,
0x0000000f, 0x00000007, 0x00000003, 0x00000001,
};
#else
PixelGroup cfb8BitLenMasks[PGSZ] = {
0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8,
0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80,
0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800,
0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000,
0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000,
0xfff00000, 0xffe00000, 0xffc00000, 0xff800000,
0xff000000, 0xfe000000, 0xfc000000, 0xf8000000,
0xf0000000, 0xe0000000, 0xc0000000, 0x80000000,
};
#endif /* BITMAP_BIT_ORDER */
#else /* PGSZ == 64 */
#if (BITMAP_BIT_ORDER == MSBFirst)
PixelGroup cfb8BitLenMasks[PGSZ] = {
0xffffffffffffffff, 0x7fffffffffffffff,
0x3fffffffffffffff, 0x1fffffffffffffff,
0x0fffffffffffffff, 0x07ffffffffffffff,
0x03ffffffffffffff, 0x01ffffffffffffff,
0x00ffffffffffffff, 0x007fffffffffffff,
0x003fffffffffffff, 0x001fffffffffffff,
0x000fffffffffffff, 0x0007ffffffffffff,
0x0003ffffffffffff, 0x0001ffffffffffff,
0x0000ffffffffffff, 0x00007fffffffffff,
0x00003fffffffffff, 0x00001fffffffffff,
0x00000fffffffffff, 0x000007ffffffffff,
0x000003ffffffffff, 0x000001ffffffffff,
0x000000ffffffffff, 0x0000007fffffffff,
0x0000003fffffffff, 0x0000001fffffffff,
0x0000000fffffffff, 0x00000007ffffffff,
0x00000003ffffffff, 0x00000001ffffffff,
0x00000000ffffffff, 0x000000007fffffff,
0x000000003fffffff, 0x000000001fffffff,
0x000000000fffffff, 0x0000000007ffffff,
0x0000000003ffffff, 0x0000000001ffffff,
0x0000000000ffffff, 0x00000000007fffff,
0x00000000003fffff, 0x00000000001fffff,
0x00000000000fffff, 0x000000000007ffff,
0x000000000003ffff, 0x000000000001ffff,
0x000000000000ffff, 0x0000000000007fff,
0x0000000000003fff, 0x0000000000001fff,
0x0000000000000fff, 0x00000000000007ff,
0x00000000000003ff, 0x00000000000001ff,
0x00000000000000ff, 0x000000000000007f,
0x000000000000003f, 0x000000000000001f,
0x000000000000000f, 0x0000000000000007,
0x0000000000000003, 0x0000000000000001
};
#else
PixelGroup cfb8BitLenMasks[PGSZ] = {
0xffffffffffffffff, 0xfffffffffffffffe,
0xfffffffffffffffc, 0xfffffffffffffff8,
0xfffffffffffffff0, 0xffffffffffffffe0,
0xffffffffffffffc0, 0xffffffffffffff80,
0xffffffffffffff00, 0xfffffffffffffe00,
0xfffffffffffffc00, 0xfffffffffffff800,
0xfffffffffffff000, 0xffffffffffffe000,
0xffffffffffffc000, 0xffffffffffff8000,
0xffffffffffff0000, 0xfffffffffffe0000,
0xfffffffffffc0000, 0xfffffffffff80000,
0xfffffffffff00000, 0xffffffffffe00000,
0xffffffffffc00000, 0xffffffffff800000,
0xffffffffff000000, 0xfffffffffe000000,
0xfffffffffc000000, 0xfffffffff8000000,
0xfffffffff0000000, 0xffffffffe0000000,
0xffffffffc0000000, 0xffffffff80000000,
0xffffffff00000000, 0xfffffffe00000000,
0xfffffffc00000000, 0xfffffff800000000,
0xfffffff000000000, 0xffffffe000000000,
0xffffffc000000000, 0xffffff8000000000,
0xffffff0000000000, 0xfffffe0000000000,
0xfffffc0000000000, 0xfffff80000000000,
0xfffff00000000000, 0xffffe00000000000,
0xffffc00000000000, 0xffff800000000000,
0xffff000000000000, 0xfffe000000000000,
0xfffc000000000000, 0xfff8000000000000,
0xfff0000000000000, 0xffe0000000000000,
0xffc0000000000000, 0xff80000000000000,
0xff00000000000000, 0xfe00000000000000,
0xfc00000000000000, 0xf800000000000000,
0xf000000000000000, 0xe000000000000000,
0xc000000000000000, 0x8000000000000000
};
#endif /* BITMAP_BIT_ORDER */
#endif /* PGSZ */
int
cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips)
BoxPtr pBox;
int numRects;
int x, y, w, h;
CARD32 *clips;
{
int yBand, yBandBot;
int ch;
CfbBits clip;
int partIN = FALSE, partOUT = FALSE;
int result;
if (numRects == 0)
return rgnOUT;
while (numRects && pBox->y2 <= y)
{
--numRects;
++pBox;
}
if (!numRects || pBox->y1 >= y + h)
return rgnOUT;
yBand = pBox->y1;
while (numRects && pBox->y1 == yBand && pBox->x2 <= x)
{
--numRects;
++pBox;
}
if (!numRects || pBox->y1 >= y + h)
return rgnOUT;
if (numRects &&
x >= pBox->x1 &&
x + w <= pBox->x2 &&
y >= pBox->y1 &&
y + h <= pBox->y2)
{
return rgnIN;
}
ch = 0;
while (numRects && pBox->y1 < y + h)
{
yBand = pBox->y1;
yBandBot = pBox->y2;
while (ch < h && y + ch < yBand)
{
partOUT = TRUE;
clips[ch++] = 0;
}
if (ch >= h)
break;
while (numRects && pBox->y1 == yBand && pBox->x2 <= x)
{
--numRects;
++pBox;
}
if (!numRects)
break;
clip = 0;
while (numRects && pBox->y1 == yBand && pBox->x1 < x + w)
{
if (x < pBox->x1)
if (pBox->x2 < x + w)
clip |= cfb8BitLenMasks[pBox->x1 - x] & ~cfb8BitLenMasks[pBox->x2 - x];
else
clip |= cfb8BitLenMasks[pBox->x1 - x];
else
if (pBox->x2 < x + w)
clip |= ~cfb8BitLenMasks[pBox->x2 - x];
else
clip = ~0;
--numRects;
++pBox;
}
if (clip != 0)
partIN = TRUE;
if (clip != ~0)
partOUT = TRUE;
while (ch < h && y + ch < yBandBot)
clips[ch++] = clip;
while (numRects && pBox->y1 == yBand)
{
--numRects;
++pBox;
}
}
while (ch < h)
{
partOUT = TRUE;
clips[ch++] = 0;
}
result = rgnOUT;
if (partIN)
{
if (partOUT)
result = rgnPART;
else
result = rgnIN;
}
return result;
}
#endif /* PSZ == 8 */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,70 +0,0 @@
/*
*
Copyright 1991, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "resource.h"
#include "colormap.h"
#include "colormapst.h"
#include "cfb.h"
#include "mi.h"
#include "mistruct.h"
#include "dix.h"
#include "cfbmskbits.h"
#include "mibstore.h"
#if 1 || PSZ==8
DevPrivateKey cfbGCPrivateKey = &cfbGCPrivateKey;
#endif
#ifdef CFB_NEED_SCREEN_PRIVATE
DevPrivateKey cfbScreenPrivateKey = &cfbScreenPrivateKey;
#endif
Bool
cfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *gc_key)
{
if (!gc_key || !*gc_key)
{
if (!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
return FALSE;
if (gc_key)
*gc_key = cfbGCPrivateKey;
}
else
{
cfbGCPrivateKey = *gc_key;
}
return dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC));
}

File diff suppressed because it is too large Load diff

View file

@ -1,933 +0,0 @@
/*
* cfb copy area
*/
/*
Copyright 1989, 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.
Author: Keith Packard
*/
/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
#include "fastblt.h"
#include "mergerop.h"
#ifdef notdef /* XXX fails right now, walks off end of pixmaps */
#if defined (FAST_UNALIGNED_READS) && PSZ == 8
#define DO_UNALIGNED_BITBLT
#endif
#endif
#if defined(FAST_MEMCPY) && (MROP == Mcopy) && PSZ == 8
#define DO_MEMCPY
#endif
/* ................................................. */
/* SPECIAL CODE FOR 24 BITS by Peter Wainwright */
#if PSZ == 24 && (MROP) == 0
/* The default macros are defined in mergerop.h, and none of them are
really appropriate for what we want to do.
There are two ways of fixing this: either define SLOW_24BIT_COPY
to copy pixel by pixel, or (by default) use the following macros
modified from mergerop.h
MROP_SOLID and MROP_MASK are defined for each of the operations,
i.e. each value of MROP.
There are special cases for Mcopy, McopyInverted, Mxor, and Mor.
There is a completely generic version for MROP=0, and a simplified
generic version which works for (Mcopy|Mxor|MandReverse|Mor).
However, the generic version does not work for the 24-bit case
because the pixels cannot be packed exactly into a machine word (32
bits).
Alternative macros MROP_SOLID24 and MROP_MASK24 are provided for
the 24-bit case. However, these each copy a single *pixel*, not a
single machine word. They take an rvalue source pixel, an lvalue
destination, and the pixel index. The latter is used to find the
position of the pixel data within the two words *dst and *(dst+1).
Further macros MROP_SOLID24P and MROP_MASK24P are used to copy from
an lvalue source to an lvalue destination. MROP_PIXEL24 is used to
assemble the source pixel from the adjacent words *src and
*(src+1), and this is then split between the destination words
using the non-P macros above.
But we want to copy entire words for the sake of efficiency.
Unfortunately if a plane mask is specified this must be shifted
from one word to the next. Fortunately the pattern repeats after 3
words, so we unroll the planemask here and redefine MROP_SOLID
and MROP_MASK. */
#endif /* MROP == 0 && PSZ == 24 */
/* ................................................. */
#if PSZ == 24
#define BYPP 3
#if PGSZ == 32
#define P3W 4 /* pixels in 3 machine words */
#define PAM 3 /* pixel align mask; PAM = P3W -1 */
#define P2WSH 2
#else
#define P3W 8 /* pixels in 3 machine words */
#define PAM 7 /* pixel align mask; PAM = P3W -1 */
#define P2WSH 3
#endif
#endif
void
MROP_NAME(cfbDoBitblt)(
DrawablePtr pSrc,
DrawablePtr pDst,
int alu,
RegionPtr prgnDst,
DDXPointPtr pptSrc,
unsigned long planemask)
{
CfbBits *psrcBase, *pdstBase;
/* start of src and dst bitmaps */
int widthSrc, widthDst; /* add to get to same position in next line */
BoxPtr pbox;
int nbox;
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
/* temporaries for shuffling rectangles */
DDXPointPtr pptTmp, pptNew1, pptNew2;
/* shuffling boxes entails shuffling the
source points too */
int w, h;
int xdir; /* 1 = left right, -1 = right left/ */
int ydir; /* 1 = top down, -1 = bottom up */
CfbBits *psrcLine, *pdstLine;
/* pointers to line with current src and dst */
register CfbBits *psrc;/* pointer to current src longword */
register CfbBits *pdst;/* pointer to current dst longword */
MROP_DECLARE_REG()
/* following used for looping through a line */
CfbBits startmask, endmask; /* masks for writing ends of dst */
int nlMiddle; /* whole longwords in dst */
int xoffSrc, xoffDst;
register int nl; /* temp copy of nlMiddle */
int careful;
#if (PSZ != 24) || (MROP != 0)
register int leftShift, rightShift;
register CfbBits bits;
register CfbBits bits1;
#endif
#if PSZ == 24
#ifdef DO_MEMCPY
int w2;
#endif
#if MROP == 0
int widthSrcBytes = cfbGetByteWidth(pSrc);
int widthDstBytes = cfbGetByteWidth(pDst);
#endif
#endif
MROP_INITIALIZE(alu,planemask)
cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase)
cfbGetLongWidthAndPointer (pDst, widthDst, pdstBase)
/* XXX we have to err on the side of safety when both are windows,
* because we don't know if IncludeInferiors is being used.
*/
careful = ((pSrc == pDst) ||
((pSrc->type == DRAWABLE_WINDOW) &&
(pDst->type == DRAWABLE_WINDOW)));
pbox = REGION_RECTS(prgnDst);
nbox = REGION_NUM_RECTS(prgnDst);
pboxNew1 = NULL;
pptNew1 = NULL;
pboxNew2 = NULL;
pptNew2 = NULL;
if (careful && (pptSrc->y < pbox->y1))
{
/* walk source botttom to top */
ydir = -1;
widthSrc = -widthSrc;
widthDst = -widthDst;
if (nbox > 1)
{
/* keep ordering in each band, reverse order of bands */
pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
if(!pboxNew1)
return;
pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
if(!pptNew1)
{
xfree(pboxNew1);
return;
}
pboxBase = pboxNext = pbox+nbox-1;
while (pboxBase >= pbox)
{
while ((pboxNext >= pbox) &&
(pboxBase->y1 == pboxNext->y1))
pboxNext--;
pboxTmp = pboxNext+1;
pptTmp = pptSrc + (pboxTmp - pbox);
while (pboxTmp <= pboxBase)
{
*pboxNew1++ = *pboxTmp++;
*pptNew1++ = *pptTmp++;
}
pboxBase = pboxNext;
}
pboxNew1 -= nbox;
pbox = pboxNew1;
pptNew1 -= nbox;
pptSrc = pptNew1;
}
}
else
{
/* walk source top to bottom */
ydir = 1;
}
if (careful && (pptSrc->x < pbox->x1))
{
/* walk source right to left */
xdir = -1;
if (nbox > 1)
{
/* reverse order of rects in each band */
pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
if(!pboxNew2 || !pptNew2)
{
if (pptNew2) xfree(pptNew2);
if (pboxNew2) xfree(pboxNew2);
if (pboxNew1)
{
xfree(pptNew1);
xfree(pboxNew1);
}
return;
}
pboxBase = pboxNext = pbox;
while (pboxBase < pbox+nbox)
{
while ((pboxNext < pbox+nbox) &&
(pboxNext->y1 == pboxBase->y1))
pboxNext++;
pboxTmp = pboxNext;
pptTmp = pptSrc + (pboxTmp - pbox);
while (pboxTmp != pboxBase)
{
*pboxNew2++ = *--pboxTmp;
*pptNew2++ = *--pptTmp;
}
pboxBase = pboxNext;
}
pboxNew2 -= nbox;
pbox = pboxNew2;
pptNew2 -= nbox;
pptSrc = pptNew2;
}
}
else
{
/* walk source left to right */
xdir = 1;
}
while(nbox--)
{
w = pbox->x2 - pbox->x1;
h = pbox->y2 - pbox->y1;
#if PSZ == 24
#ifdef DO_MEMCPY
w2 = w * BYPP;
#endif
#endif
if (ydir == -1) /* start at last scanline of rectangle */
{
psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc);
pdstLine = pdstBase + ((pbox->y2-1) * -widthDst);
}
else /* start at first scanline */
{
psrcLine = psrcBase + (pptSrc->y * widthSrc);
pdstLine = pdstBase + (pbox->y1 * widthDst);
}
#if PSZ == 24
if (w == 1 && ((pbox->x1 & PAM) == 0 || (pbox->x1 & PAM) == PAM))
#else
if ((pbox->x1 & PIM) + w <= PPW)
#endif
{
maskpartialbits (pbox->x1, w, endmask);
startmask = 0;
nlMiddle = 0;
}
else
{
maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
}
#if PSZ == 24
#if 0
nlMiddle = w - (pbox->x2 &PAM);;
if(pbox->x1 & PAM){
nlMiddle -= (PAM+1 - (pbox->x1 &PAM));
}
nlMiddle >>= P2WSH;
if(nlMiddle < 0)
nlMiddle = 0;
#endif
#endif
#ifdef DO_MEMCPY
/* If the src and dst scanline don't overlap, do forward case. */
if ((xdir == 1) || (pptSrc->y != pbox->y1)
|| (pptSrc->x + w <= pbox->x1))
{
#if PSZ == 24
char *psrc = (char *) psrcLine + (pptSrc->x * BYPP);
char *pdst = (char *) pdstLine + (pbox->x1 * BYPP);
#else
char *psrc = (char *) psrcLine + pptSrc->x;
char *pdst = (char *) pdstLine + pbox->x1;
#endif
while (h--)
{
#if PSZ == 24
memcpy(pdst, psrc, w2);
#else
memcpy(pdst, psrc, w);
#endif
pdst += widthDst << PWSH;
psrc += widthSrc << PWSH;
}
}
#else /* ! DO_MEMCPY */
if (xdir == 1)
{
#if PSZ == 24 && MROP == 0
/* Note: x is a pixel number; the byte offset is 3*x;
therefore the offset within a word is (3*x) & 3 ==
(4*x-x) & 3 == (-x) & 3. The offsets therefore
DECREASE by 1 for each pixel.
*/
xoffSrc = ( - pptSrc->x) & PAM;
xoffDst = ( - pbox->x1) & PAM;
#if 1
if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */
|| ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
#else
if(1)
#endif
/* Width also must be same, if hight > 1 */
{
/* ...otherwise, pixel by pixel operation */
while (h--)
{
register int i, si, sii, di;
for (i = 0, si = pptSrc->x, di = pbox->x1;
i < w;
i++, si++, di++) {
psrc = psrcLine + ((si * BYPP) >> P2WSH);
pdst = pdstLine + ((di * BYPP) >> P2WSH);
sii = (si & 3);
MROP_SOLID24P(psrc, pdst, sii, di);
}
pdstLine += widthDst;
psrcLine += widthSrc;
}
}
else
#endif
{
#if PSZ == 24
#if MROP != 0
xoffSrc = ( - pptSrc->x) & PAM;
xoffDst = ( - pbox->x1) & PAM;
#endif
pdstLine += (pbox->x1 * BYPP) >> P2WSH;
psrcLine += (pptSrc->x * BYPP) >> P2WSH;
#else
xoffSrc = pptSrc->x & PIM;
xoffDst = pbox->x1 & PIM;
pdstLine += (pbox->x1 >> PWSH);
psrcLine += (pptSrc->x >> PWSH);
#endif
#ifdef DO_UNALIGNED_BITBLT
nl = xoffSrc - xoffDst;
psrcLine = (CfbBits *)
(((unsigned char *) psrcLine) + nl);
#else
#if PSZ == 24 && MROP == 0
/* alredy satisfied */
#else
if (xoffSrc == xoffDst)
#endif
#endif
{
while (h--)
{
#if PSZ == 24 && MROP == 0
register int index;
register int im3;
#endif /* PSZ == 24 && MROP == 0 */
psrc = psrcLine;
pdst = pdstLine;
pdstLine += widthDst;
psrcLine += widthSrc;
#if PSZ == 24 && MROP == 0
index = (int)(pdst - pdstBase);
im3 = index % 3;
#endif /* PSZ == 24 && MROP == 0 */
if (startmask)
{
#if PSZ == 24 && MROP == 0
*pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, im3);
index++;
im3 = index % 3;
#else /* PSZ != 24 || MROP != 0 */
*pdst = MROP_MASK(*psrc, *pdst, startmask);
#endif /* PSZ == 24 && MROP == 0 */
psrc++;
pdst++;
}
nl = nlMiddle;
#ifdef LARGE_INSTRUCTION_CACHE
#ifdef FAST_CONSTANT_OFFSET_MODE
psrc += nl & (UNROLL-1);
pdst += nl & (UNROLL-1);
#if PSZ == 24 && MROP == 0
#define BodyOdd(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
#define BodyEven(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
#else /* PSZ != 24 || MROP != 0 */
#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
#endif /* PSZ == 24 && MROP == 0 */
#define LoopReset \
pdst += UNROLL; \
psrc += UNROLL;
#else
#if PSZ == 24 && MROP == 0
#define BodyOdd(n) *pdst = DoMergeRop24u(*psrc, *pdst, im3); pdst++; psrc++; index++; im3 = index % 3;
#define BodyEven(n) BodyOdd(n)
#else /* PSZ != 24 || MROP != 0 */
#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
#define BodyEven(n) BodyOdd(n)
#endif /* PSZ == 24 && MROP == 0 */
#define LoopReset ;
#endif
PackedLoop
#undef BodyOdd
#undef BodyEven
#undef LoopReset
#else
#ifdef NOTDEF
/* you'd think this would be faster --
* a single instruction instead of 6
* but measurements show it to be ~15% slower
*/
while ((nl -= 6) >= 0)
{
asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
: "=m" (*(char *)pdst)
: "m" (*(char *)psrc)
: "d0", "d1", "d2", "d3",
"a2", "a3");
pdst += 6;
}
nl += 6;
while (nl--)
*pdst++ = *psrc++;
#endif
#if 0 /*PSZ == 24 && MROP == 0*/
DuffL(nl, label1,
*pdst = DoMergeRop24u(*psrc, *pdst, im3);
pdst++; psrc++; index++;im3 = index % 3;)
#else /* !(PSZ == 24 && MROP == 0) */
DuffL(nl, label1,
*pdst = MROP_SOLID (*psrc, *pdst);
pdst++; psrc++;)
#endif /* PSZ == 24 && MROP == 0 */
#endif
if (endmask)
#if PSZ == 24 && MROP == 0
*pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, (int)(pdst - pdstBase) % 3);
#else /* !(PSZ == 24 && MROP == 0) */
*pdst = MROP_MASK(*psrc, *pdst, endmask);
#endif /* PSZ == 24 && MROP == 0 */
}
}
#ifndef DO_UNALIGNED_BITBLT
#if PSZ == 24 && MROP == 0
/* can not happen */
#else /* !(PSZ == 24 && MROP == 0) */
else /* xoffSrc != xoffDst */
{
if (xoffSrc > xoffDst)
{
#if PSZ == 24
leftShift = (xoffSrc - xoffDst) << 3;
#else
#if PGSZ == 32
leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
#else /* PGSZ == 64 */
leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
#endif /* PGSZ */
#endif
rightShift = PGSZ - leftShift;
}
else
{
#if PSZ == 24
rightShift = (xoffDst - xoffSrc) << 3;
#else
#if PGSZ == 32
rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
#else /* PGSZ == 64 */
rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
#endif /* PGSZ */
#endif
leftShift = PGSZ - rightShift;
}
while (h--)
{
psrc = psrcLine;
pdst = pdstLine;
pdstLine += widthDst;
psrcLine += widthSrc;
bits = 0;
if (xoffSrc > xoffDst)
bits = *psrc++;
if (startmask)
{
bits1 = BitLeft(bits,leftShift);
bits = *psrc++;
bits1 |= BitRight(bits,rightShift);
*pdst = MROP_MASK(bits1, *pdst, startmask);
pdst++;
}
nl = nlMiddle;
#ifdef LARGE_INSTRUCTION_CACHE
bits1 = bits;
#ifdef FAST_CONSTANT_OFFSET_MODE
psrc += nl & (UNROLL-1);
pdst += nl & (UNROLL-1);
#define BodyOdd(n) \
bits = psrc[-n]; \
pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
#define BodyEven(n) \
bits1 = psrc[-n]; \
pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
#define LoopReset \
pdst += UNROLL; \
psrc += UNROLL;
#else
#define BodyOdd(n) \
bits = *psrc++; \
*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
pdst++;
#define BodyEven(n) \
bits1 = *psrc++; \
*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
pdst++;
#define LoopReset ;
#endif /* !FAST_CONSTANT_OFFSET_MODE */
PackedLoop
#undef BodyOdd
#undef BodyEven
#undef LoopReset
#else
DuffL (nl,label2,
bits1 = BitLeft(bits, leftShift);
bits = *psrc++;
*pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
pdst++;
)
#endif
if (endmask)
{
bits1 = BitLeft(bits, leftShift);
if (BitLeft(endmask, rightShift))
{
bits = *psrc;
bits1 |= BitRight(bits, rightShift);
}
*pdst = MROP_MASK (bits1, *pdst, endmask);
}
}
}
#endif /* (PSZ == 24 && MROP == 0) */
#endif /* DO_UNALIGNED_BITBLT */
}
}
#endif /* ! DO_MEMCPY */
else /* xdir == -1 */
{
#if PSZ == 24 && MROP == 0
xoffSrc = (-(pptSrc->x + w)) & PAM;
xoffDst = (-pbox->x2) & PAM;
#if 1
if(xoffSrc != xoffDst /* Alignments must be same. */
|| ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
#else
if(1)
#endif
/* Width also must be same, if hight > 1 */
{
/* ...otherwise, pixel by pixel operation */
while (h--)
{
register int i, si, sii, di;
for (i = 0, si = pptSrc->x + w - 1, di = pbox->x2 - 1;
i < w;
i++, si--, di--) {
psrc = psrcLine + ((si * BYPP) >> P2WSH);
pdst = pdstLine + ((di * BYPP) >> P2WSH);
sii = (si & PAM);
MROP_SOLID24P(psrc, pdst, sii, di);
}
psrcLine += widthSrc;
pdstLine += widthDst;
}
}else
#endif /* MROP == 0 && PSZ == 24 */
{
#if PSZ == 24
#if MROP == 0
/* already calculated */
#else
xoffSrc = (pptSrc->x + w) & PAM;
xoffDst = pbox->x2 & PAM;
#endif
pdstLine += ((pbox->x2 * BYPP - 1) >> P2WSH) + 1;
psrcLine += (((pptSrc->x+w) * BYPP - 1) >> P2WSH) + 1;
#else
xoffSrc = (pptSrc->x + w - 1) & PIM;
xoffDst = (pbox->x2 - 1) & PIM;
pdstLine += ((pbox->x2-1) >> PWSH) + 1;
psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
#endif
#ifdef DO_UNALIGNED_BITBLT
#if PSZ == 24
nl = xoffDst - xoffSrc;
#else
nl = xoffSrc - xoffDst;
#endif
psrcLine = (CfbBits *)
(((unsigned char *) psrcLine) + nl);
#else
#if PSZ == 24 && MROP == 0
/* already satisfied */
#else
if (xoffSrc == xoffDst)
#endif
#endif
{
while (h--)
{
#if PSZ == 24 && MROP == 0
register int index;
register int im3;
#endif /* PSZ == 24 && MROP == 0 */
psrc = psrcLine;
pdst = pdstLine;
pdstLine += widthDst;
psrcLine += widthSrc;
#if PSZ == 24 && MROP == 0
index = (int)(pdst - pdstBase);
#endif /* PSZ == 24 && MROP == 0 */
if (endmask)
{
pdst--;
psrc--;
#if PSZ == 24 && MROP == 0
index--;
im3 = index % 3;
*pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, im3);
#else /* !(PSZ == 24 && MROP == 0) */
*pdst = MROP_MASK (*psrc, *pdst, endmask);
#endif /* PSZ == 24 && MROP == 0 */
}
nl = nlMiddle;
#ifdef LARGE_INSTRUCTION_CACHE
#ifdef FAST_CONSTANT_OFFSET_MODE
psrc -= nl & (UNROLL - 1);
pdst -= nl & (UNROLL - 1);
#if PSZ == 24 && MROP == 0
#define BodyOdd(n) pdst[n-1] = DoMergeRop24u(psrc[n-1], pdst[n-1], ((int)(pdst - (n - 1) -pdstBase)) % 3);
#else /* !(PSZ == 24 && MROP == 0) */
#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
#endif /* PSZ == 24 && MROP == 0 */
#define BodyEven(n) BodyOdd(n)
#define LoopReset \
pdst -= UNROLL;\
psrc -= UNROLL;
#else
#if PSZ == 24 && MROP == 0
#define BodyOdd(n) --pdst; --psrc; --index; im3 = index % 3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);
#else /* !(PSZ == 24 && MROP == 0) */
#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
#endif /* PSZ == 24 && MROP == 0 */
#define BodyEven(n) BodyOdd(n)
#define LoopReset ;
#endif
PackedLoop
#undef BodyOdd
#undef BodyEven
#undef LoopReset
#else
#if PSZ == 24 && MROP == 0
DuffL(nl,label3,
--pdst; --psrc; --index; im3= index%3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);)
#else /* !(PSZ == 24 && MROP == 0) */
DuffL(nl,label3,
--pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
#endif /* PSZ == 24 && MROP == 0 */
#endif
if (startmask)
{
--pdst;
--psrc;
#if PSZ == 24 && MROP == 0
*pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, (int)(pdst - pdstBase) % 3);
#else /* !(PSZ == 24 && MROP == 0) */
*pdst = MROP_MASK(*psrc, *pdst, startmask);
#endif /* PSZ == 24 && MROP == 0 */
}
}
}
#ifndef DO_UNALIGNED_BITBLT
#if PSZ == 24 && MROP == 0
/* can not happen */
#else /* !( PSZ == 24 && MROP == 0) */
else
{
if (xoffDst > xoffSrc)
{
#if PSZ == 24
leftShift = (xoffDst - xoffSrc) << 3;
rightShift = PGSZ - leftShift;
#else
#if PGSZ == 32
rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
#else /* PGSZ == 64 */
rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
#endif /* PGSZ */
leftShift = PGSZ - rightShift;
#endif
}
else
{
#if PSZ == 24
rightShift = (xoffSrc - xoffDst) << 3;
leftShift = PGSZ - rightShift;
#else
#if PGSZ == 32
leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
#else /* PGSZ == 64 */
leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
#endif /* PGSZ */
rightShift = PGSZ - leftShift;
#endif
}
while (h--)
{
psrc = psrcLine;
pdst = pdstLine;
pdstLine += widthDst;
psrcLine += widthSrc;
bits = 0;
#if PSZ == 24
if (xoffSrc > xoffDst)
#else
if (xoffDst > xoffSrc)
#endif
bits = *--psrc;
if (endmask)
{
bits1 = BitRight(bits, rightShift);
bits = *--psrc;
bits1 |= BitLeft(bits, leftShift);
pdst--;
*pdst = MROP_MASK(bits1, *pdst, endmask);
}
nl = nlMiddle;
#ifdef LARGE_INSTRUCTION_CACHE
bits1 = bits;
#ifdef FAST_CONSTANT_OFFSET_MODE
psrc -= nl & (UNROLL - 1);
pdst -= nl & (UNROLL - 1);
#define BodyOdd(n) \
bits = psrc[n-1]; \
pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
#define BodyEven(n) \
bits1 = psrc[n-1]; \
pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
#define LoopReset \
pdst -= UNROLL; \
psrc -= UNROLL;
#else
#define BodyOdd(n) \
bits = *--psrc; --pdst; \
*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
#define BodyEven(n) \
bits1 = *--psrc; --pdst; \
*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
#define LoopReset ;
#endif
PackedLoop
#undef BodyOdd
#undef BodyEven
#undef LoopReset
#else
DuffL (nl, label4,
bits1 = BitRight(bits, rightShift);
bits = *--psrc;
--pdst;
*pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
)
#endif
if (startmask)
{
bits1 = BitRight(bits, rightShift);
if (BitRight (startmask, leftShift))
{
bits = *--psrc;
bits1 |= BitLeft(bits, leftShift);
}
--pdst;
*pdst = MROP_MASK(bits1, *pdst, startmask);
}
}
}
#endif /* PSZ == 24 && MROP == 0 */
#endif
}
}
pbox++;
pptSrc++;
}
if (pboxNew2)
{
xfree(pptNew2);
xfree(pboxNew2);
}
if (pboxNew1)
{
xfree(pptNew1);
xfree(pboxNew1);
}
}

View file

@ -1,340 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "misc.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "servermd.h"
#include "miline.h"
/* Solid bresenham line */
/* NOTES
e2 is used less often than e1, so it's not in a register
*/
void
cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
e2, len)
int rop;
CfbBits and, xor;
CfbBits *addrl; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
register int signdx;
int signdy; /* signs of directions */
int axis; /* major axis (Y_AXIS or X_AXIS) */
int x1, y1; /* initial point */
register int e; /* error accumulator */
register int e1; /* bresenham increments */
int e2;
int len; /* length of line */
{
register int e3 = e2-e1;
#if PSZ == 24
CfbBits piQxelXor[3],piQxelAnd[3];
char *addrb;
int nlwidth3, signdx3;
#endif
#ifdef PIXEL_ADDR
register PixelType *addrp; /* Pixel pointer */
if (len == 0)
return;
/* point to first point */
nlwidth <<= PWSH;
#if PSZ == 24
addrp = (PixelType *)(addrl) + (y1 * nlwidth);
addrb = (char *)addrp + x1 * 3;
piQxelXor[0] = (xor << 24) | xor;
piQxelXor[1] = (xor << 16)| (xor >> 8);
piQxelXor[2] = (xor << 8) | (xor >> 16);
piQxelAnd[0] = (and << 24) | and;
piQxelAnd[1] = (and << 16)| (and >> 8);
piQxelAnd[2] = (and << 8) | (and >> 16);
#else
addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
#endif
if (signdy < 0)
nlwidth = -nlwidth;
e = e-e1; /* to make looping easier */
#if PSZ == 24
nlwidth3 = nlwidth * sizeof (CfbBits);
signdx3 = signdx * 3;
#endif
if (axis == Y_AXIS)
{
int t;
t = nlwidth;
nlwidth = signdx;
signdx = t;
#if PSZ == 24
t = nlwidth3;
nlwidth3 = signdx3;
signdx3 = t;
#endif
}
if (rop == GXcopy)
{
--len;
#if PSZ == 24
#define body_copy \
addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
switch((unsigned long)addrb & 3){ \
case 0: \
*addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
break; \
case 1: \
*addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
break; \
case 3: \
*addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
*(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
break; \
case 2: \
*addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
*(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
break; \
}
#define body {\
body_copy \
addrb += signdx3; \
e += e1; \
if (e >= 0) \
{ \
addrb += nlwidth3; \
e += e3; \
} \
}
#else /* PSZ == 24 */
#define body {\
*addrp = xor; \
addrp += signdx; \
e += e1; \
if (e >= 0) \
{ \
addrp += nlwidth; \
e += e3; \
} \
}
#endif /* PSZ == 24 */
while (len >= 4)
{
body body body body
len -= 4;
}
switch (len)
{
case 3: body case 2: body case 1: body
}
#undef body
#if PSZ == 24
body_copy
# undef body_copy
#else
*addrp = xor;
#endif
}
else /* not GXcopy */
{
while(len--)
{
#if PSZ == 24
addrp = (PixelType *)((unsigned long)addrb & ~0x03);
switch((unsigned long)addrb & 3){
case 0:
*addrp = (*addrp & (piQxelAnd[0]|0xFF000000))
^ (piQxelXor[0] & 0xFFFFFF);
break;
case 1:
*addrp = (*addrp & (piQxelAnd[2]|0xFF))
^ (piQxelXor[2] & 0xFFFFFF00);
break;
case 3:
*addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF))
^ (piQxelXor[0] & 0xFF000000);
*(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000))
^ (piQxelXor[1] & 0xFFFF);
break;
case 2:
*addrp = (*addrp & (piQxelAnd[1]|0xFFFF))
^ (piQxelXor[1] & 0xFFFF0000);
*(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00))
^ (piQxelXor[2] & 0xFF);
break;
}
e += e1;
if (e >= 0)
{
addrb += nlwidth3;
e += e3;
}
addrb += signdx3;
#else /* PSZ == 24 */
*addrp = DoRRop (*addrp, and, xor);
e += e1;
if (e >= 0)
{
addrp += nlwidth;
e += e3;
}
addrp += signdx;
#endif /* PSZ == 24 */
}
}
#else /* !PIXEL_ADDR */
register CfbBits tmp, bit;
CfbBits leftbit, rightbit;
/* point to longword containing first point */
#if PSZ == 24
addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2);
#else
addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
#endif
if (signdy < 0)
nlwidth = -nlwidth;
e = e-e1; /* to make looping easier */
leftbit = cfbmask[0];
#if PSZ == 24
rightbit = cfbmask[(PPW-1)<<1];
bit = cfbmask[(x1 & 3)<<1];
#else
rightbit = cfbmask[PPW-1];
bit = cfbmask[x1 & PIM];
#endif
if (axis == X_AXIS)
{
if (signdx > 0)
{
while (len--)
{
*addrl = DoMaskRRop (*addrl, and, xor, bit);
bit = SCRRIGHT(bit,1);
e += e1;
if (e >= 0)
{
addrl += nlwidth;
e += e3;
}
if (!bit)
{
bit = leftbit;
addrl++;
}
}
}
else
{
while (len--)
{
*addrl = DoMaskRRop (*addrl, and, xor, bit);
e += e1;
bit = SCRLEFT(bit,1);
if (e >= 0)
{
addrl += nlwidth;
e += e3;
}
if (!bit)
{
bit = rightbit;
addrl--;
}
}
}
} /* if X_AXIS */
else
{
if (signdx > 0)
{
while(len--)
{
*addrl = DoMaskRRop (*addrl, and, xor, bit);
e += e1;
if (e >= 0)
{
bit = SCRRIGHT(bit,1);
if (!bit)
{
bit = leftbit;
addrl++;
}
e += e3;
}
addrl += nlwidth;
}
}
else
{
while(len--)
{
*addrl = DoMaskRRop (*addrl, and, xor, bit);
e += e1;
if (e >= 0)
{
bit = SCRLEFT(bit,1);
if (!bit)
{
bit = rightbit;
addrl--;
}
e += e3;
}
addrl += nlwidth;
}
}
} /* else Y_AXIS */
#endif
}

View file

@ -1,404 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "misc.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "miline.h"
/* Dashed bresenham line */
void
cfbBresD(rrops,
pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, x1, y1, e, e1, e2, len)
cfbRRopPtr rrops;
int *pdashIndex; /* current dash */
unsigned char *pDash; /* dash list */
int numInDashList; /* total length of dash list */
int *pdashOffset; /* offset into current dash */
int isDoubleDash;
CfbBits *addrl; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
int signdx, signdy; /* signs of directions */
int axis; /* major axis (Y_AXIS or X_AXIS) */
int x1, y1; /* initial point */
register int e; /* error accumulator */
register int e1; /* bresenham increments */
int e2;
int len; /* length of line */
{
#ifdef PIXEL_ADDR
register PixelType *addrp;
#endif
register int e3 = e2-e1;
int dashIndex;
int dashOffset;
int dashRemaining;
CfbBits xorFg, andFg, xorBg, andBg;
Bool isCopy;
int thisDash;
#if PSZ == 24
CfbBits xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3];
char *addrb;
int signdx3, signdy3;
#endif
dashOffset = *pdashOffset;
dashIndex = *pdashIndex;
isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy);
#if PSZ == 24
xorFg = rrops[0].xor & 0xffffff;
andFg = rrops[0].and & 0xffffff;
xorBg = rrops[1].xor & 0xffffff;
andBg = rrops[1].and & 0xffffff;
xorPiQxlFg[0] = xorFg | (xorFg << 24);
xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16);
xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8);
andPiQxlFg[0] = andFg | (andFg << 24);
andPiQxlFg[1] = (andFg >> 8) | (andFg << 16);
andPiQxlFg[2] = (andFg >> 16) | (andFg << 8);
xorPiQxlBg[0] = xorBg | (xorBg << 24);
xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16);
xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8);
andPiQxlBg[0] = andBg | (andBg << 24);
andPiQxlBg[1] = (andBg >> 8) | (andBg << 16);
andPiQxlBg[2] = (andFg >> 16) | (andBg << 8);
#else
xorFg = rrops[0].xor;
andFg = rrops[0].and;
xorBg = rrops[1].xor;
andBg = rrops[1].and;
#endif
dashRemaining = pDash[dashIndex] - dashOffset;
if ((thisDash = dashRemaining) >= len)
{
thisDash = len;
dashRemaining -= len;
}
e = e-e1; /* to make looping easier */
#define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;}
#define NextDash {\
dashIndex++; \
if (dashIndex == numInDashList) \
dashIndex = 0; \
dashRemaining = pDash[dashIndex]; \
if ((thisDash = dashRemaining) >= len) \
{ \
dashRemaining -= len; \
thisDash = len; \
} \
}
#ifdef PIXEL_ADDR
#if PSZ == 24
#define Loop(store) while (thisDash--) {\
store; \
BresStep(addrb+=signdy3,addrb+=signdx3) \
}
/* point to first point */
nlwidth <<= PWSH;
addrp = (PixelType *)(addrl) + (y1 * nlwidth);
addrb = (char *)addrp + x1 * 3;
#else
#define Loop(store) while (thisDash--) {\
store; \
BresStep(addrp+=signdy,addrp+=signdx) \
}
/* point to first point */
nlwidth <<= PWSH;
addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
#endif
signdy *= nlwidth;
#if PSZ == 24
signdx3 = signdx * 3;
signdy3 = signdy * sizeof (CfbBits);
#endif
if (axis == Y_AXIS)
{
int t;
t = signdx;
signdx = signdy;
signdy = t;
#if PSZ == 24
t = signdx3;
signdx3 = signdy3;
signdy3 = t;
#endif
}
if (isCopy)
{
#if PSZ == 24
#define body_copy(pix) { \
addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
switch((unsigned long)addrb & 3){ \
case 0: \
*addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \
break; \
case 1: \
*addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \
break; \
case 3: \
*addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \
*(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \
break; \
case 2: \
*addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \
*(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \
break; \
} \
}
#endif /* PSZ == 24 */
for (;;)
{
len -= thisDash;
if (dashIndex & 1) {
if (isDoubleDash) {
#if PSZ == 24
Loop(body_copy(xorPiQxlBg))
#else
Loop(*addrp = xorBg)
#endif
} else {
Loop(;)
}
} else {
#if PSZ == 24
Loop(body_copy(xorPiQxlFg))
#else
Loop(*addrp = xorFg)
#endif
}
if (!len)
break;
NextDash
}
#undef body_copy
}
else
{
#define body_set(and, xor) { \
addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
switch((unsigned long)addrb & 3){ \
case 0: \
*addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \
break; \
case 1: \
*addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \
break; \
case 3: \
*addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \
*(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \
break; \
case 2: \
*addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \
*(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \
break; \
} \
}
for (;;)
{
len -= thisDash;
if (dashIndex & 1) {
if (isDoubleDash) {
#if PSZ == 24
Loop(body_set(andPiQxlBg, xorPiQxlBg))
#else
Loop(*addrp = DoRRop(*addrp,andBg, xorBg))
#endif
} else {
Loop(;)
}
} else {
#if PSZ == 24
Loop(body_set(andPiQxlFg, xorPiQxlFg))
#else
Loop(*addrp = DoRRop(*addrp,andFg, xorFg))
#endif
}
if (!len)
break;
NextDash
}
#undef body_set
}
#else /* !PIXEL_ADDR */
{
register CfbBits tmp;
CfbBits startbit, bit;
/* point to longword containing first point */
#if PSZ == 24
addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2);
#else
addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
#endif
signdy = signdy * nlwidth;
if (signdx > 0)
startbit = cfbmask[0];
else
#if PSZ == 24
startbit = cfbmask[(PPW-1)<<1];
bit = cfbmask[(x1 & 3)<<1];
#else
startbit = cfbmask[PPW-1];
bit = cfbmask[x1 & PIM];
#endif
#if PSZ == 24
#define X_Loop(store) while(thisDash--) {\
store; \
BresStep(addrl += signdy, \
if (signdx > 0) \
bit = SCRRIGHT(bit,1); \
else \
bit = SCRLEFT(bit,1); \
if (!bit) \
{ \
bit = startbit; \
addrl += signdx; \
}) \
}
#define Y_Loop(store) while(thisDash--) {\
store; \
BresStep(if (signdx > 0) \
bit = SCRRIGHT(bit,1); \
else \
bit = SCRLEFT(bit,1); \
if (!bit) \
{ \
bit = startbit; \
addrl += signdx; \
}, \
addrl += signdy) \
}
#else
#define X_Loop(store) while(thisDash--) {\
store; \
BresStep(addrl += signdy, \
if (signdx > 0) \
bit = SCRRIGHT(bit,1); \
else \
bit = SCRLEFT(bit,1); \
if (!bit) \
{ \
bit = startbit; \
addrl += signdx; \
}) \
}
#define Y_Loop(store) while(thisDash--) {\
store; \
BresStep(if (signdx > 0) \
bit = SCRRIGHT(bit,1); \
else \
bit = SCRLEFT(bit,1); \
if (!bit) \
{ \
bit = startbit; \
addrl += signdx; \
}, \
addrl += signdy) \
}
#endif
if (axis == X_AXIS)
{
for (;;)
{
len -= thisDash;
if (dashIndex & 1) {
if (isDoubleDash) {
X_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit));
} else {
X_Loop(;)
}
} else {
X_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit));
}
if (!len)
break;
NextDash
}
} /* if X_AXIS */
else
{
for (;;)
{
len -= thisDash;
if (dashIndex & 1) {
if (isDoubleDash) {
Y_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit));
} else {
Y_Loop(;)
}
} else {
Y_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit));
}
if (!len)
break;
NextDash
}
} /* else Y_AXIS */
}
#endif
*pdashIndex = dashIndex;
*pdashOffset = pDash[dashIndex] - dashRemaining;
}

View file

@ -1,119 +0,0 @@
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
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 no-
tice appear in all copies and that both that copyright no-
tice and this permission notice appear in supporting docu-
mentation, and that the names of Sun or The Open Group
not be used in advertising or publicity pertaining to
distribution of the software without specific prior
written permission. Sun and The Open Group make no
representations about the suitability of this software for
any purpose. It is provided "as is" without any express or
implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
ABLE 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 <X11/X.h>
#include <X11/Xproto.h>
#include "scrnintstr.h"
#include "colormapst.h"
#include "resource.h"
#include "micmap.h"
#include "cfb.h"
int
cfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
return miListInstalledColormaps(pScreen, pmaps);
}
void
cfbInstallColormap(ColormapPtr pmap)
{
miInstallColormap(pmap);
}
void
cfbUninstallColormap(ColormapPtr pmap)
{
miUninstallColormap(pmap);
}
void
cfbResolveColor(unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue,
VisualPtr pVisual)
{
miResolveColor(pred, pgreen, pblue, pVisual);
}
Bool
cfbInitializeColormap(ColormapPtr pmap)
{
return miInitializeColormap(pmap);
}
int
cfbExpandDirectColors (ColormapPtr pmap, int ndef,
xColorItem *indefs, xColorItem *outdefs)
{
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
}
Bool
cfbCreateDefColormap(ScreenPtr pScreen)
{
return miCreateDefColormap(pScreen);
}
void
cfbClearVisualTypes(void)
{
miClearVisualTypes();
}
Bool
cfbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
{
return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
}
/*
* Given a list of formats for a screen, create a list
* of visuals and depths for the screen which coorespond to
* the set which can be used with this version of cfb.
*/
Bool
cfbInitVisuals (VisualPtr *visualp,
DepthPtr *depthp,
int *nvisualp,
int *ndepthp,
int *rootDepthp,
VisualID *defaultVisp,
unsigned long sizes,
int bitsPerRGB)
{
return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
defaultVisp, sizes, bitsPerRGB, -1);
}

View file

@ -1,486 +0,0 @@
/*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include "gcstruct.h"
#include "window.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "cfb.h"
#if PSZ == 8
#undef PSZ /* for maskbits.h */
#include "maskbits.h"
#define PSZ 8
#include "mergerop.h"
#endif
void
cfbCopyImagePlane(
DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
int rop,
RegionPtr prgnDst,
DDXPointPtr pptSrc,
unsigned long planemask)
{
/* note: there must be some sort of trick behind,
passing a planemask value with all bits set
whilst using the current planemask for the bitPlane value. */
#if PSZ == 8
cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
#endif
#if PSZ == 16
cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
#endif
#if PSZ == 24
cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
#endif
#if PSZ == 32
cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
(unsigned long) ~0L, planemask);
#endif
}
#if PSZ == 8
#if BITMAP_BIT_ORDER == MSBFirst
#define LeftMost (MFB_PPW-1)
#define StepBit(bit, inc) ((bit) -= (inc))
#else
#define LeftMost 0
#define StepBit(bit, inc) ((bit) += (inc))
#endif
#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
bits = 0; \
while (nBits--) \
{ \
bits |= (PixelType)(((*psrc++ >> bitPos) & 1)) << curBit; \
StepBit (curBit, 1); \
} \
}
void
cfbCopyPlane8to1(
DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
int rop,
RegionPtr prgnDst,
DDXPointPtr pptSrc,
unsigned long planemask,
unsigned long bitPlane)
{
int srcx, srcy, dstx, dsty, width, height;
unsigned char *psrcBase;
PixelType *pdstBase;
int widthSrc, widthDst;
unsigned char *psrcLine;
PixelType *pdstLine;
register unsigned char *psrc;
register int i;
register int curBit;
register int bitPos;
register CfbBits bits;
register PixelType *pdst;
PixelType startmask, endmask;
int niStart = 0, niEnd = 0;
int bitStart = 0, bitEnd = 0;
int nl, nlMiddle;
int nbox;
BoxPtr pbox;
MROP_DECLARE()
if (!(planemask & 1))
return;
if (rop != GXcopy)
MROP_INITIALIZE (rop, planemask);
cfbGetByteWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
mfbGetPixelWidthAndPointer (pDstDrawable, widthDst, pdstBase)
bitPos = ffs (bitPlane) - 1;
nbox = REGION_NUM_RECTS(prgnDst);
pbox = REGION_RECTS(prgnDst);
while (nbox--)
{
dstx = pbox->x1;
dsty = pbox->y1;
srcx = pptSrc->x;
srcy = pptSrc->y;
width = pbox->x2 - pbox->x1;
height = pbox->y2 - pbox->y1;
pbox++;
pptSrc++;
psrcLine = psrcBase + srcy * widthSrc + srcx;
pdstLine = mfbScanline(pdstBase, dstx, dsty, widthDst);
dstx &= MFB_PIM;
if (dstx + width <= MFB_PPW)
{
maskpartialbits(dstx, width, startmask);
nlMiddle = 0;
endmask = 0;
}
else
{
maskbits (dstx, width, startmask, endmask, nlMiddle);
}
if (startmask)
{
niStart = min(MFB_PPW - dstx, width);
bitStart = LeftMost;
StepBit (bitStart, dstx);
}
if (endmask)
{
niEnd = (dstx + width) & MFB_PIM;
bitEnd = LeftMost;
}
if (rop == GXcopy)
{
while (height--)
{
psrc = psrcLine;
pdst = pdstLine;
psrcLine += widthSrc;
mfbScanlineInc(pdstLine, widthDst);
if (startmask)
{
i = niStart;
curBit = bitStart;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = (*pdst & ~startmask) | bits;
pdst++;
}
nl = nlMiddle;
while (nl--)
{
i = MFB_PPW;
curBit = LeftMost;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst++ = bits;
}
if (endmask)
{
i = niEnd;
curBit = bitEnd;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = (*pdst & ~endmask) | bits;
}
}
}
else
{
while (height--)
{
psrc = psrcLine;
pdst = pdstLine;
psrcLine += widthSrc;
mfbScanlineInc(pdstLine, widthDst);
if (startmask)
{
i = niStart;
curBit = bitStart;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = MROP_MASK(bits, *pdst, startmask);
pdst++;
}
nl = nlMiddle;
while (nl--)
{
i = MFB_PPW;
curBit = LeftMost;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = MROP_SOLID(bits, *pdst);
pdst++;
}
if (endmask)
{
i = niEnd;
curBit = bitEnd;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = MROP_MASK (bits, *pdst, endmask);
}
}
}
}
}
#else /* PSZ == 8 */
#define mfbmaskbits(x, w, startmask, endmask, nlw) \
startmask = mfbGetstarttab((x)&0x1f); \
endmask = mfbGetendtab(((x)+(w)) & 0x1f); \
if (startmask) \
nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
else \
nlw = (w) >> 5;
#define mfbmaskpartialbits(x, w, mask) \
mask = mfbGetpartmasks((x)&0x1f,(w)&0x1f);
#define LeftMost 0
#define StepBit(bit, inc) ((bit) += (inc))
#if PSZ == 24
#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
bits = 0; \
while (nBits--) \
{ \
if (bitPos < 8) \
{ \
bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
psrc += 2; \
} \
else if (bitPos < 16) \
{ \
psrc++; \
bits |= ((*psrc++ >> (bitPos - 8)) & 1) << curBit; \
psrc++; \
} \
else \
{ \
psrc += 2; \
bits |= ((*psrc++ >> (bitPos - 16)) & 1) << curBit; \
} \
StepBit (curBit, 1); \
} \
}
#else
#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
bits = 0; \
while (nBits--) \
{ \
bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
StepBit (curBit, 1); \
} \
}
#endif
void
#if PSZ == 16
cfbCopyPlane16to1
#endif
#if PSZ == 24
cfbCopyPlane24to1
#endif
#if PSZ == 32
cfbCopyPlane32to1
#endif
(
DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
int rop,
RegionPtr prgnDst,
DDXPointPtr pptSrc,
unsigned long planemask,
unsigned long bitPlane)
{
int srcx, srcy, dstx, dsty, width, height;
CfbBits *psrcBase;
CfbBits *pdstBase;
int widthSrc, widthDst;
#if PSZ == 16
unsigned short *psrcLine;
register unsigned short *psrc;
#endif
#if PSZ == 24
unsigned char *psrcLine;
register unsigned char *psrc;
#endif
#if PSZ == 32
unsigned int *psrcLine;
register unsigned int *psrc;
#endif
unsigned int *pdstLine;
register unsigned int *pdst;
register int i;
register int curBit;
register int bitPos;
register unsigned int bits;
unsigned int startmask = 0, endmask = 0;
int niStart = 0, niEnd = 0;
int bitStart = 0, bitEnd = 0;
int nl, nlMiddle;
int nbox;
BoxPtr pbox;
int result;
if (!(planemask & 1))
return;
/* must explicitly ask for "int" widths, as code below expects it */
/* on some machines (Alpha), "long" and "int" are not the same size */
cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits)
cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits)
#if PSZ == 16
widthSrc <<= 1;
#endif
#if PSZ == 24
widthSrc <<= 2;
#endif
bitPos = ffs (bitPlane) - 1;
nbox = REGION_NUM_RECTS(prgnDst);
pbox = REGION_RECTS(prgnDst);
while (nbox--)
{
dstx = pbox->x1;
dsty = pbox->y1;
srcx = pptSrc->x;
srcy = pptSrc->y;
width = pbox->x2 - pbox->x1;
height = pbox->y2 - pbox->y1;
pbox++;
pptSrc++;
#if PSZ == 16
psrcLine = (unsigned short *)psrcBase + srcy * widthSrc + srcx;
#endif
#if PSZ == 24
psrcLine = (unsigned char *)psrcBase + srcy * widthSrc + srcx * 3;
#endif
#if PSZ == 32
psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + srcx;
#endif
pdstLine = (unsigned int *)pdstBase + dsty * widthDst + (dstx >> 5);
if (dstx + width <= 32)
{
mfbmaskpartialbits(dstx, width, startmask);
nlMiddle = 0;
endmask = 0;
}
else
{
mfbmaskbits (dstx, width, startmask, endmask, nlMiddle);
}
if (startmask)
{
niStart = 32 - (dstx & 0x1f);
bitStart = LeftMost;
StepBit (bitStart, (dstx & 0x1f));
}
if (endmask)
{
niEnd = (dstx + width) & 0x1f;
bitEnd = LeftMost;
}
if (rop == GXcopy)
{
while (height--)
{
psrc = psrcLine;
pdst = pdstLine;
psrcLine += widthSrc;
pdstLine += widthDst;
if (startmask)
{
i = niStart;
curBit = bitStart;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = (*pdst & ~startmask) | bits;
pdst++;
}
nl = nlMiddle;
while (nl--)
{
i = 32;
curBit = LeftMost;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst++ = bits;
}
if (endmask)
{
i = niEnd;
curBit = bitEnd;
GetBits (psrc, i, curBit, bitPos, bits);
*pdst = (*pdst & ~endmask) | bits;
}
}
}
else
{
while (height--)
{
psrc = psrcLine;
pdst = pdstLine;
psrcLine += widthSrc;
pdstLine += widthDst;
if (startmask)
{
i = niStart;
curBit = bitStart;
GetBits (psrc, i, curBit, bitPos, bits);
DoRop (result, rop, bits, *pdst);
*pdst = (*pdst & ~startmask) |
(result & startmask);
pdst++;
}
nl = nlMiddle;
while (nl--)
{
i = 32;
curBit = LeftMost;
GetBits (psrc, i, curBit, bitPos, bits);
DoRop (result, rop, bits, *pdst);
*pdst = result;
++pdst;
}
if (endmask)
{
i = niEnd;
curBit = bitEnd;
GetBits (psrc, i, curBit, bitPos, bits);
DoRop (result, rop, bits, *pdst);
*pdst = (*pdst & ~endmask) |
(result & endmask);
}
}
}
}
}
#endif /* PSZ == 8 */

View file

@ -1,374 +0,0 @@
/************************************************************
Copyright 1989, 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.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <limits.h>
#include <X11/X.h>
#include <X11/Xprotostr.h>
#include "regionstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "mifillarc.h"
#include "cfbrrop.h"
#include "mi.h"
/* gcc 1.35 is stupid */
#if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020)
#define STUPID volatile
#else
#define STUPID
#endif
static void
RROP_NAME(cfbFillEllipseSolid)(
DrawablePtr pDraw,
GCPtr pGC,
xArc *arc)
{
STUPID int x, y, e;
STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg;
miFillArcRec info;
#if PSZ == 24
unsigned char *addrlt, *addrlb;
#else
CfbBits *addrlt, *addrlb;
#endif
register CfbBits *addrl;
register int n;
int nlwidth;
RROP_DECLARE
register int xpos;
register int slw;
CfbBits startmask, endmask;
int nlmiddle;
#if PSZ == 24
register int pidx;
int xpos3;
#endif
#if PSZ == 24
cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
#else
cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
#endif
RROP_FETCH_GC(pGC);
miFillArcSetup(arc, &info);
MIFILLARCSETUP();
xorg += pDraw->x;
yorg += pDraw->y;
addrlb = addrlt;
addrlt += nlwidth * (yorg - y);
addrlb += nlwidth * (yorg + y + dy);
while (y)
{
addrlt += nlwidth;
addrlb -= nlwidth;
MIFILLARCSTEP(slw);
if (!slw)
continue;
xpos = xorg - x;
#if PSZ == 24
xpos3 = (xpos * 3) & ~0x03;
addrl = (CfbBits *)((char *)addrlt + xpos3);
if (slw == 1){
RROP_SOLID24(addrl, xpos);
if (miFillArcLower(slw)){
addrl = (CfbBits *)((char *)addrlb + xpos3);
RROP_SOLID24(addrl, xpos);
}
continue;
}
maskbits(xpos, slw, startmask, endmask, nlmiddle);
xpos &= 3;
pidx = xpos;
if (startmask){
RROP_SOLID_MASK(addrl, startmask, pidx-1);
addrl++;
if (pidx == 3)
pidx = 0;
}
n = nlmiddle;
while (--n >= 0){
RROP_SOLID(addrl, pidx);
addrl++;
if (++pidx == 3)
pidx = 0;
}
if (endmask)
RROP_SOLID_MASK(addrl, endmask, pidx);
if (!miFillArcLower(slw))
continue;
addrl = (CfbBits *)((char *)addrlb + xpos3);
pidx = xpos;
if (startmask){
RROP_SOLID_MASK(addrl, startmask, pidx-1);
addrl++;
if (pidx == 3)
pidx = 0;
}
n = nlmiddle;
while (--n >= 0){
RROP_SOLID(addrl, pidx);
addrl++;
if (++pidx == 3)
pidx = 0;
}
if (endmask)
RROP_SOLID_MASK(addrl, endmask, pidx);
#else /* PSZ == 24 */
addrl = addrlt + (xpos >> PWSH);
if (((xpos & PIM) + slw) <= PPW)
{
maskpartialbits(xpos, slw, startmask);
RROP_SOLID_MASK(addrl,startmask);
if (miFillArcLower(slw))
{
addrl = addrlb + (xpos >> PWSH);
RROP_SOLID_MASK(addrl, startmask);
}
continue;
}
maskbits(xpos, slw, startmask, endmask, nlmiddle);
if (startmask)
{
RROP_SOLID_MASK(addrl, startmask);
addrl++;
}
n = nlmiddle;
RROP_SPAN(addrl,n)
if (endmask)
RROP_SOLID_MASK(addrl, endmask);
if (!miFillArcLower(slw))
continue;
addrl = addrlb + (xpos >> PWSH);
if (startmask)
{
RROP_SOLID_MASK(addrl, startmask);
addrl++;
}
n = nlmiddle;
RROP_SPAN(addrl, n);
if (endmask)
RROP_SOLID_MASK(addrl, endmask);
#endif /* PSZ == 24 */
}
RROP_UNDECLARE
}
#if PSZ == 24
#define FILLSPAN(xl,xr,addr) \
if (xr >= xl){ \
n = xr - xl + 1; \
addrl = (CfbBits *)((char *)addr + ((xl * 3) & ~0x03)); \
if (n <= 1){ \
if (n) \
RROP_SOLID24(addrl, xl); \
} else { \
maskbits(xl, n, startmask, endmask, n); \
pidx = xl & 3; \
if (startmask){ \
RROP_SOLID_MASK(addrl, startmask, pidx-1); \
addrl++; \
if (pidx == 3) \
pidx = 0; \
} \
while (--n >= 0){ \
RROP_SOLID(addrl, pidx); \
addrl++; \
if (++pidx == 3) \
pidx = 0; \
} \
if (endmask) \
RROP_SOLID_MASK(addrl, endmask, pidx); \
} \
}
#else /* PSZ == 24 */
#define FILLSPAN(xl,xr,addr) \
if (xr >= xl) \
{ \
n = xr - xl + 1; \
addrl = addr + (xl >> PWSH); \
if (((xl & PIM) + n) <= PPW) \
{ \
maskpartialbits(xl, n, startmask); \
RROP_SOLID_MASK(addrl, startmask); \
} \
else \
{ \
maskbits(xl, n, startmask, endmask, n); \
if (startmask) \
{ \
RROP_SOLID_MASK(addrl, startmask); \
addrl++; \
} \
while (n--) \
{ \
RROP_SOLID(addrl); \
++addrl; \
} \
if (endmask) \
RROP_SOLID_MASK(addrl, endmask); \
} \
}
#endif /* PSZ == 24 */
#define FILLSLICESPANS(flip,addr) \
if (!flip) \
{ \
FILLSPAN(xl, xr, addr); \
} \
else \
{ \
xc = xorg - x; \
FILLSPAN(xc, xr, addr); \
xc += slw - 1; \
FILLSPAN(xl, xc, addr); \
}
static void
RROP_NAME(cfbFillArcSliceSolid)(
DrawablePtr pDraw,
GCPtr pGC,
xArc *arc)
{
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
register int x, y, e;
miFillArcRec info;
miArcSliceRec slice;
int xl, xr, xc;
#if PSZ == 24
unsigned char *addrlt, *addrlb;
#else
CfbBits *addrlt, *addrlb;
#endif
register CfbBits *addrl;
register int n;
int nlwidth;
RROP_DECLARE
CfbBits startmask, endmask;
#if PSZ == 24
register int pidx;
#endif /* PSZ == 24 */
#if PSZ == 24
cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
#else
cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
#endif
RROP_FETCH_GC(pGC);
miFillArcSetup(arc, &info);
miFillArcSliceSetup(arc, &slice, pGC);
MIFILLARCSETUP();
xorg += pDraw->x;
yorg += pDraw->y;
addrlb = addrlt;
addrlt += nlwidth * (yorg - y);
addrlb += nlwidth * (yorg + y + dy);
slice.edge1.x += pDraw->x;
slice.edge2.x += pDraw->x;
while (y > 0)
{
addrlt += nlwidth;
addrlb -= nlwidth;
MIFILLARCSTEP(slw);
MIARCSLICESTEP(slice.edge1);
MIARCSLICESTEP(slice.edge2);
if (miFillSliceUpper(slice))
{
MIARCSLICEUPPER(xl, xr, slice, slw);
FILLSLICESPANS(slice.flip_top, addrlt);
}
if (miFillSliceLower(slice))
{
MIARCSLICELOWER(xl, xr, slice, slw);
FILLSLICESPANS(slice.flip_bot, addrlb);
}
}
RROP_UNDECLARE
}
void
RROP_NAME(cfbPolyFillArcSolid) (pDraw, pGC, narcs, parcs)
DrawablePtr pDraw;
GCPtr pGC;
int narcs;
xArc *parcs;
{
register xArc *arc;
register int i;
int x2, y2;
BoxRec box;
RegionPtr cclip;
cclip = cfbGetCompositeClip(pGC);
for (arc = parcs, i = narcs; --i >= 0; arc++)
{
if (miFillArcEmpty(arc))
continue;
if (miCanFillArc(arc))
{
box.x1 = arc->x + pDraw->x;
box.y1 = arc->y + pDraw->y;
/*
* Because box.x2 and box.y2 get truncated to 16 bits, and the
* RECT_IN_REGION test treats the resulting number as a signed
* integer, the RECT_IN_REGION test alone can go the wrong way.
* This can result in a server crash because the rendering
* routines in this file deal directly with cpu addresses
* of pixels to be stored, and do not clip or otherwise check
* that all such addresses are within their respective pixmaps.
* So we only allow the RECT_IN_REGION test to be used for
* values that can be expressed correctly in a signed short.
*/
x2 = box.x1 + (int)arc->width + 1;
box.x2 = x2;
y2 = box.y1 + (int)arc->height + 1;
box.y2 = y2;
if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
(RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
{
if ((arc->angle2 >= FULLCIRCLE) ||
(arc->angle2 <= -FULLCIRCLE))
RROP_NAME(cfbFillEllipseSolid)(pDraw, pGC, arc);
else
RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc);
continue;
}
}
miPolyFillArc(pDraw, pGC, 1, arc);
}
}

View file

@ -1,305 +0,0 @@
/*
* Fill rectangles.
*/
/*
Copyright 1989, 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "gcstruct.h"
#include "window.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "mi.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "mergerop.h"
void
cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot)
DrawablePtr pDrawable;
int n;
BoxPtr rects;
PixmapPtr tile;
int xrot, yrot;
{
#if PSZ == 24
if (tile->drawable.width & 3)
#else
if (tile->drawable.width & PIM)
#endif
cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
else
cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
}
void
cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox)
DrawablePtr pDrawable;
GCPtr pGC;
int nBox;
BoxPtr pBox;
{
int xrot, yrot;
void (*fill)(DrawablePtr, int, BoxPtr, PixmapPtr, int, int, int, unsigned long);
xrot = pDrawable->x + pGC->patOrg.x;
yrot = pDrawable->y + pGC->patOrg.y;
#if PSZ == 24
if (pGC->tile.pixmap->drawable.width & 3)
#else
if (pGC->tile.pixmap->drawable.width & PIM)
#endif
{
fill = cfbFillBoxTileOddGeneral;
if ((pGC->planemask & PMSK) == PMSK)
{
if (pGC->alu == GXcopy)
fill = cfbFillBoxTileOddCopy;
}
}
else
{
fill = cfbFillBoxTile32sGeneral;
if ((pGC->planemask & PMSK) == PMSK)
{
if (pGC->alu == GXcopy)
fill = cfbFillBoxTile32sCopy;
}
}
(*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
}
#define NUM_STACK_RECTS 1024
void
cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
DrawablePtr pDrawable;
register GCPtr pGC;
int nrectFill; /* number of rectangles to fill */
xRectangle *prectInit; /* Pointer to first rectangle to fill */
{
xRectangle *prect;
RegionPtr prgnClip;
register BoxPtr pbox;
register BoxPtr pboxClipped;
BoxPtr pboxClippedBase;
BoxPtr pextent;
BoxRec stackRects[NUM_STACK_RECTS];
cfbPrivGC *priv;
int numRects;
void (*BoxFill)(DrawablePtr, GCPtr, int, BoxPtr);
int n;
int xorg, yorg;
#if PSZ != 8
if ((pGC->fillStyle == FillStippled) ||
(pGC->fillStyle == FillOpaqueStippled)) {
miPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
return;
}
#endif
priv = cfbGetGCPrivate(pGC);
prgnClip = pGC->pCompositeClip;
BoxFill = 0;
switch (pGC->fillStyle)
{
case FillSolid:
switch (priv->rop) {
case GXcopy:
BoxFill = cfbFillRectSolidCopy;
break;
case GXxor:
BoxFill = cfbFillRectSolidXor;
break;
default:
BoxFill = cfbFillRectSolidGeneral;
break;
}
break;
case FillTiled:
if (!pGC->pRotatedPixmap)
BoxFill = cfbFillRectTileOdd;
else
{
if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
BoxFill = cfbFillRectTile32Copy;
else
BoxFill = cfbFillRectTile32General;
}
break;
#if PSZ == 8
case FillStippled:
if (!pGC->pRotatedPixmap)
BoxFill = cfb8FillRectStippledUnnatural;
else
BoxFill = cfb8FillRectTransparentStippled32;
break;
case FillOpaqueStippled:
if (!pGC->pRotatedPixmap)
BoxFill = cfb8FillRectStippledUnnatural;
else
BoxFill = cfb8FillRectOpaqueStippled32;
break;
#endif
}
prect = prectInit;
xorg = pDrawable->x;
yorg = pDrawable->y;
if (xorg || yorg)
{
prect = prectInit;
n = nrectFill;
while(n--)
{
prect->x += xorg;
prect->y += yorg;
prect++;
}
}
prect = prectInit;
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
if (numRects > NUM_STACK_RECTS)
{
pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
if (!pboxClippedBase)
return;
}
else
pboxClippedBase = stackRects;
pboxClipped = pboxClippedBase;
if (REGION_NUM_RECTS(prgnClip) == 1)
{
int x1, y1, x2, y2, bx2, by2;
pextent = REGION_RECTS(prgnClip);
x1 = pextent->x1;
y1 = pextent->y1;
x2 = pextent->x2;
y2 = pextent->y2;
while (nrectFill--)
{
if ((pboxClipped->x1 = prect->x) < x1)
pboxClipped->x1 = x1;
if ((pboxClipped->y1 = prect->y) < y1)
pboxClipped->y1 = y1;
bx2 = (int) prect->x + (int) prect->width;
if (bx2 > x2)
bx2 = x2;
pboxClipped->x2 = bx2;
by2 = (int) prect->y + (int) prect->height;
if (by2 > y2)
by2 = y2;
pboxClipped->y2 = by2;
prect++;
if ((pboxClipped->x1 < pboxClipped->x2) &&
(pboxClipped->y1 < pboxClipped->y2))
{
pboxClipped++;
}
}
}
else
{
int x1, y1, x2, y2, bx2, by2;
pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
x1 = pextent->x1;
y1 = pextent->y1;
x2 = pextent->x2;
y2 = pextent->y2;
while (nrectFill--)
{
BoxRec box;
if ((box.x1 = prect->x) < x1)
box.x1 = x1;
if ((box.y1 = prect->y) < y1)
box.y1 = y1;
bx2 = (int) prect->x + (int) prect->width;
if (bx2 > x2)
bx2 = x2;
box.x2 = bx2;
by2 = (int) prect->y + (int) prect->height;
if (by2 > y2)
by2 = y2;
box.y2 = by2;
prect++;
if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
continue;
n = REGION_NUM_RECTS (prgnClip);
pbox = REGION_RECTS(prgnClip);
/* clip the rectangle to each box in the clip region
this is logically equivalent to calling Intersect()
*/
while(n--)
{
pboxClipped->x1 = max(box.x1, pbox->x1);
pboxClipped->y1 = max(box.y1, pbox->y1);
pboxClipped->x2 = min(box.x2, pbox->x2);
pboxClipped->y2 = min(box.y2, pbox->y2);
pbox++;
/* see if clipping left anything */
if(pboxClipped->x1 < pboxClipped->x2 &&
pboxClipped->y1 < pboxClipped->y2)
{
pboxClipped++;
}
}
}
}
if (pboxClipped != pboxClippedBase)
(*BoxFill) (pDrawable, pGC,
pboxClipped-pboxClippedBase, pboxClippedBase);
if (pboxClippedBase != stackRects)
xfree(pboxClippedBase);
}

File diff suppressed because it is too large Load diff

View file

@ -1,799 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "cfb.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "region.h"
#include "mistruct.h"
#include "mibstore.h"
#include "migc.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
#if PSZ == 8
# define useTEGlyphBlt cfbTEGlyphBlt8
#else
# ifdef WriteBitGroup
# define useTEGlyphBlt cfbImageGlyphBlt8
# else
# define useTEGlyphBlt cfbTEGlyphBlt
# endif
#endif
#ifdef WriteBitGroup
# define useImageGlyphBlt cfbImageGlyphBlt8
# define usePolyGlyphBlt cfbPolyGlyphBlt8
#else
# define useImageGlyphBlt miImageGlyphBlt
# define usePolyGlyphBlt miPolyGlyphBlt
#endif
static void cfbUnPushPixels (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
#ifdef FOUR_BIT_CODE
# define usePushPixels cfbPushPixels8
#else
# define usePushPixels cfbUnPushPixels
#endif
#ifdef PIXEL_ADDR
# define ZeroPolyArc cfbZeroPolyArcSS8Copy
#else
# define ZeroPolyArc miZeroPolyArc
#endif
GCFuncs cfbGCFuncs = {
cfbValidateGC,
miChangeGC,
miCopyGC,
miDestroyGC,
miChangeClip,
miDestroyClip,
miCopyClip,
};
GCOps cfbTEOps1Rect = {
cfbSolidSpansCopy,
cfbSetSpans,
cfbPutImage,
cfbCopyArea,
cfbCopyPlane,
cfbPolyPoint,
#ifdef PIXEL_ADDR
cfb8LineSS1Rect,
cfb8SegmentSS1Rect,
#else
cfbLineSS,
cfbSegmentSS,
#endif
miPolyRectangle,
ZeroPolyArc,
cfbFillPoly1RectCopy,
cfbPolyFillRect,
cfbPolyFillArcSolidCopy,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
useTEGlyphBlt,
usePolyGlyphBlt,
usePushPixels
};
GCOps cfbNonTEOps1Rect = {
cfbSolidSpansCopy,
cfbSetSpans,
cfbPutImage,
cfbCopyArea,
cfbCopyPlane,
cfbPolyPoint,
#ifdef PIXEL_ADDR
cfb8LineSS1Rect,
cfb8SegmentSS1Rect,
#else
cfbLineSS,
cfbSegmentSS,
#endif
miPolyRectangle,
ZeroPolyArc,
cfbFillPoly1RectCopy,
cfbPolyFillRect,
cfbPolyFillArcSolidCopy,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
useImageGlyphBlt,
usePolyGlyphBlt,
usePushPixels
};
GCOps cfbTEOps = {
cfbSolidSpansCopy,
cfbSetSpans,
cfbPutImage,
cfbCopyArea,
cfbCopyPlane,
cfbPolyPoint,
cfbLineSS,
cfbSegmentSS,
miPolyRectangle,
ZeroPolyArc,
miFillPolygon,
cfbPolyFillRect,
cfbPolyFillArcSolidCopy,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
useTEGlyphBlt,
usePolyGlyphBlt,
usePushPixels
};
GCOps cfbNonTEOps = {
cfbSolidSpansCopy,
cfbSetSpans,
cfbPutImage,
cfbCopyArea,
cfbCopyPlane,
cfbPolyPoint,
cfbLineSS,
cfbSegmentSS,
miPolyRectangle,
#ifdef PIXEL_ADDR
cfbZeroPolyArcSS8Copy,
#else
miZeroPolyArc,
#endif
miFillPolygon,
cfbPolyFillRect,
cfbPolyFillArcSolidCopy,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
useImageGlyphBlt,
usePolyGlyphBlt,
usePushPixels
};
GCOps *
cfbMatchCommon (pGC, devPriv)
GCPtr pGC;
cfbPrivGCPtr devPriv;
{
if (pGC->lineWidth != 0)
return 0;
if (pGC->lineStyle != LineSolid)
return 0;
if (pGC->fillStyle != FillSolid)
return 0;
if (devPriv->rop != GXcopy)
return 0;
if (pGC->font &&
FONTMAXBOUNDS(pGC->font,rightSideBearing) -
FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
{
if (TERMINALFONT(pGC->font)
#ifdef FOUR_BIT_CODE
&& FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
#endif
)
#ifdef NO_ONE_RECT
return &cfbTEOps1Rect;
#else
if (devPriv->oneRect)
return &cfbTEOps1Rect;
else
return &cfbTEOps;
#endif
else
#ifdef NO_ONE_RECT
return &cfbNonTEOps1Rect;
#else
if (devPriv->oneRect)
return &cfbNonTEOps1Rect;
else
return &cfbNonTEOps;
#endif
}
return 0;
}
Bool
cfbCreateGC(pGC)
register GCPtr pGC;
{
cfbPrivGC *pPriv;
if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
return (mfbCreateGC(pGC));
pGC->clientClip = NULL;
pGC->clientClipType = CT_NONE;
if (cfbNonTEOps.PushPixels == cfbUnPushPixels)
{
cfbTEOps1Rect.PushPixels = mfbPushPixelsWeak();
cfbNonTEOps1Rect.PushPixels = mfbPushPixelsWeak();
cfbTEOps.PushPixels = mfbPushPixelsWeak();
cfbNonTEOps.PushPixels = mfbPushPixelsWeak();
}
/*
* some of the output primitives aren't really necessary, since they
* will be filled in ValidateGC because of dix/CreateGC() setting all
* the change bits. Others are necessary because although they depend
* on being a color frame buffer, they don't change
*/
pGC->ops = &cfbNonTEOps;
pGC->funcs = &cfbGCFuncs;
/* cfb wants to translate before scan conversion */
pGC->miTranslate = 1;
pPriv = cfbGetGCPrivate(pGC);
pPriv->rop = pGC->alu;
pPriv->oneRect = FALSE;
pGC->fExpose = TRUE;
pGC->freeCompClip = FALSE;
pGC->pRotatedPixmap = (PixmapPtr) NULL;
return TRUE;
}
/* Clipping conventions
if the drawable is a window
CT_REGION ==> pCompositeClip really is the composite
CT_other ==> pCompositeClip is the window clip region
if the drawable is a pixmap
CT_REGION ==> pCompositeClip is the translated client region
clipped to the pixmap boundary
CT_other ==> pCompositeClip is the pixmap bounding box
*/
void
cfbValidateGC(pGC, changes, pDrawable)
register GCPtr pGC;
unsigned long changes;
DrawablePtr pDrawable;
{
int mask; /* stateChanges */
int index; /* used for stepping through bitfields */
int new_rrop;
int new_line, new_text, new_fillspans, new_fillarea;
int new_rotate;
int xrot, yrot;
/* flags for changing the proc vector */
cfbPrivGCPtr devPriv;
int oneRect;
new_rotate = pGC->lastWinOrg.x != pDrawable->x ||
pGC->lastWinOrg.y != pDrawable->y;
pGC->lastWinOrg.x = pDrawable->x;
pGC->lastWinOrg.y = pDrawable->y;
devPriv = cfbGetGCPrivate(pGC);
new_rrop = FALSE;
new_line = FALSE;
new_text = FALSE;
new_fillspans = FALSE;
new_fillarea = FALSE;
/*
* if the client clip is different or moved OR the subwindowMode has
* changed OR the window's clip has changed since the last validation
* we need to recompute the composite clip
*/
if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
)
{
miComputeCompositeClip (pGC, pDrawable);
#ifdef NO_ONE_RECT
devPriv->oneRect = FALSE;
#else
oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
if (oneRect != devPriv->oneRect)
new_line = TRUE;
devPriv->oneRect = oneRect;
#endif
}
mask = changes;
while (mask) {
index = lowbit (mask);
mask &= ~index;
/*
* this switch acculmulates a list of which procedures might have
* to change due to changes in the GC. in some cases (e.g.
* changing one 16 bit tile for another) we might not really need
* a change, but the code is being paranoid. this sort of batching
* wins if, for example, the alu and the font have been changed,
* or any other pair of items that both change the same thing.
*/
switch (index) {
case GCFunction:
case GCForeground:
new_rrop = TRUE;
break;
case GCPlaneMask:
new_rrop = TRUE;
new_text = TRUE;
break;
case GCBackground:
break;
case GCLineStyle:
case GCLineWidth:
new_line = TRUE;
break;
case GCJoinStyle:
case GCCapStyle:
break;
case GCFillStyle:
new_text = TRUE;
new_fillspans = TRUE;
new_line = TRUE;
new_fillarea = TRUE;
break;
case GCFillRule:
break;
case GCTile:
new_fillspans = TRUE;
new_fillarea = TRUE;
break;
case GCStipple:
if (pGC->stipple)
{
int width = pGC->stipple->drawable.width;
PixmapPtr nstipple;
if ((width <= PGSZ) && !(width & (width - 1)) &&
(nstipple = cfbCopyPixmap(pGC->stipple)))
{
cfbPadPixmap(nstipple);
(*pGC->pScreen->DestroyPixmap)(pGC->stipple);
pGC->stipple = nstipple;
}
}
new_fillspans = TRUE;
new_fillarea = TRUE;
break;
case GCTileStipXOrigin:
new_rotate = TRUE;
break;
case GCTileStipYOrigin:
new_rotate = TRUE;
break;
case GCFont:
new_text = TRUE;
break;
case GCSubwindowMode:
break;
case GCGraphicsExposures:
break;
case GCClipXOrigin:
break;
case GCClipYOrigin:
break;
case GCClipMask:
break;
case GCDashOffset:
break;
case GCDashList:
break;
case GCArcMode:
break;
default:
break;
}
}
/*
* If the drawable has changed, ensure suitable
* entries are in the proc vector.
*/
if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) {
new_fillspans = TRUE; /* deal with FillSpans later */
}
if (new_rotate || new_fillspans)
{
Bool new_pix = FALSE;
xrot = pGC->patOrg.x + pDrawable->x;
yrot = pGC->patOrg.y + pDrawable->y;
switch (pGC->fillStyle)
{
case FillTiled:
if (!pGC->tileIsPixel)
{
int width = pGC->tile.pixmap->drawable.width * PSZ;
if ((width <= PGSZ) && !(width & (width - 1)))
{
cfbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
xrot, yrot);
new_pix = TRUE;
}
}
break;
#ifdef FOUR_BIT_CODE
case FillStippled:
case FillOpaqueStippled:
{
int width = pGC->stipple->drawable.width;
if ((width <= PGSZ) && !(width & (width - 1)))
{
mfbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
xrot, yrot);
new_pix = TRUE;
}
}
break;
#endif
}
if (!new_pix && pGC->pRotatedPixmap)
{
(*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
pGC->pRotatedPixmap = (PixmapPtr) NULL;
}
}
if (new_rrop)
{
int old_rrop;
old_rrop = devPriv->rop;
devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
pGC->planemask,
&devPriv->and, &devPriv->xor);
if (old_rrop == devPriv->rop)
new_rrop = FALSE;
else
{
#ifdef PIXEL_ADDR
new_line = TRUE;
#endif
#ifdef WriteBitGroup
new_text = TRUE;
#endif
new_fillspans = TRUE;
new_fillarea = TRUE;
}
}
if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
{
GCOps *newops;
if ((newops = cfbMatchCommon (pGC, devPriv)))
{
if (pGC->ops->devPrivate.val)
miDestroyGCOps (pGC->ops);
pGC->ops = newops;
new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
}
else
{
if (!pGC->ops->devPrivate.val)
{
pGC->ops = miCreateGCOps (pGC->ops);
pGC->ops->devPrivate.val = 1;
}
}
}
/* deal with the changes we've collected */
if (new_line)
{
pGC->ops->FillPolygon = miFillPolygon;
#ifdef NO_ONE_RECT
if (pGC->fillStyle == FillSolid)
{
switch (devPriv->rop) {
case GXcopy:
pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
break;
default:
pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
break;
}
}
#else
if (devPriv->oneRect && pGC->fillStyle == FillSolid)
{
switch (devPriv->rop) {
case GXcopy:
pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
break;
default:
pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
break;
}
}
#endif
if (pGC->lineWidth == 0)
{
#ifdef PIXEL_ADDR
if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
{
switch (devPriv->rop)
{
case GXxor:
pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
break;
case GXcopy:
pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
break;
default:
pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
break;
}
}
else
#endif
pGC->ops->PolyArc = miZeroPolyArc;
}
else
pGC->ops->PolyArc = miPolyArc;
pGC->ops->PolySegment = miPolySegment;
switch (pGC->lineStyle)
{
case LineSolid:
if(pGC->lineWidth == 0)
{
if (pGC->fillStyle == FillSolid)
{
#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
if (devPriv->oneRect &&
((pDrawable->x >= pGC->pScreen->width - 32768) &&
(pDrawable->y >= pGC->pScreen->height - 32768)))
{
pGC->ops->Polylines = cfb8LineSS1Rect;
pGC->ops->PolySegment = cfb8SegmentSS1Rect;
} else
#endif
#ifdef NO_ONE_RECT
{
pGC->ops->Polylines = cfb8LineSS1Rect;
pGC->ops->PolySegment = cfb8SegmentSS1Rect;
}
#else
{
pGC->ops->Polylines = cfbLineSS;
pGC->ops->PolySegment = cfbSegmentSS;
}
#endif
}
else
pGC->ops->Polylines = miZeroLine;
}
else
pGC->ops->Polylines = miWideLine;
break;
case LineOnOffDash:
case LineDoubleDash:
if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
{
pGC->ops->Polylines = cfbLineSD;
pGC->ops->PolySegment = cfbSegmentSD;
} else
pGC->ops->Polylines = miWideDash;
break;
}
}
if (new_text && (pGC->font))
{
if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
FONTMINBOUNDS(pGC->font,characterWidth) < 0)
{
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
}
else
{
#ifdef WriteBitGroup
if (pGC->fillStyle == FillSolid)
{
if (devPriv->rop == GXcopy)
pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
else
#ifdef FOUR_BIT_CODE
pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
#else
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
#endif
}
else
#endif
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
/* special case ImageGlyphBlt for terminal emulator fonts */
#if !defined(WriteBitGroup) || PSZ == 8
if (TERMINALFONT(pGC->font) &&
(pGC->planemask & PMSK) == PMSK
#ifdef FOUR_BIT_CODE
&& FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
#endif
)
{
pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
}
else
#endif
{
#ifdef WriteBitGroup
if (devPriv->rop == GXcopy &&
pGC->fillStyle == FillSolid &&
(pGC->planemask & PMSK) == PMSK)
pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
else
#endif
pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
}
}
}
if (new_fillspans) {
switch (pGC->fillStyle) {
case FillSolid:
switch (devPriv->rop) {
case GXcopy:
pGC->ops->FillSpans = cfbSolidSpansCopy;
break;
case GXxor:
pGC->ops->FillSpans = cfbSolidSpansXor;
break;
default:
pGC->ops->FillSpans = cfbSolidSpansGeneral;
break;
}
break;
case FillTiled:
if (pGC->pRotatedPixmap)
{
if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
pGC->ops->FillSpans = cfbTile32FSCopy;
else
pGC->ops->FillSpans = cfbTile32FSGeneral;
}
else
pGC->ops->FillSpans = cfbUnnaturalTileFS;
break;
case FillStippled:
#ifdef FOUR_BIT_CODE
if (pGC->pRotatedPixmap)
pGC->ops->FillSpans = cfb8Stipple32FS;
else
#endif
pGC->ops->FillSpans = cfbUnnaturalStippleFS;
break;
case FillOpaqueStippled:
#ifdef FOUR_BIT_CODE
if (pGC->pRotatedPixmap)
pGC->ops->FillSpans = cfb8OpaqueStipple32FS;
else
#endif
pGC->ops->FillSpans = cfbUnnaturalStippleFS;
break;
default:
FatalError("cfbValidateGC: illegal fillStyle\n");
}
} /* end of new_fillspans */
if (new_fillarea) {
#ifndef FOUR_BIT_CODE
pGC->ops->PolyFillRect = miPolyFillRect;
if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
{
pGC->ops->PolyFillRect = cfbPolyFillRect;
}
#endif
#ifdef FOUR_BIT_CODE
pGC->ops->PushPixels = mfbPushPixelsWeak();
if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
pGC->ops->PushPixels = cfbPushPixels8;
#endif
pGC->ops->PolyFillArc = miPolyFillArc;
if (pGC->fillStyle == FillSolid)
{
switch (devPriv->rop)
{
case GXcopy:
pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
break;
default:
pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
break;
}
}
}
}
/*
* this is never called, it just exists to have its address
* taken in mfbCreateGC.
*/
static void
cfbUnPushPixels (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
GCPtr pGC;
PixmapPtr pBitmap;
DrawablePtr pDrawable;
int dx, dy, xOrg, yOrg;
{
return;
}

View file

@ -1,213 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "misc.h"
#include "region.h"
#include "gc.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
* and continuing for pwidth[i] bits
* Each scanline returned will be server scanline padded, i.e., it will come
* out to an integral number of words.
*/
void
cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
DrawablePtr pDrawable; /* drawable from which to get bits */
int wMax; /* largest value of all *pwidths */
register DDXPointPtr ppt; /* points to start copying from */
int *pwidth; /* list of number of bits to copy */
int nspans; /* number of scanlines to copy */
char *pchardstStart; /* where to put the bits */
{
PixelGroup *pdstStart = (PixelGroup *)pchardstStart;
register PixelGroup *pdst; /* where to put the bits */
register PixelGroup *psrc; /* where to get the bits */
register PixelGroup tmpSrc; /* scratch buffer for bits */
PixelGroup *psrcBase; /* start of src bitmap */
int widthSrc; /* width of pixmap in bytes */
register DDXPointPtr pptLast; /* one past last point to get */
int xEnd; /* last pixel to copy from */
int nl, srcBit;
int w;
PixelGroup *pdstNext;
#if PSZ == 24
register char *psrcb, *pdstb;
register int xIndex = 0;
#else
register int nstart;
#if PSZ != 32 || PPW != 1
int nend;
#endif
PixelGroup startmask, endmask;
int nlMiddle;
#endif
switch (pDrawable->bitsPerPixel) {
case 1:
mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
return;
case PSZ:
break;
default:
FatalError("cfbGetSpans: invalid depth\n");
}
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!cfbDrawableEnabled(pDrawable))
return;
cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase)
#ifdef PIXEL_ADDR
# if PSZ != 24
if ((nspans == 1) && (*pwidth == 1))
{
tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc))
+ ppt->x);
#if BITMAP_BIT_ORDER == MSBFirst
tmpSrc <<= (sizeof (CfbBits) - sizeof (PixelType)) * 8;
#endif
*pdstStart = tmpSrc;
return;
}
# endif /* PSZ != 24 */
#endif
pdst = pdstStart;
pptLast = ppt + nspans;
while(ppt < pptLast)
{
#if PSZ == 24
xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(CfbBits) / 3);
w = xEnd - ppt->x;
psrc = psrcBase + ppt->y * widthSrc;
srcBit = ppt->x;
psrcb = (char *)psrc + (ppt->x * 3);
xIndex = 0;
pdstb = (char *)pdst;
pdstNext = pdst + ((w * 3 + 3) >> 2);
#else
xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
w = xEnd - ppt->x;
psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH);
srcBit = ppt->x & PIM;
pdstNext = pdst + ((w + PPW - 1) >> PWSH);
#endif
#if PSZ == 24
if (w < 0)
FatalError("cfb24GetSpans: Internal error (w < 0)\n");
nl = w;
while (nl--){
psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03);
getbits24(psrc, tmpSrc, srcBit);
pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03);
putbits24(tmpSrc, PPW, pdst, ~((CfbBits)0), xIndex);
srcBit++;
psrcb += 3;
xIndex++;
pdstb += 3;
}
pdst = pdstNext;
#else /* PSZ == 24 */
if (srcBit + w <= PPW)
{
getbits(psrc, srcBit, w, tmpSrc);
putbits(tmpSrc, 0, w, pdst, ~((CfbBits)0));
pdst++;
}
else
{
maskbits(ppt->x, w, startmask, endmask, nlMiddle);
nstart = 0;
if (startmask)
{
nstart = PPW - srcBit;
getbits(psrc, srcBit, nstart, tmpSrc);
putbits(tmpSrc, 0, nstart, pdst, ~((CfbBits)0));
if(srcBit + nstart >= PPW)
psrc++;
}
nl = nlMiddle;
while (nl--)
{
tmpSrc = *psrc;
putbits(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0));
psrc++;
pdst++;
}
if (endmask)
{
#if PSZ != 32 || PPW != 1
nend = xEnd & PIM;
#endif
getbits(psrc, 0, nend, tmpSrc);
putbits(tmpSrc, nstart, nend, pdst, ~((CfbBits)0));
}
pdst = pdstNext;
}
#endif /* PSZ == 24 */
ppt++;
pwidth++;
}
}

View file

@ -1,477 +0,0 @@
/*
Copyright 1989, 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.
*/
/*
* Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode
* only.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "cfb.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
#define BOX_OVERLAP(box1, box2, xoffset, yoffset) \
((box1)->x1 <= ((int) (box2)->x2 + (xoffset)) && \
((int) (box2)->x1 + (xoffset)) <= (box1)->x2 && \
(box1)->y1 <= ((int) (box2)->y2 + (yoffset)) && \
((int) (box2)->y1 + (yoffset)) <= (box1)->y2)
#define BOX_CONTAINS(box1, box2, xoffset, yoffset) \
((box1)->x1 <= ((int) (box2)->x1 + (xoffset)) && \
((int) (box2)->x2 + (xoffset)) <= (box1)->x2 && \
(box1)->y1 <= ((int) (box2)->y1 + (yoffset)) && \
((int) (box2)->y2 + (yoffset)) <= (box1)->y2)
#if defined(FOUR_BIT_CODE) || defined(WriteBitGroup) && !defined(GLYPHROP)
#if GLYPHPADBYTES != 4
#define USE_LEFTBITS
#endif
#ifdef USE_LEFTBITS
typedef unsigned char *glyphPointer;
#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \
(dst) &= widthMask; \
(bits) += widthGlyph;
#define GlyphBitsS(bits,width,dst,off) GlyphBits(bits,width,dst); \
dst = BitRight (dst, off);
#else
typedef CARD32 *glyphPointer;
#define GlyphBits(bits,width,dst) dst = *bits++;
#define GlyphBitsS(bits,width,dst,off) dst = BitRight(*bits++, off);
#endif
#ifdef GLYPHROP
#define cfbPolyGlyphBlt8 cfbPolyGlyphRop8
#define cfbPolyGlyphBlt8Clipped cfbPolyGlyphRop8Clipped
#undef WriteBitGroup
#define WriteBitGroup(dst,pixel,bits) RRopBitGroup(dst,bits)
#endif
static void cfbPolyGlyphBlt8Clipped(
DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
unsigned int nglyph,
CharInfoPtr *ppci, /* array of character info */
unsigned char *pglyphBase); /* start of array of glyphs */
#if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS)
#define USE_STIPPLE_CODE
#endif
#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS)
#ifdef USE_STIPPLE_CODE
#undef USE_STIPPLE_CODE
#endif
#include "stip68kgnu.h"
#endif
#if PSZ == 24
#define DST_INC 3
#else
#define DST_INC (PGSZB >> PWSH)
#endif
/* cfbStippleStack/cfbStippleStackTE are coded in assembly language.
* They are only provided on some architecures.
*/
#ifdef USE_STIPPLE_CODE
extern void cfbStippleStack (), cfbStippleStackTE ();
#endif
void
cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GCPtr pGC;
int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
#ifndef GLYPHROP
register CfbBits pixel;
#endif
#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
register CfbBits c;
register CfbBits *dst;
#endif
register glyphPointer glyphBits;
register int xoff;
FontPtr pfont = pGC->font;
CharInfoPtr pci;
CfbBits *dstLine;
CfbBits *pdstBase;
int hTmp;
int bwidthDst;
int widthDst;
int h;
BoxRec bbox; /* for clipping */
int w;
RegionPtr clip;
BoxPtr extents;
#ifdef USE_LEFTBITS
int widthGlyph;
CfbBits widthMask;
#endif
#ifndef STIPPLE
#ifdef USE_STIPPLE_CODE
void (*stipple)();
stipple = cfbStippleStack;
if (FONTCONSTMETRICS(pfont))
stipple = cfbStippleStackTE;
#endif
#endif
x += pDrawable->x;
y += pDrawable->y;
/* compute an approximate (but covering) bounding box */
bbox.x1 = 0;
if ((ppci[0]->metrics.leftSideBearing < 0))
bbox.x1 = ppci[0]->metrics.leftSideBearing;
h = nglyph - 1;
w = ppci[h]->metrics.rightSideBearing;
while (--h >= 0)
w += ppci[h]->metrics.characterWidth;
bbox.x2 = w;
bbox.y1 = -FONTMAXBOUNDS(pfont,ascent);
bbox.y2 = FONTMAXBOUNDS(pfont,descent);
clip = cfbGetCompositeClip(pGC);
extents = &clip->extents;
if (!clip->data)
{
if (!BOX_CONTAINS(extents, &bbox, x, y))
{
if (BOX_OVERLAP (extents, &bbox, x, y))
cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y,
nglyph, ppci, pglyphBase);
return;
}
}
else
{
/* check to make sure some of the text appears on the screen */
if (!BOX_OVERLAP (extents, &bbox, x, y))
return;
bbox.x1 += x;
bbox.x2 += x;
bbox.y1 += y;
bbox.y2 += y;
switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox))
{
case rgnPART:
cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y,
nglyph, ppci, pglyphBase);
case rgnOUT:
return;
}
}
#ifdef GLYPHROP
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
#else
pixel = cfbGetGCPrivate(pGC)->xor;
#endif
cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
widthDst = bwidthDst / PGSZB;
while (nglyph--)
{
pci = *ppci++;
glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
xoff = x + pci->metrics.leftSideBearing;
#if PSZ == 24
dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3);
#else
dstLine = pdstBase +
(y - pci->metrics.ascent) * widthDst + (xoff >> PWSH);
#endif
x += pci->metrics.characterWidth;
if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
{
#if PSZ == 24
xoff &= 0x03;
#else
xoff &= PIM;
#endif /* PSZ == 24 */
#ifdef STIPPLE
STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
#else
#ifdef USE_STIPPLE_CODE
(*stipple)(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
#else
#ifdef USE_LEFTBITS
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
widthGlyph = PADGLYPHWIDTHBYTES(w);
widthMask = mfbGetendtab(w);
#endif
do {
dst = dstLine;
dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
dst += DST_INC;
c = BitLeft(c,PGSZB - xoff);
while (c)
{
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst += DST_INC;
}
} while (--hTmp);
#endif /* USE_STIPPLE_CODE else */
#endif /* STIPPLE else */
}
}
}
static void
cfbPolyGlyphBlt8Clipped(
DrawablePtr pDrawable,
GCPtr pGC,
int x,
int y,
unsigned int nglyph,
CharInfoPtr *ppci, /* array of character info */
unsigned char *pglyphBase) /* start of array of glyphs */
{
#ifndef GLYPHROP
register CfbBits pixel;
#endif
#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
register CfbBits c;
#endif
register glyphPointer glyphBits;
register int xoff;
#if defined(USE_LEFTBITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE))
register CfbBits *dst;
#endif
CharInfoPtr pci;
FontPtr pfont = pGC->font;
CfbBits *dstLine;
CfbBits *pdstBase;
#ifdef USE_LEFTBITS
CARD32 *cTmp;
#endif
CARD32 *clips;
int maxAscent, maxDescent;
int minLeftBearing;
int hTmp;
int widthDst;
int bwidthDst;
int xG, yG;
BoxPtr pBox;
int numRects;
int w;
RegionPtr pRegion;
int yBand;
#ifdef GLYPHROP
CfbBits bits;
#endif
#ifdef USE_LEFTBITS
int widthGlyph;
CfbBits widthMask;
#endif
#ifdef GLYPHROP
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
#else
pixel = cfbGetGCPrivate(pGC)->xor;
#endif
cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
widthDst = bwidthDst / PGSZB;
maxAscent = FONTMAXBOUNDS(pfont,ascent);
maxDescent = FONTMAXBOUNDS(pfont,descent);
minLeftBearing = FONTMINBOUNDS(pfont,leftSideBearing);
pRegion = cfbGetCompositeClip(pGC);
pBox = REGION_RECTS(pRegion);
numRects = REGION_NUM_RECTS (pRegion);
while (numRects && pBox->y2 <= y - maxAscent)
{
++pBox;
--numRects;
}
if (!numRects || pBox->y1 >= y + maxDescent)
return;
yBand = pBox->y1;
while (numRects && pBox->y1 == yBand && pBox->x2 <= x + minLeftBearing)
{
++pBox;
--numRects;
}
if (!numRects)
return;
clips = (CARD32 *)xalloc ((maxAscent + maxDescent) *
sizeof (CARD32));
while (nglyph--)
{
pci = *ppci++;
glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
xG = x + pci->metrics.leftSideBearing;
yG = y - pci->metrics.ascent;
x += pci->metrics.characterWidth;
if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
{
#if PSZ == 24
dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3);
/* never use (xG*3)>>2 */
#else
dstLine = pdstBase + yG * widthDst + (xG >> PWSH);
#endif
#if PSZ == 24
xoff = xG & 3;
#else
xoff = xG & PIM;
#endif
#ifdef USE_LEFTBITS
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
widthGlyph = PADGLYPHWIDTHBYTES(w);
widthMask = mfbGetendtab(w);
#endif
switch (cfb8ComputeClipMasks32 (pBox, numRects, xG, yG, w, hTmp, clips))
{
case rgnPART:
#ifdef USE_LEFTBITS
cTmp = clips;
do {
dst = dstLine;
dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
c &= *cTmp++;
if (c)
{
WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
while (c)
{
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst += DST_INC;
}
}
} while (--hTmp);
break;
#else /* !USE_LEFTBITS */
{
int h;
h = hTmp;
do
{
--h;
clips[h] = clips[h] & glyphBits[h];
} while (h);
}
glyphBits = clips;
/* fall through */
#endif /* USE_LEFTBITS */
case rgnIN:
#ifdef STIPPLE
STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
#else
#ifdef USE_STIPPLE_CODE
cfbStippleStackTE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
#else
do {
dst = dstLine;
dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
GlyphBits(glyphBits, w, c)
if (c)
{
/* This code originally could read memory locations
* that were not mapped. Hence we have to check the
* trailing bits to see whether they are zero and if
* then skip them correctly. This is no problem for
* the GXcopy case, since there only the pixels that
* are non-zero are written ...
*/
#ifndef GLYPHROP
WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
#else /* GLYPHROP */
if ((bits = GetBitGroup(BitRight(c,xoff))))
WriteBitGroup(dst, pixel, bits);
c = BitLeft(c,PGSZB - xoff);
dst += DST_INC;
while (c && ((bits = GetBitGroup(c)) == 0))
{
NextBitGroup(c);
dst += DST_INC;
}
#endif /* GLYPHROP */
while (c)
{
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst += DST_INC;
}
}
} while (--hTmp);
#endif /* USE_STIPPLE_CODE else */
#endif /* STIPPLE else */
break;
}
}
}
xfree (clips);
}
#endif /* FOUR_BIT_CODE */

View file

@ -1,554 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "gc.h"
#include "window.h"
#include "pixmap.h"
#include "region.h"
#include "cfb.h"
#include "cfbmskbits.h"
/* horizontal solid line
abs(len) > 1
*/
void
cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len)
register int rop;
register CfbBits and;
register CfbBits xor;
register CfbBits *addrl; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
int x1; /* initial point */
int y1;
int len; /* length of line */
{
register int nlmiddle;
#if PSZ == 24
int leftIndex, rightIndex;
CfbBits piQxelAnd[3], piQxelXor[3];
piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000);
piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000);
piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF);
piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000);
piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000);
piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF);
leftIndex = x1 & 3;
rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3;
nlmiddle = len;
if(leftIndex){
nlmiddle -= (4 - leftIndex);
}
if(rightIndex){
nlmiddle -= rightIndex;
}
if (nlmiddle < 0)
nlmiddle = 0;
nlmiddle >>= 2;
addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0);
switch(leftIndex+len){
case 4:
switch(leftIndex){
case 0:
*addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
break;
case 1:
*addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
break;
case 2:
*addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
break;
case 3:
*addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
break;
}
break;
case 3:
switch(leftIndex){
case 0:
*addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
break;
case 1:
*addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
break;
case 2:
*addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
addrl++;
*addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
break;
}
break;
case 2:
if(leftIndex){
*addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
addrl++;
}
else{
*addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
addrl++;
}
*addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
break;
case 1: /*only if leftIndex = 0 and w = 1*/
*addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
break;
case 0: /*never*/
break;
default:
{
if (rop == GXcopy){
switch(leftIndex){
case 0:
break;
case 1:
*addrl = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
addrl++;
*addrl++ = piQxelXor[1];
*addrl++ = piQxelXor[2];
break;
case 2:
*addrl = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
addrl++;
*addrl++ = piQxelXor[2];
break;
case 3:
*addrl = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
addrl++;
break;
}
while(nlmiddle--){
*addrl++ = piQxelXor[0];
*addrl++ = piQxelXor[1];
*addrl++ = piQxelXor[2];
}
switch(rightIndex){
case 0:
break;
case 1:
*addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
break;
case 2:
*addrl++ = piQxelXor[0];
*addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
break;
case 3:
*addrl++ = piQxelXor[0];
*addrl++ = piQxelXor[1];
*addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
break;
}
}
else{
if(rop == GXxor){
switch(leftIndex){
case 0:
break;
case 1:
*addrl++ ^= (piQxelXor[0]&0xFF000000);
*addrl++ ^= piQxelXor[1];
*addrl++ ^= piQxelXor[2];
break;
case 2:
*addrl++ ^= (piQxelXor[1]& 0xFFFF0000);
*addrl++ ^= piQxelXor[2];
break;
case 3:
*addrl++ ^= (piQxelXor[2]& 0xFFFFFF00);
break;
}
while(nlmiddle--){
*addrl++ ^= piQxelXor[0];
*addrl++ ^= piQxelXor[1];
*addrl++ ^= piQxelXor[2];
}
switch(rightIndex){
case 0:
break;
case 1:
*addrl ^= (piQxelXor[0]& 0xFFFFFF);
break;
case 2:
*addrl++ ^= piQxelXor[0];
*addrl ^= (piQxelXor[1]&0xFFFF);
break;
case 3:
*addrl++ ^= piQxelXor[0];
*addrl++ ^= piQxelXor[1];
*addrl ^= (piQxelXor[2]&0xFF);
break;
}
}
else{
switch(leftIndex){
case 0:
break;
case 1:
*addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
addrl++;
break;
case 2:
*addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
addrl++;
break;
case 3:
*addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
addrl++;
break;
}
while(nlmiddle--){
*addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
addrl++;
}
switch(rightIndex){
case 0:
break;
case 1:
*addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
addrl++;
break;
case 2:
*addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
addrl++;
*addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
break;
case 3:
*addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
addrl++;
*addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
addrl++;
*addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
break;
}
}
}
}
}
#else
register CfbBits startmask;
register CfbBits endmask;
addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
/* all bits inside same longword */
if ( ((x1 & PIM) + len) < PPW)
{
maskpartialbits(x1, len, startmask);
*addrl = DoMaskRRop (*addrl, and, xor, startmask);
}
else
{
maskbits(x1, len, startmask, endmask, nlmiddle);
if (rop == GXcopy)
{
if (startmask)
{
*addrl = (*addrl & ~startmask) | (xor & startmask);
addrl++;
}
while (nlmiddle--)
*addrl++ = xor;
if (endmask)
*addrl = (*addrl & ~endmask) | (xor & endmask);
}
else
{
if (startmask)
{
*addrl = DoMaskRRop (*addrl, and, xor, startmask);
addrl++;
}
if (rop == GXxor)
{
while (nlmiddle--)
*addrl++ ^= xor;
}
else
{
while (nlmiddle--)
{
*addrl = DoRRop (*addrl, and, xor);
addrl++;
}
}
if (endmask)
*addrl = DoMaskRRop (*addrl, and, xor, endmask);
}
}
#endif
}
/* vertical solid line */
void
cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len)
int rop;
register CfbBits and, xor;
register CfbBits *addrl; /* pointer to base of bitmap */
register int nlwidth; /* width in longwords of bitmap */
int x1, y1; /* initial point */
register int len; /* length of line */
{
#if PSZ == 24
int xIdx;
CfbBits and2 = 0, xor2 = 0, mask = 0, mask2;
#endif
#ifdef PIXEL_ADDR
register PixelType *bits = (PixelType *) addrl;
#if PSZ == 24
nlwidth <<= PWSH;
xIdx = x1 & 3;
bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2));
#else
nlwidth <<= PWSH;
bits = bits + (y1 * nlwidth) + x1;
#endif
#if PSZ == 24
mask2 = 0;
switch(xIdx){
case 0:
mask = 0xFF000000;
xor &= 0xFFFFFF;
and |= 0xFF000000;
break;
case 3:
mask = 0xFF;
xor &= 0xFFFFFF;
xor <<= 8;
and <<= 8;
and |= 0xFF;
break;
case 1:
mask = 0xFFFFFF;
mask2 = 0xFFFF0000;
xor2 = (xor>>8) & 0xFFFF;
xor &= 0xFF;
xor <<= 24;
and2 = (and >> 8 ) | 0xFFFF0000;
and <<= 24;
and |= 0xFFFFFF;
break;
case 2:
mask = 0x0000FFFF;
mask2 = 0xFFFFFF00;
xor2 = (xor >> 16) & 0xFF;
xor <<= 16;
xor &= 0xFFFF0000;
and2 = (and >> 16) | 0xFFFFFF00;
and <<= 16;
and |= 0xFFFF;
break;
}
#endif
/*
* special case copy and xor to avoid a test per pixel
*/
if (rop == GXcopy)
{
#if PSZ == 24
switch(xIdx){
case 0:
case 3:
while (len--){
*bits = (*bits & mask)| xor;
bits += nlwidth;
}
break;
case 1:
case 2:
while (len--){
*bits = (*bits & mask)| xor;
bits++;
*bits = (*bits & mask2)| xor2;
bits--;
bits += nlwidth;
}
break;
}
#else
while (len--)
{
*bits = xor;
bits += nlwidth;
}
#endif
}
else if (rop == GXxor)
{
#if PSZ == 24
switch(xIdx){
case 0:
case 3:
while (len--){
*bits ^= xor;
bits += nlwidth;
}
break;
case 1:
case 2:
while (len--){
*bits ^= xor;
bits++;
*bits ^= xor2;
bits--;
bits += nlwidth;
}
break;
}
#else
while (len--)
{
*bits ^= xor;
bits += nlwidth;
}
#endif
}
else
{
#if PSZ == 24
switch(xIdx){
case 0:
while (len--){
*bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF);
bits += nlwidth;
}
break;
case 3:
while (len--){
*bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00);
bits += nlwidth;
}
break;
case 1:
while (len--){
*bits = DoMaskRRop(*bits, and, xor, 0xFF000000);
bits++;
*bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF);
bits--;
bits += nlwidth;
}
break;
case 2:
while (len--){
*bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000);
bits++;
*bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF);
bits--;
bits += nlwidth;
}
break;
}
#else
while (len--)
{
*bits = DoRRop(*bits, and, xor);
bits += nlwidth;
}
#endif
}
#else /* !PIXEL_ADDR */
#if PSZ == 24
addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2);
and |= ~cfbmask[(x1 & 3)<<1];
xor &= cfbmask[(x1 & 3)<<1];
#else
addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
and |= ~cfbmask[x1 & PIM];
xor &= cfbmask[x1 & PIM];
#endif
while (len--)
{
*addrl = DoRRop (*addrl, and, xor);
addrl += nlwidth;
}
#endif
}

View file

@ -1,106 +0,0 @@
/*
*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "mi.h"
#include "cfb.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
void
cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GCPtr pGC;
int x, y;
unsigned int nglyph;
CharInfoPtr *ppci;
pointer pglyphBase;
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
xRectangle backrect;
int fgPixel;
cfbPrivGC *priv;
/*
* We can't avoid GC validations if calling mi functions.
*/
if ((pGC->ops->PolyFillRect == miPolyFillRect) ||
(pGC->ops->PolyGlyphBlt == miPolyGlyphBlt))
{
miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
return;
}
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
if (info.overallWidth >= 0)
{
backrect.x = x;
backrect.width = info.overallWidth;
}
else
{
backrect.x = x + info.overallWidth;
backrect.width = -info.overallWidth;
}
backrect.y = y - FONTASCENT(pGC->font);
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
priv = cfbGetGCPrivate(pGC);
/* this code cheats by knowing that ValidateGC isn't
* necessary for PolyFillRect
*/
fgPixel = pGC->fgPixel;
pGC->fgPixel = pGC->bgPixel;
priv->xor = PFILL(pGC->bgPixel);
(*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect);
pGC->fgPixel = fgPixel;
priv->xor = PFILL(pGC->fgPixel);
(*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}

View file

@ -1,206 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include "windowstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "servermd.h"
#include "mi.h"
void
cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
DrawablePtr pDraw;
GCPtr pGC;
int depth, x, y, w, h;
int leftPad;
int format;
char *pImage;
{
PixmapPtr pPixmap;
if ((w == 0) || (h == 0))
return;
if (format != XYPixmap)
{
pPixmap = GetScratchPixmapHeader(pDraw->pScreen, w+leftPad, h, depth,
BitsPerPixel(depth), PixmapBytePad(w+leftPad, depth),
(pointer)pImage);
if (!pPixmap)
return;
pGC->fExpose = FALSE;
if (format == ZPixmap)
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC,
leftPad, 0, w, h, x, y);
else
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC,
leftPad, 0, w, h, x, y, 1);
pGC->fExpose = TRUE;
FreeScratchPixmapHeader(pPixmap);
}
else
{
CfbBits oldFg, oldBg;
XID gcv[3];
CfbBits oldPlanemask;
unsigned long i;
long bytesPer;
depth = pGC->depth;
oldPlanemask = pGC->planemask;
oldFg = pGC->fgPixel;
oldBg = pGC->bgPixel;
gcv[0] = ~0L;
gcv[1] = 0;
DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
bytesPer = (long)h * BitmapBytePad(w + leftPad);
for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer)
{
if (i & oldPlanemask)
{
gcv[0] = i;
DoChangeGC(pGC, GCPlaneMask, gcv, 0);
ValidateGC(pDraw, pGC);
(*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
XYBitmap, pImage);
}
}
gcv[0] = oldPlanemask;
gcv[1] = oldFg;
gcv[2] = oldBg;
DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
ValidateGC(pDraw, pGC);
}
}
void
cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
DrawablePtr pDrawable;
int sx, sy, w, h;
unsigned int format;
unsigned long planeMask;
char *pdstLine;
{
BoxRec box;
DDXPointRec ptSrc;
RegionRec rgnDst;
ScreenPtr pScreen;
PixmapPtr pPixmap;
if ((w == 0) || (h == 0))
return;
if (pDrawable->bitsPerPixel == 1)
{
mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
return;
}
pScreen = pDrawable->pScreen;
/*
* XFree86 DDX empties the root borderClip when the VT is
* switched away; this checks for that case
*/
if (!cfbDrawableEnabled (pDrawable))
return;
if (format == ZPixmap)
{
pPixmap = GetScratchPixmapHeader(pScreen, w, h,
pDrawable->depth, pDrawable->bitsPerPixel,
PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine);
if (!pPixmap)
return;
if ((planeMask & PMSK) != PMSK)
bzero((char *)pdstLine, pPixmap->devKind * h);
ptSrc.x = sx + pDrawable->x;
ptSrc.y = sy + pDrawable->y;
box.x1 = 0;
box.y1 = 0;
box.x2 = w;
box.y2 = h;
REGION_INIT(pScreen, &rgnDst, &box, 1);
cfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
&ptSrc, planeMask);
REGION_UNINIT(pScreen, &rgnDst);
FreeScratchPixmapHeader(pPixmap);
}
else
{
#if IMAGE_BYTE_ORDER == LSBFirst
pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1,
/*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine);
if (!pPixmap)
return;
ptSrc.x = sx + pDrawable->x;
ptSrc.y = sy + pDrawable->y;
box.x1 = 0;
box.y1 = 0;
box.x2 = w;
box.y2 = h;
REGION_INIT(pScreen, &rgnDst, &box, 1);
cfbCopyImagePlane (pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
&ptSrc, planeMask);
REGION_UNINIT(pScreen, &rgnDst);
FreeScratchPixmapHeader(pPixmap);
#else
miGetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
#endif
}
}

View file

@ -1,756 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "scrnintstr.h"
#include "mistruct.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "miline.h"
/* single-pixel lines on a color frame buffer
NON-SLOPED LINES
horizontal lines are always drawn left to right; we have to
move the endpoints right by one after they're swapped.
horizontal lines will be confined to a single band of a
region. the code finds that band (giving up if the lower
bound of the band is above the line we're drawing); then it
finds the first box in that band that contains part of the
line. we clip the line to subsequent boxes in that band.
vertical lines are always drawn top to bottom (y-increasing.)
this requires adding one to the y-coordinate of each endpoint
after swapping.
SLOPED LINES
when clipping a sloped line, we bring the second point inside
the clipping box, rather than one beyond it, and then add 1 to
the length of the line before drawing it. this lets us use
the same box for finding the outcodes for both endpoints. since
the equation for clipping the second endpoint to an edge gives us
1 beyond the edge, we then have to move the point towards the
first point by one step on the major axis.
eventually, there will be a diagram here to explain what's going
on. the method uses Cohen-Sutherland outcodes to determine
outsideness, and a method similar to Pike's layers for doing the
actual clipping.
*/
void
#ifdef POLYSEGMENT
cfbSegmentSS (pDrawable, pGC, nseg, pSeg)
DrawablePtr pDrawable;
GCPtr pGC;
int nseg;
register xSegment *pSeg;
#else
cfbLineSS (pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
GCPtr pGC;
int mode; /* Origin or Previous */
int npt; /* number of points */
DDXPointPtr pptInit;
#endif
{
int nboxInit;
register int nbox;
BoxPtr pboxInit;
register BoxPtr pbox;
#ifndef POLYSEGMENT
register DDXPointPtr ppt; /* pointer to list of translated points */
#endif
unsigned int oc1; /* outcode of point 1 */
unsigned int oc2; /* outcode of point 2 */
CfbBits *addrl; /* address of destination pixmap */
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
int adx; /* abs values of dx and dy */
int ady;
int signdx; /* sign of dx and dy */
int signdy;
int e, e1, e2; /* bresenham error and increments */
int len; /* length of segment */
int axis; /* major axis */
int octant;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
/* a bunch of temporaries */
int tmp;
register int y1, y2;
register int x1, x2;
RegionPtr cclip;
cfbPrivGCPtr devPriv;
CfbBits xor, and;
int alu;
devPriv = cfbGetGCPrivate(pGC);
cclip = pGC->pCompositeClip;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl)
alu = devPriv->rop;
xor = devPriv->xor;
and = devPriv->and;
xorg = pDrawable->x;
yorg = pDrawable->y;
#ifdef POLYSEGMENT
while (nseg--)
#else
ppt = pptInit;
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
while(--npt)
#endif
{
nbox = nboxInit;
pbox = pboxInit;
#ifdef POLYSEGMENT
x1 = pSeg->x1 + xorg;
y1 = pSeg->y1 + yorg;
x2 = pSeg->x2 + xorg;
y2 = pSeg->y2 + yorg;
pSeg++;
#else
x1 = x2;
y1 = y2;
++ppt;
if (mode == CoordModePrevious)
{
xorg = x1;
yorg = y1;
}
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
#endif
if (x1 == x2) /* vertical line */
{
/* make the line go top to bottom of screen, keeping
endpoint semantics
*/
if (y1 > y2)
{
register int tmp;
tmp = y2;
y2 = y1 + 1;
y1 = tmp + 1;
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
y1--;
#endif
}
#ifdef POLYSEGMENT
else if (pGC->capStyle != CapNotLast)
y2++;
#endif
/* get to first band that might contain part of line */
while ((nbox) && (pbox->y2 <= y1))
{
pbox++;
nbox--;
}
if (nbox)
{
/* stop when lower edge of box is beyond end of line */
while((nbox) && (y2 >= pbox->y1))
{
if ((x1 >= pbox->x1) && (x1 < pbox->x2))
{
int y1t, y2t;
/* this box has part of the line in it */
y1t = max(y1, pbox->y1);
y2t = min(y2, pbox->y2);
if (y1t != y2t)
{
cfbVertS (alu, and, xor,
addrl, nlwidth,
x1, y1t, y2t-y1t);
}
}
nbox--;
pbox++;
}
}
#ifndef POLYSEGMENT
y2 = ppt->y + yorg;
#endif
}
else if (y1 == y2) /* horizontal line */
{
/* force line from left to right, keeping
endpoint semantics
*/
if (x1 > x2)
{
register int tmp;
tmp = x2;
x2 = x1 + 1;
x1 = tmp + 1;
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
x1--;
#endif
}
#ifdef POLYSEGMENT
else if (pGC->capStyle != CapNotLast)
x2++;
#endif
/* find the correct band */
while( (nbox) && (pbox->y2 <= y1))
{
pbox++;
nbox--;
}
/* try to draw the line, if we haven't gone beyond it */
if ((nbox) && (pbox->y1 <= y1))
{
/* when we leave this band, we're done */
tmp = pbox->y1;
while((nbox) && (pbox->y1 == tmp))
{
int x1t, x2t;
if (pbox->x2 <= x1)
{
/* skip boxes until one might contain start point */
nbox--;
pbox++;
continue;
}
/* stop if left of box is beyond right of line */
if (pbox->x1 >= x2)
{
nbox = 0;
break;
}
x1t = max(x1, pbox->x1);
x2t = min(x2, pbox->x2);
if (x1t != x2t)
{
cfbHorzS (alu, and, xor,
addrl, nlwidth,
x1t, y1, x2t-x1t);
}
nbox--;
pbox++;
}
}
#ifndef POLYSEGMENT
x2 = ppt->x + xorg;
#endif
}
else /* sloped line */
{
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
1, 1, octant);
if (adx > ady)
{
axis = X_AXIS;
e1 = ady << 1;
e2 = e1 - (adx << 1);
e = e1 - adx;
}
else
{
axis = Y_AXIS;
e1 = adx << 1;
e2 = e1 - (ady << 1);
e = e1 - ady;
SetYMajorOctant(octant);
}
FIXUP_ERROR(e, octant, bias);
/* we have bresenham parameters and two points.
all we have to do now is clip and draw.
*/
while(nbox--)
{
oc1 = 0;
oc2 = 0;
OUTCODES(oc1, x1, y1, pbox);
OUTCODES(oc2, x2, y2, pbox);
if ((oc1 | oc2) == 0)
{
if (axis == X_AXIS)
len = adx;
else
len = ady;
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
len++;
#endif
cfbBresS (alu, and, xor,
addrl, nlwidth,
signdx, signdy, axis, x1, y1,
e, e1, e2, len);
break;
}
else if (oc1 & oc2)
{
pbox++;
}
else
{
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
int clip1 = 0, clip2 = 0;
int clipdx, clipdy;
int err;
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
pbox->y2-1,
&new_x1, &new_y1, &new_x2, &new_y2,
adx, ady, &clip1, &clip2,
octant, bias, oc1, oc2) == -1)
{
pbox++;
continue;
}
if (axis == X_AXIS)
len = abs(new_x2 - new_x1);
else
len = abs(new_y2 - new_y1);
#ifdef POLYSEGMENT
if (clip2 != 0 || pGC->capStyle != CapNotLast)
len++;
#else
len += (clip2 != 0);
#endif
if (len)
{
/* unwind bresenham error term to first point */
if (clip1)
{
clipdx = abs(new_x1 - x1);
clipdy = abs(new_y1 - y1);
if (axis == X_AXIS)
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
else
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
}
else
err = e;
cfbBresS(alu, and, xor,
addrl, nlwidth,
signdx, signdy, axis, new_x1, new_y1,
err, e1, e2, len);
}
pbox++;
}
} /* while (nbox--) */
} /* sloped line */
} /* while (nline--) */
#ifndef POLYSEGMENT
/* paint the last point if the end style isn't CapNotLast.
(Assume that a projecting, butt, or round cap that is one
pixel wide is the same as the single pixel of the endpoint.)
*/
if ((pGC->capStyle != CapNotLast) &&
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
(ppt == pptInit + 1)))
{
nbox = nboxInit;
pbox = pboxInit;
while (nbox--)
{
if ((x2 >= pbox->x1) &&
(y2 >= pbox->y1) &&
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
CfbBits mask;
CfbBits scrbits;
#if PSZ == 24
mask = cfbmask[(x2 & 3)<<1];
addrl += (y2 * nlwidth) + ((x2*3) >> 2);
#else
mask = cfbmask[x2 & PIM];
addrl += (y2 * nlwidth) + (x2 >> PWSH);
#endif
scrbits = *addrl;
*addrl = (scrbits & ~mask) |
(DoRRop (scrbits, and, xor) & mask);
break;
}
else
pbox++;
}
}
#endif
}
/*
* Draw dashed 1-pixel lines.
*/
void
#ifdef POLYSEGMENT
cfbSegmentSD (pDrawable, pGC, nseg, pSeg)
DrawablePtr pDrawable;
register GCPtr pGC;
int nseg;
register xSegment *pSeg;
#else
cfbLineSD( pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
register GCPtr pGC;
int mode; /* Origin or Previous */
int npt; /* number of points */
DDXPointPtr pptInit;
#endif
{
int nboxInit;
register int nbox;
BoxPtr pboxInit;
register BoxPtr pbox;
#ifndef POLYSEGMENT
register DDXPointPtr ppt; /* pointer to list of translated points */
#endif
register unsigned int oc1; /* outcode of point 1 */
register unsigned int oc2; /* outcode of point 2 */
CfbBits *addrl; /* address of destination pixmap */
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
int adx; /* abs values of dx and dy */
int ady;
int signdx; /* sign of dx and dy */
int signdy;
int e, e1, e2; /* bresenham error and increments */
int len; /* length of segment */
int axis; /* major axis */
int octant;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
int x1, x2, y1, y2;
RegionPtr cclip;
cfbRRopRec rrops[2];
unsigned char *pDash;
int dashOffset;
int numInDashList;
int dashIndex;
int isDoubleDash;
int dashIndexTmp, dashOffsetTmp;
int unclippedlen;
cfbPrivGCPtr devPriv;
devPriv = cfbGetGCPrivate(pGC);
cclip = pGC->pCompositeClip;
rrops[0].rop = devPriv->rop;
rrops[0].and = devPriv->and;
rrops[0].xor = devPriv->xor;
if (pGC->alu == GXcopy)
{
rrops[1].rop = GXcopy;
rrops[1].and = 0;
rrops[1].xor = PFILL (pGC->bgPixel);
}
else
{
rrops[1].rop = cfbReduceRasterOp (pGC->alu,
pGC->bgPixel, pGC->planemask,
&rrops[1].and, &rrops[1].xor);
}
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl)
/* compute initial dash values */
pDash = (unsigned char *) pGC->dash;
numInDashList = pGC->numInDashList;
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
dashIndex = 0;
dashOffset = 0;
miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
numInDashList, &dashOffset);
xorg = pDrawable->x;
yorg = pDrawable->y;
#ifdef POLYSEGMENT
while (nseg--)
#else
ppt = pptInit;
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
while(--npt)
#endif
{
nbox = nboxInit;
pbox = pboxInit;
#ifdef POLYSEGMENT
x1 = pSeg->x1 + xorg;
y1 = pSeg->y1 + yorg;
x2 = pSeg->x2 + xorg;
y2 = pSeg->y2 + yorg;
pSeg++;
#else
x1 = x2;
y1 = y2;
++ppt;
if (mode == CoordModePrevious)
{
xorg = x1;
yorg = y1;
}
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
#endif
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
if (adx > ady)
{
axis = X_AXIS;
e1 = ady << 1;
e2 = e1 - (adx << 1);
e = e1 - adx;
unclippedlen = adx;
}
else
{
axis = Y_AXIS;
e1 = adx << 1;
e2 = e1 - (ady << 1);
e = e1 - ady;
unclippedlen = ady;
SetYMajorOctant(octant);
}
FIXUP_ERROR(e, octant, bias);
/* we have bresenham parameters and two points.
all we have to do now is clip and draw.
*/
while(nbox--)
{
oc1 = 0;
oc2 = 0;
OUTCODES(oc1, x1, y1, pbox);
OUTCODES(oc2, x2, y2, pbox);
if ((oc1 | oc2) == 0)
{
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
unclippedlen++;
dashIndexTmp = dashIndex;
dashOffsetTmp = dashOffset;
cfbBresD (rrops,
&dashIndexTmp, pDash, numInDashList,
&dashOffsetTmp, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, x1, y1,
e, e1, e2, unclippedlen);
break;
#else
cfbBresD (rrops,
&dashIndex, pDash, numInDashList,
&dashOffset, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, x1, y1,
e, e1, e2, unclippedlen);
goto dontStep;
#endif
}
else if (oc1 & oc2)
{
pbox++;
}
else /* have to clip */
{
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
int clip1 = 0, clip2 = 0;
int clipdx, clipdy;
int err;
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
pbox->y2-1,
&new_x1, &new_y1, &new_x2, &new_y2,
adx, ady, &clip1, &clip2,
octant, bias, oc1, oc2) == -1)
{
pbox++;
continue;
}
dashIndexTmp = dashIndex;
dashOffsetTmp = dashOffset;
if (clip1)
{
int dlen;
if (axis == X_AXIS)
dlen = abs(new_x1 - x1);
else
dlen = abs(new_y1 - y1);
miStepDash (dlen, &dashIndexTmp, pDash,
numInDashList, &dashOffsetTmp);
}
if (axis == X_AXIS)
len = abs(new_x2 - new_x1);
else
len = abs(new_y2 - new_y1);
#ifdef POLYSEGMENT
if (clip2 != 0 || pGC->capStyle != CapNotLast)
len++;
#else
len += (clip2 != 0);
#endif
if (len)
{
/* unwind bresenham error term to first point */
if (clip1)
{
clipdx = abs(new_x1 - x1);
clipdy = abs(new_y1 - y1);
if (axis == X_AXIS)
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
else
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
}
else
err = e;
cfbBresD (rrops,
&dashIndexTmp, pDash, numInDashList,
&dashOffsetTmp, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, new_x1, new_y1,
err, e1, e2, len);
}
pbox++;
}
} /* while (nbox--) */
#ifndef POLYSEGMENT
/*
* walk the dash list around to the next line
*/
miStepDash (unclippedlen, &dashIndex, pDash,
numInDashList, &dashOffset);
dontStep: ;
#endif
} /* while (nline--) */
#ifndef POLYSEGMENT
/* paint the last point if the end style isn't CapNotLast.
(Assume that a projecting, butt, or round cap that is one
pixel wide is the same as the single pixel of the endpoint.)
*/
if ((pGC->capStyle != CapNotLast) &&
((dashIndex & 1) == 0 || isDoubleDash) &&
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
(ppt == pptInit + 1)))
{
nbox = nboxInit;
pbox = pboxInit;
while (nbox--)
{
if ((x2 >= pbox->x1) &&
(y2 >= pbox->y1) &&
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
CfbBits mask;
int pix;
pix = 0;
if (dashIndex & 1)
pix = 1;
#if PSZ == 24
mask = cfbmask[(x2 & 3)<<1];
addrl += (y2 * nlwidth) + ((x2 *3)>> 2);
#else
mask = cfbmask[x2 & PIM];
addrl += (y2 * nlwidth) + (x2 >> PWSH);
#endif
*addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask);
break;
}
else
pbox++;
}
}
#endif
}

View file

@ -1,210 +0,0 @@
/*
*
Copyright 1991, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
/*
* Map names around so that multiple depths can be supported simultaneously
*/
/* a losing vendor cpp dumps core if we define CFBNAME in terms of CATNAME */
#if PSZ != 8
#if PSZ == 32
#if !defined(UNIXCPP) || defined(ANSICPP)
#define CFBNAME(subname) cfb32##subname
#else
#define CFBNAME(subname) cfb32/**/subname
#endif
#endif
#if PSZ == 24
#if !defined(UNIXCPP) || defined(ANSICPP)
#define CFBNAME(subname) cfb24##subname
#else
#define CFBNAME(subname) cfb24/**/subname
#endif
#endif
#if PSZ == 16
#if !defined(UNIXCPP) || defined(ANSICPP)
#define CFBNAME(subname) cfb16##subname
#else
#define CFBNAME(subname) cfb16/**/subname
#endif
#endif
#if PSZ == 4
#if !defined(UNIXCPP) || defined(ANSICPP)
#define CFBNAME(subname) cfb4##subname
#else
#define CFBNAME(subname) cfb4/**/subname
#endif
#endif
#ifndef CFBNAME
cfb can not hack PSZ yet
#endif
#undef CATNAME
#if !defined(UNIXCPP) || defined(ANSICPP)
#define CATNAME(prefix,subname) prefix##subname
#else
#define CATNAME(prefix,subname) prefix/**/subname
#endif
#define QuartetBitsTable CFBNAME(QuartetBitsTable)
#define QuartetPixelMaskTable CFBNAME(QuartetPixelMaskTable)
#define cfb8ClippedLineCopy CFBNAME(ClippedLineCopy)
#define cfb8ClippedLineGeneral CFBNAME(ClippedLineGeneral )
#define cfb8ClippedLineXor CFBNAME(ClippedLineXor)
#define cfb8LineSS1Rect CFBNAME(LineSS1Rect)
#define cfb8LineSS1RectCopy CFBNAME(LineSS1RectCopy)
#define cfb8LineSS1RectGeneral CFBNAME(LineSS1RectGeneral )
#define cfb8LineSS1RectPreviousCopy CFBNAME(LineSS1RectPreviousCopy)
#define cfb8LineSS1RectXor CFBNAME(LineSS1RectXor)
#define cfb8SegmentSS1Rect CFBNAME(SegmentSS1Rect)
#define cfb8SegmentSS1RectCopy CFBNAME(SegmentSS1RectCopy)
#define cfb8SegmentSS1RectGeneral CFBNAME(SegmentSS1RectGeneral )
#define cfb8SegmentSS1RectShiftCopy CFBNAME(SegmentSS1RectShiftCopy)
#define cfb8SegmentSS1RectXor CFBNAME(SegmentSS1RectXor)
#define cfbAllocatePrivates CFBNAME(AllocatePrivates)
#define cfbBSFuncRec CFBNAME(BSFuncRec)
#define cfbBitBlt CFBNAME(BitBlt)
#define cfbBresD CFBNAME(BresD)
#define cfbBresS CFBNAME(BresS)
#define cfbChangeWindowAttributes CFBNAME(ChangeWindowAttributes)
#define cfbClearVisualTypes CFBNAME(cfbClearVisualTypes)
#define cfbCloseScreen CFBNAME(CloseScreen)
#define cfbCreateDefColormap CFBNAME (cfbCreateDefColormap)
#define cfbCopyArea CFBNAME(CopyArea)
#define cfbCopyImagePlane CFBNAME(CopyImagePlane)
#define cfbCopyPixmap CFBNAME(CopyPixmap)
#define cfbCopyPlane CFBNAME(CopyPlane)
#define cfbCopyPlaneReduce CFBNAME(CopyPlaneReduce)
#define cfbCopyRotatePixmap CFBNAME(CopyRotatePixmap)
#define cfbCopyWindow CFBNAME(CopyWindow)
#define cfbCreateGC CFBNAME(CreateGC)
#define cfbCreatePixmap CFBNAME(CreatePixmap)
#define cfbCreateScreenResources CFBNAME(CreateScreenResources)
#define cfbCreateWindow CFBNAME(CreateWindow)
#define cfbDestroyPixmap CFBNAME(DestroyPixmap)
#define cfbDestroyWindow CFBNAME(DestroyWindow)
#define cfbDoBitblt CFBNAME(DoBitblt)
#define cfbDoBitbltCopy CFBNAME(DoBitbltCopy)
#define cfbDoBitbltGeneral CFBNAME(DoBitbltGeneral)
#define cfbDoBitbltOr CFBNAME(DoBitbltOr)
#define cfbDoBitbltXor CFBNAME(DoBitbltXor)
#define cfbExpandDirectColors CFBNAME(cfbExpandDirectColors)
#define cfbFillBoxTile32sCopy CFBNAME(FillBoxTile32sCopy)
#define cfbFillBoxTile32sGeneral CFBNAME(FillBoxTile32sGeneral)
#define cfbFillBoxTileOdd CFBNAME(FillBoxTileOdd)
#define cfbFillBoxTileOddCopy CFBNAME(FillBoxTileOddCopy)
#define cfbFillBoxTileOddGeneral CFBNAME(FillBoxTileOddGeneral)
#define cfbFillPoly1RectCopy CFBNAME(FillPoly1RectCopy)
#define cfbFillPoly1RectGeneral CFBNAME(FillPoly1RectGeneral)
#define cfbFillRectSolidCopy CFBNAME(FillRectSolidCopy)
#define cfbFillRectSolidGeneral CFBNAME(FillRectSolidGeneral)
#define cfbFillRectSolidXor CFBNAME(FillRectSolidXor)
#define cfbFillRectTile32Copy CFBNAME(FillRectTile32Copy)
#define cfbFillRectTile32General CFBNAME(FillRectTile32General)
#define cfbFillRectTileOdd CFBNAME(FillRectTileOdd)
#define cfbFillSpanTile32sCopy CFBNAME(FillSpanTile32sCopy)
#define cfbFillSpanTile32sGeneral CFBNAME(FillSpanTile32sGeneral)
#define cfbFillSpanTileOddCopy CFBNAME(FillSpanTileOddCopy)
#define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral)
#define cfbFinishScreenInit CFBNAME(FinishScreenInit)
#define cfbGCFuncs CFBNAME(GCFuncs)
#define cfbGCPrivateKey CFBNAME(GCPrivateKey)
#define cfbGetImage CFBNAME(GetImage)
#define cfbGetScreenPixmap CFBNAME(GetScreenPixmap)
#define cfbGetSpans CFBNAME(GetSpans)
#define cfbHorzS CFBNAME(HorzS)
#define cfbImageGlyphBlt8 CFBNAME(ImageGlyphBlt8)
#define cfbInitializeColormap CFBNAME(InitializeColormap)
#define cfbInitVisuals CFBNAME(cfbInitVisuals)
#define cfbInstallColormap CFBNAME(InstallColormap)
#define cfbLineSD CFBNAME(LineSD)
#define cfbLineSS CFBNAME(LineSS)
#define cfbListInstalledColormaps CFBNAME(ListInstalledColormaps)
#define cfbMapWindow CFBNAME(MapWindow)
#define cfbMatchCommon CFBNAME(MatchCommon)
#define cfbNonTEOps CFBNAME(NonTEOps)
#define cfbNonTEOps1Rect CFBNAME(NonTEOps1Rect)
#define cfbPadPixmap CFBNAME(PadPixmap)
#define cfbPolyFillArcSolidCopy CFBNAME(PolyFillArcSolidCopy)
#define cfbPolyFillArcSolidGeneral CFBNAME(PolyFillArcSolidGeneral)
#define cfbPolyFillRect CFBNAME(PolyFillRect)
#define cfbPolyGlyphBlt8 CFBNAME(PolyGlyphBlt8)
#define cfbPolyGlyphRop8 CFBNAME(PolyGlyphRop8)
#define cfbPolyPoint CFBNAME(PolyPoint)
#define cfbPositionWindow CFBNAME(PositionWindow)
#define cfbPutImage CFBNAME(PutImage)
#define cfbReduceRasterOp CFBNAME(ReduceRasterOp)
#define cfbResolveColor CFBNAME(ResolveColor)
#define cfbRestoreAreas CFBNAME(RestoreAreas)
#define cfbSaveAreas CFBNAME(SaveAreas)
#define cfbScreenInit CFBNAME(ScreenInit)
#define cfbScreenPrivateKey CFBNAME(ScreenPrivateKey)
#define cfbSegmentSD CFBNAME(SegmentSD)
#define cfbSegmentSS CFBNAME(SegmentSS)
#define cfbSetScanline CFBNAME(SetScanline)
#define cfbSetScreenPixmap CFBNAME(SetScreenPixmap)
#define cfbSetSpans CFBNAME(SetSpans)
#define cfbSetVisualTypes CFBNAME(cfbSetVisualTypes)
#define cfbSetupScreen CFBNAME(SetupScreen)
#define cfbSolidSpansCopy CFBNAME(SolidSpansCopy)
#define cfbSolidSpansGeneral CFBNAME(SolidSpansGeneral)
#define cfbSolidSpansXor CFBNAME(SolidSpansXor)
#define cfbStippleStack CFBNAME(StippleStack)
#define cfbStippleStackTE CFBNAME(StippleStackTE)
#define cfbTEGlyphBlt CFBNAME(TEGlyphBlt)
#define cfbTEOps CFBNAME(TEOps)
#define cfbTEOps1Rect CFBNAME(TEOps1Rect)
#define cfbTile32FSCopy CFBNAME(Tile32FSCopy)
#define cfbTile32FSGeneral CFBNAME(Tile32FSGeneral)
#define cfbUninstallColormap CFBNAME(UninstallColormap)
#define cfbUnmapWindow CFBNAME(UnmapWindow)
#define cfbUnnaturalStippleFS CFBNAME(UnnaturalStippleFS)
#define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS)
#define cfbValidateGC CFBNAME(ValidateGC)
#define cfbVertS CFBNAME(VertS)
#define cfbWindowPrivateKey CFBNAME(WindowPrivateKey)
#define cfbXRotatePixmap CFBNAME(XRotatePixmap)
#define cfbYRotatePixmap CFBNAME(YRotatePixmap)
#define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy)
#define cfbZeroPolyArcSS8General CFBNAME(ZeroPolyArcSSGeneral)
#define cfbZeroPolyArcSS8Xor CFBNAME(ZeroPolyArcSSXor)
#define cfbendpartial CFBNAME(endpartial)
#define cfbendtab CFBNAME(endtab)
#define cfbmask CFBNAME(mask)
#define cfbrmask CFBNAME(rmask)
#define cfbstartpartial CFBNAME(startpartial)
#define cfbstarttab CFBNAME(starttab)
#endif /* PSZ != 8 */

File diff suppressed because it is too large Load diff

View file

@ -1,854 +0,0 @@
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
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 no-
tice appear in all copies and that both that copyright no-
tice and this permission notice appear in supporting docu-
mentation, and that the names of Sun or The Open Group
not be used in advertising or publicity pertaining to
distribution of the software without specific prior
written permission. Sun and The Open Group make no
representations about the suitability of this software for
any purpose. It is provided "as is" without any express or
implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
ABLE 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.
********************************************************/
/* Optimizations for PSZ == 32 added by Kyle Marvin (marvin@vitec.com) */
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "compiler.h"
/*
* ==========================================================================
* Converted from mfb to support memory-mapped color framebuffer by smarks@sun,
* April-May 1987.
*
* The way I did the conversion was to consider each longword as an
* array of four bytes instead of an array of 32 one-bit pixels. So
* getbits() and putbits() retain much the same calling sequence, but
* they move bytes around instead of bits. Of course, this entails the
* removal of all of the one-bit-pixel dependencies from the other
* files, but the major bit-hacking stuff should be covered here.
*
* I've created some new macros that make it easier to understand what's
* going on in the pixel calculations, and that make it easier to change the
* pixel size.
*
* name explanation
* ---- -----------
* PSZ pixel size (in bits)
* PGSZ pixel group size (in bits)
* PGSZB pixel group size (in bytes)
* PGSZBMSK mask with lowest PGSZB bits set to 1
* PPW pixels per word (pixels per pixel group)
* PPWMSK mask with lowest PPW bits set to 1
* PLST index of last pixel in a word (should be PPW-1)
* PIM pixel index mask (index within a pixel group)
* PWSH pixel-to-word shift (should be log2(PPW))
* PMSK mask with lowest PSZ bits set to 1
*
*
* Here are some sample values. In the notation cfbA,B: A is PSZ, and
* B is PGSZB. All the other values are derived from these
* two. This table does not show all combinations!
*
* name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8
* ---- ------ ------- ------ ------ ------ -------
* PSZ 8 24 32 8 24 32
* PGSZ 32 32 32 64 64 64
* PGSZB 4 4 4 8 8 8
* PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF
* PPW 4 1 1 8 2 2
* PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3
* PLST 3 0 0 7 1 1
* PIM 0x3 0x0 0x0 0x7 0x1? 0x1
* PWSH 2 0 0 3 1 1
* PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF
*
*
* I have also added a new macro, PFILL, that takes one pixel and
* replicates it throughout a word. This macro definition is dependent
* upon pixel and word size; it doesn't use macros like PPW and so
* forth. Examples: for monochrome, PFILL(1) => 0xffffffff, PFILL(0) =>
* 0x00000000. For 8-bit color, PFILL(0x5d) => 0x5d5d5d5d. This macro
* is used primarily for replicating a plane mask into a word.
*
* Color framebuffers operations also support the notion of a plane
* mask. This mask determines which planes of the framebuffer can be
* altered; the others are left unchanged. I have added another
* parameter to the putbits and putbitsrop macros that is the plane
* mask.
* ==========================================================================
*
* Keith Packard (keithp@suse.com)
* 64bit code is no longer supported; it requires DIX support
* for repadding images which significantly impacts performance
*/
/*
* PSZ needs to be defined before we get here. Usually it comes from a
* -DPSZ=foo on the compilation command line.
*/
#ifndef PSZ
#define PSZ 8
#endif
/*
* PixelGroup is the data type used to operate on groups of pixels.
* We typedef it here to CARD32 with the assumption that you
* want to manipulate 32 bits worth of pixels at a time as you can. If CARD32
* is not appropriate for your server, define it to something else
* before including this file. In this case you will also have to define
* PGSZB to the size in bytes of PixelGroup.
*/
#ifndef PixelGroup
#define PixelGroup CARD32
#define PGSZB 4
#endif /* PixelGroup */
#ifndef CfbBits
#define CfbBits CARD32
#endif
#define PGSZ (PGSZB << 3)
#define PPW (PGSZ/PSZ)
#define PLST (PPW-1)
#define PIM PLST
#define PMSK (((PixelGroup)1 << PSZ) - 1)
#define PPWMSK (((PixelGroup)1 << PPW) - 1) /* instead of BITMSK */
#define PGSZBMSK (((PixelGroup)1 << PGSZB) - 1)
/* set PWSH = log2(PPW) using brute force */
#if PPW == 1
#define PWSH 0
#else
#if PPW == 2
#define PWSH 1
#else
#if PPW == 4
#define PWSH 2
#else
#if PPW == 8
#define PWSH 3
#else
#if PPW == 16
#define PWSH 4
#endif /* PPW == 16 */
#endif /* PPW == 8 */
#endif /* PPW == 4 */
#endif /* PPW == 2 */
#endif /* PPW == 1 */
/* Defining PIXEL_ADDR means that individual pixels are addressable by this
* machine (as type PixelType). A possible CFB architecture which supported
* 8-bits-per-pixel on a non byte-addressable machine would not have this
* defined.
*
* Defining FOUR_BIT_CODE means that cfb knows how to stipple on this machine;
* eventually, stippling code for 16 and 32 bit devices should be written
* which would allow them to also use FOUR_BIT_CODE. There isn't that
* much to do in those cases, but it would make them quite a bit faster.
*/
#if PSZ == 8
#define PIXEL_ADDR
typedef CARD8 PixelType;
#define FOUR_BIT_CODE
#endif
#if PSZ == 16
#define PIXEL_ADDR
typedef CARD16 PixelType;
#endif
#if PSZ == 24
#undef PMSK
#define PMSK 0xFFFFFF
/*#undef PIM
#define PIM 3*/
#define PIXEL_ADDR
typedef CARD32 PixelType;
#endif
#if PSZ == 32
#undef PMSK
#define PMSK 0xFFFFFFFF
#define PIXEL_ADDR
typedef CARD32 PixelType;
#endif
/* the following notes use the following conventions:
SCREEN LEFT SCREEN RIGHT
in this file and maskbits.c, left and right refer to screen coordinates,
NOT bit numbering in registers.
cfbstarttab[n]
pixels[0,n-1] = 0's pixels[n,PPW-1] = 1's
cfbendtab[n] =
pixels[0,n-1] = 1's pixels[n,PPW-1] = 0's
cfbstartpartial[], cfbendpartial[]
these are used as accelerators for doing putbits and masking out
bits that are all contained between longword boudaries. the extra
256 bytes of data seems a small price to pay -- code is smaller,
and narrow things (e.g. window borders) go faster.
the names may seem misleading; they are derived not from which end
of the word the bits are turned on, but at which end of a scanline
the table tends to be used.
look at the tables and macros to understand boundary conditions.
(careful readers will note that starttab[n] = ~endtab[n] for n != 0)
-----------------------------------------------------------------------
these two macros depend on the screen's bit ordering.
in both of them x is a screen position. they are used to
combine bits collected from multiple longwords into a
single destination longword, and to unpack a single
source longword into multiple destinations.
SCRLEFT(dst, x)
takes dst[x, PPW] and moves them to dst[0, PPW-x]
the contents of the rest of dst are 0 ONLY IF
dst is UNSIGNED.
is cast as an unsigned.
this is a right shift on the VAX, left shift on
Sun and pc-rt.
SCRRIGHT(dst, x)
takes dst[0,x] and moves them to dst[PPW-x, PPW]
the contents of the rest of dst are 0 ONLY IF
dst is UNSIGNED.
this is a left shift on the VAX, right shift on
Sun and pc-rt.
the remaining macros are cpu-independent; all bit order dependencies
are built into the tables and the two macros above.
maskbits(x, w, startmask, endmask, nlw)
for a span of width w starting at position x, returns
a mask for ragged pixels at start, mask for ragged pixels at end,
and the number of whole longwords between the ends.
maskpartialbits(x, w, mask)
works like maskbits(), except all the pixels are in the
same longword (i.e. (x&0xPIM + w) <= PPW)
mask32bits(x, w, startmask, endmask, nlw)
as maskbits, but does not calculate nlw. it is used by
cfbGlyphBlt to put down glyphs <= PPW bits wide.
getbits(psrc, x, w, dst)
starting at position x in psrc (x < PPW), collect w
pixels and put them in the screen left portion of dst.
psrc is a longword pointer. this may span longword boundaries.
it special-cases fetching all w bits from one longword.
+--------+--------+ +--------+
| | m |n| | ==> | m |n| |
+--------+--------+ +--------+
x x+w 0 w
psrc psrc+1 dst
m = PPW - x
n = w - m
implementation:
get m pixels, move to screen-left of dst, zeroing rest of dst;
get n pixels from next word, move screen-right by m, zeroing
lower m pixels of word.
OR the two things together.
putbits(src, x, w, pdst, planemask)
starting at position x in pdst, put down the screen-leftmost
w bits of src. pdst is a longword pointer. this may
span longword boundaries.
it special-cases putting all w bits into the same longword.
+--------+ +--------+--------+
| m |n| | ==> | | m |n| |
+--------+ +--------+--------+
0 w x x+w
dst pdst pdst+1
m = PPW - x
n = w - m
implementation:
get m pixels, shift screen-right by x, zero screen-leftmost x
pixels; zero rightmost m bits of *pdst and OR in stuff
from before the semicolon.
shift src screen-left by m, zero bits n-32;
zero leftmost n pixels of *(pdst+1) and OR in the
stuff from before the semicolon.
putbitsrop(src, x, w, pdst, planemask, ROP)
like putbits but calls DoRop with the rasterop ROP (see cfb.h for
DoRop)
getleftbits(psrc, w, dst)
get the leftmost w (w<=PPW) bits from *psrc and put them
in dst. this is used by the cfbGlyphBlt code for glyphs
<=PPW bits wide.
*/
#if (BITMAP_BIT_ORDER == MSBFirst)
#define BitRight(lw,n) ((lw) >> (n))
#define BitLeft(lw,n) ((lw) << (n))
#else /* (BITMAP_BIT_ORDER == LSBFirst) */
#define BitRight(lw,n) ((lw) << (n))
#define BitLeft(lw,n) ((lw) >> (n))
#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
#define SCRLEFT(lw, n) BitLeft (lw, (n) * PSZ)
#define SCRRIGHT(lw, n) BitRight(lw, (n) * PSZ)
/*
* Note that the shift direction is independent of the byte ordering of the
* machine. The following is portable code.
*/
#if PPW == 16
#define PFILL(p) ( ((p)&PMSK) | \
((p)&PMSK) << PSZ | \
((p)&PMSK) << 2*PSZ | \
((p)&PMSK) << 3*PSZ | \
((p)&PMSK) << 4*PSZ | \
((p)&PMSK) << 5*PSZ | \
((p)&PMSK) << 6*PSZ | \
((p)&PMSK) << 7*PSZ | \
((p)&PMSK) << 8*PSZ | \
((p)&PMSK) << 9*PSZ | \
((p)&PMSK) << 10*PSZ | \
((p)&PMSK) << 11*PSZ | \
((p)&PMSK) << 12*PSZ | \
((p)&PMSK) << 13*PSZ | \
((p)&PMSK) << 14*PSZ | \
((p)&PMSK) << 15*PSZ )
#define PFILL2(p, pf) { \
pf = (p) & PMSK; \
pf |= (pf << PSZ); \
pf |= (pf << 2*PSZ); \
pf |= (pf << 4*PSZ); \
pf |= (pf << 8*PSZ); \
}
#endif /* PPW == 16 */
#if PPW == 8
#define PFILL(p) ( ((p)&PMSK) | \
((p)&PMSK) << PSZ | \
((p)&PMSK) << 2*PSZ | \
((p)&PMSK) << 3*PSZ | \
((p)&PMSK) << 4*PSZ | \
((p)&PMSK) << 5*PSZ | \
((p)&PMSK) << 6*PSZ | \
((p)&PMSK) << 7*PSZ )
#define PFILL2(p, pf) { \
pf = (p) & PMSK; \
pf |= (pf << PSZ); \
pf |= (pf << 2*PSZ); \
pf |= (pf << 4*PSZ); \
}
#endif
#if PPW == 4
#define PFILL(p) ( ((p)&PMSK) | \
((p)&PMSK) << PSZ | \
((p)&PMSK) << 2*PSZ | \
((p)&PMSK) << 3*PSZ )
#define PFILL2(p, pf) { \
pf = (p) & PMSK; \
pf |= (pf << PSZ); \
pf |= (pf << 2*PSZ); \
}
#endif
#if PPW == 2
#define PFILL(p) ( ((p)&PMSK) | \
((p)&PMSK) << PSZ )
#define PFILL2(p, pf) { \
pf = (p) & PMSK; \
pf |= (pf << PSZ); \
}
#endif
#if PPW == 1
#define PFILL(p) (p)
#define PFILL2(p,pf) (pf = (p))
#endif
/*
* Reduced raster op - using precomputed values, perform the above
* in three instructions
*/
#define DoRRop(dst, and, xor) (((dst) & (and)) ^ (xor))
#define DoMaskRRop(dst, and, xor, mask) \
(((dst) & ((and) | ~(mask))) ^ (xor & mask))
#if PSZ != 32 || PPW != 1
# if (PSZ == 24 && PPW == 1)
#define maskbits(x, w, startmask, endmask, nlw) {\
startmask = cfbstarttab[(x)&3]; \
endmask = cfbendtab[((x)+(w)) & 3]; \
nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \
}
#define mask32bits(x, w, startmask, endmask) \
startmask = cfbstarttab[(x)&3]; \
endmask = cfbendtab[((x)+(w)) & 3];
#define maskpartialbits(x, w, mask) \
mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3];
#define maskbits24(x, w, startmask, endmask, nlw) \
startmask = cfbstarttab24[(x) & 3]; \
endmask = cfbendtab24[((x)+(w)) & 3]; \
if (startmask){ \
nlw = (((w) - (4 - ((x) & 3))) >> 2); \
} else { \
nlw = (w) >> 2; \
}
#define getbits24(psrc, dst, index) {\
register int idx; \
switch(idx = ((index)&3)<<1){ \
case 0: \
dst = (*(psrc) &cfbmask[idx]); \
break; \
case 6: \
dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \
break; \
default: \
dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \
BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
}; \
}
#define putbits24(src, w, pdst, planemask, index) {\
register PixelGroup dstpixel; \
register unsigned int idx; \
switch(idx = ((index)&3)<<1){ \
case 0: \
dstpixel = (*(pdst) &cfbmask[idx]); \
break; \
case 6: \
dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
break; \
default: \
dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
}; \
dstpixel &= ~(planemask); \
dstpixel |= (src & planemask); \
*(pdst) &= cfbrmask[idx]; \
switch(idx){ \
case 0: \
*(pdst) |= (dstpixel & cfbmask[idx]); \
break; \
case 2: \
case 4: \
pdst++;idx++; \
*(pdst) = ((*(pdst)) & cfbrmask[idx]) | \
(BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
pdst--;idx--; \
case 6: \
*(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
break; \
}; \
}
#define putbitsrop24(src, x, pdst, planemask, rop) \
{ \
register PixelGroup t1, dstpixel; \
register unsigned int idx; \
switch(idx = (x)<<1){ \
case 0: \
dstpixel = (*(pdst) &cfbmask[idx]); \
break; \
case 6: \
dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
break; \
default: \
dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
}; \
DoRop(t1, rop, (src), dstpixel); \
dstpixel &= ~planemask; \
dstpixel |= (t1 & planemask); \
*(pdst) &= cfbrmask[idx]; \
switch(idx){ \
case 0: \
*(pdst) |= (dstpixel & cfbmask[idx]); \
break; \
case 2: \
case 4: \
*((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \
(BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \
case 6: \
*(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
}; \
}
# else /* PSZ == 24 && PPW == 1 */
#define maskbits(x, w, startmask, endmask, nlw) \
startmask = cfbstarttab[(x)&PIM]; \
endmask = cfbendtab[((x)+(w)) & PIM]; \
if (startmask) \
nlw = (((w) - (PPW - ((x)&PIM))) >> PWSH); \
else \
nlw = (w) >> PWSH;
#define maskpartialbits(x, w, mask) \
mask = cfbstartpartial[(x) & PIM] & cfbendpartial[((x) + (w)) & PIM];
#define mask32bits(x, w, startmask, endmask) \
startmask = cfbstarttab[(x)&PIM]; \
endmask = cfbendtab[((x)+(w)) & PIM];
/* FIXME */
#define maskbits24(x, w, startmask, endmask, nlw) \
abort()
#define getbits24(psrc, dst, index) \
abort()
#define putbits24(src, w, pdst, planemask, index) \
abort()
#define putbitsrop24(src, x, pdst, planemask, rop) \
abort()
#endif /* PSZ == 24 && PPW == 1 */
#define getbits(psrc, x, w, dst) \
if ( ((x) + (w)) <= PPW) \
{ \
dst = SCRLEFT(*(psrc), (x)); \
} \
else \
{ \
int m; \
m = PPW-(x); \
dst = (SCRLEFT(*(psrc), (x)) & cfbendtab[m]) | \
(SCRRIGHT(*((psrc)+1), m) & cfbstarttab[m]); \
}
#define putbits(src, x, w, pdst, planemask) \
if ( ((x)+(w)) <= PPW) \
{ \
PixelGroup tmpmask; \
maskpartialbits((x), (w), tmpmask); \
tmpmask &= PFILL(planemask); \
*(pdst) = (*(pdst) & ~tmpmask) | (SCRRIGHT(src, x) & tmpmask); \
} \
else \
{ \
unsigned int m; \
unsigned int n; \
PixelGroup pm = PFILL(planemask); \
m = PPW-(x); \
n = (w) - m; \
*(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | \
(SCRRIGHT(src, x) & (cfbstarttab[x] & pm)); \
*((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \
(SCRLEFT(src, m) & (cfbendtab[n] & pm)); \
}
#if defined(__GNUC__) && defined(mc68020)
#undef getbits
#define FASTGETBITS(psrc, x, w, dst) \
asm ("bfextu %3{%1:%2},%0" \
: "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
#define getbits(psrc,x,w,dst) \
{ \
FASTGETBITS(psrc, (x) * PSZ, (w) * PSZ, dst); \
dst = SCRLEFT(dst,PPW-(w)); \
}
#define FASTPUTBITS(src, x, w, pdst) \
asm ("bfins %3,%0{%1:%2}" \
: "=o" (*(char *)(pdst)) \
: "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
#undef putbits
#define putbits(src, x, w, pdst, planemask) \
{ \
if (planemask != PMSK) { \
PixelGroup _m, _pm; \
FASTGETBITS(pdst, (x) * PSZ , (w) * PSZ, _m); \
PFILL2(planemask, _pm); \
_m &= (~_pm); \
_m |= (SCRRIGHT(src, PPW-(w)) & _pm); \
FASTPUTBITS(_m, (x) * PSZ, (w) * PSZ, pdst); \
} else { \
FASTPUTBITS(SCRRIGHT(src, PPW-(w)), (x) * PSZ, (w) * PSZ, pdst); \
} \
}
#endif /* mc68020 */
#define putbitsrop(src, x, w, pdst, planemask, rop) \
if ( ((x)+(w)) <= PPW) \
{ \
PixelGroup tmpmask; \
PixelGroup t1, t2; \
maskpartialbits((x), (w), tmpmask); \
PFILL2(planemask, t1); \
tmpmask &= t1; \
t1 = SCRRIGHT((src), (x)); \
DoRop(t2, rop, t1, *(pdst)); \
*(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
} \
else \
{ \
CfbBits m; \
CfbBits n; \
PixelGroup t1, t2; \
PixelGroup pm; \
PFILL2(planemask, pm); \
m = PPW-(x); \
n = (w) - m; \
t1 = SCRRIGHT((src), (x)); \
DoRop(t2, rop, t1, *(pdst)); \
*(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | (t2 & (cfbstarttab[x] & pm));\
t1 = SCRLEFT((src), m); \
DoRop(t2, rop, t1, *((pdst) + 1)); \
*((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \
(t2 & (cfbendtab[n] & pm)); \
}
#else /* PSZ == 32 && PPW == 1*/
/*
* These macros can be optimized for 32-bit pixels since there is no
* need to worry about left/right edge masking. These macros were
* derived from the above using the following reductions:
*
* - x & PIW = 0 [since PIW = 0]
* - all masking tables are only indexed by 0 [ due to above ]
* - cfbstartab[0] and cfbendtab[0] = 0 [ no left/right edge masks]
* - cfbstartpartial[0] and cfbendpartial[0] = ~0 [no partial pixel mask]
*
* Macro reduction based upon constants cannot be performed automatically
* by the compiler since it does not know the contents of the masking
* arrays in cfbmskbits.c.
*/
#define maskbits(x, w, startmask, endmask, nlw) \
startmask = endmask = 0; \
nlw = (w);
#define maskpartialbits(x, w, mask) \
mask = 0xFFFFFFFF;
#define mask32bits(x, w, startmask, endmask) \
startmask = endmask = 0;
/*
* For 32-bit operations, getbits(), putbits(), and putbitsrop()
* will only be invoked with x = 0 and w = PPW (1). The getbits()
* macro is only called within left/right edge logic, which doesn't
* happen for 32-bit pixels.
*/
#define getbits(psrc, x, w, dst) (dst) = *(psrc)
#define putbits(src, x, w, pdst, planemask) \
*(pdst) = (*(pdst) & ~planemask) | (src & planemask);
#define putbitsrop(src, x, w, pdst, planemask, rop) \
{ \
PixelGroup t1; \
DoRop(t1, rop, (src), *(pdst)); \
*(pdst) = (*(pdst) & ~planemask) | (t1 & planemask); \
}
#endif /* PSZ != 32 */
/*
* Use these macros only when you're using the MergeRop stuff
* in ../mfb/mergerop.h
*/
/* useful only when not spanning destination longwords */
#if PSZ == 24
#define putbitsmropshort24(src,x,w,pdst,index) {\
PixelGroup _tmpmask; \
PixelGroup _t1; \
maskpartialbits ((x), (w), _tmpmask); \
_t1 = SCRRIGHT((src), (x)); \
DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \
}
#endif
#define putbitsmropshort(src,x,w,pdst) {\
PixelGroup _tmpmask; \
PixelGroup _t1; \
maskpartialbits ((x), (w), _tmpmask); \
_t1 = SCRRIGHT((src), (x)); \
*pdst = DoMaskMergeRop(_t1, *pdst, _tmpmask); \
}
/* useful only when spanning destination longwords */
#define putbitsmroplong(src,x,w,pdst) { \
PixelGroup _startmask, _endmask; \
int _m; \
PixelGroup _t1; \
_m = PPW - (x); \
_startmask = cfbstarttab[x]; \
_endmask = cfbendtab[(w) - _m]; \
_t1 = SCRRIGHT((src), (x)); \
pdst[0] = DoMaskMergeRop(_t1,pdst[0],_startmask); \
_t1 = SCRLEFT ((src),_m); \
pdst[1] = DoMaskMergeRop(_t1,pdst[1],_endmask); \
}
#define putbitsmrop(src,x,w,pdst) \
if ((x) + (w) <= PPW) {\
putbitsmropshort(src,x,w,pdst); \
} else { \
putbitsmroplong(src,x,w,pdst); \
}
#if GETLEFTBITS_ALIGNMENT == 1
#define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc)
#define getleftbits24(psrc, w, dst, idx){ \
regiseter int index; \
switch(index = ((idx)&3)<<1){ \
case 0: \
dst = (*((unsigned int *) psrc))&cfbmask[index]; \
break; \
case 2: \
case 4: \
dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \
dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \
break; \
case 6: \
dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \
break; \
}; \
}
#endif /* GETLEFTBITS_ALIGNMENT == 1 */
#define getglyphbits(psrc, x, w, dst) \
{ \
dst = BitLeft((unsigned) *(psrc), (x)); \
if ( ((x) + (w)) > 32) \
dst |= (BitRight((unsigned) *((psrc)+1), 32-(x))); \
}
#if GETLEFTBITS_ALIGNMENT == 2
#define getleftbits(psrc, w, dst) \
{ \
if ( ((int)(psrc)) & 0x01 ) \
getglyphbits( ((unsigned int *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
else \
dst = *((unsigned int *) psrc); \
}
#endif /* GETLEFTBITS_ALIGNMENT == 2 */
#if GETLEFTBITS_ALIGNMENT == 4
#define getleftbits(psrc, w, dst) \
{ \
int off, off_b; \
off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \
getglyphbits( \
(unsigned int *)( ((char *)(psrc)) - off), \
(off_b), (w), (dst) \
); \
}
#endif /* GETLEFTBITS_ALIGNMENT == 4 */
/*
* getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix )
*
* Converts bits to pixels in a reasonable way. Takes w (1 <= w <= PPW)
* bits from *psrcstip, starting at bit x; call this a quartet of bits.
* Then, takes the pixels from *psrcpix corresponding to the one-bits (if
* ones is TRUE) or the zero-bits (if ones is FALSE) of the quartet
* and puts these pixels into destpix.
*
* Example:
*
* getstipplepixels( &(0x08192A3B), 17, 4, 1, &(0x4C5D6E7F), dest )
*
* 0x08192A3B = 0000 1000 0001 1001 0010 1010 0011 1011
*
* This will take 4 bits starting at bit 17, so the quartet is 0x5 = 0101.
* It will take pixels from 0x4C5D6E7F corresponding to the one-bits in this
* quartet, so dest = 0x005D007F.
*
* XXX Works with both byte order.
* XXX This works for all values of x and w within a doubleword.
*/
#if (BITMAP_BIT_ORDER == MSBFirst)
#define getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) \
{ \
PixelGroup q; \
int m; \
if ((m = ((x) - ((PPW*PSZ)-PPW))) > 0) { \
q = (*(psrcstip)) << m; \
if ( (x)+(w) > (PPW*PSZ) ) \
q |= *((psrcstip)+1) >> ((PPW*PSZ)-m); \
} \
else \
q = (*(psrcstip)) >> -m; \
q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
*(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
}
/* I just copied this to get the linker satisfied on PowerPC,
* so this may not be correct at all.
*/
#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
{ \
PixelGroup q; \
q = *(psrcstip) >> (xt); \
q = ((ones) ? q : ~q) & 1; \
*(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
}
#else /* BITMAP_BIT_ORDER == LSB */
/* this must load 32 bits worth; for most machines, thats an int */
#define CfbFetchUnaligned(x) ldl_u(x)
#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \
{ \
PixelGroup q; \
q = CfbFetchUnaligned(psrcstip) >> (xt); \
if ( ((xt)+(w)) > (PPW*PSZ) ) \
q |= (CfbFetchUnaligned((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \
q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
*(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
}
#if PSZ == 24
#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
{ \
PixelGroup q; \
q = *(psrcstip) >> (xt); \
q = ((ones) ? q : ~q) & 1; \
*(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
}
#endif /* PSZ == 24 */
#endif
extern PixelGroup cfbstarttab[];
extern PixelGroup cfbendtab[];
extern PixelGroup cfbstartpartial[];
extern PixelGroup cfbendpartial[];
extern PixelGroup cfbrmask[];
extern PixelGroup cfbmask[];
extern PixelGroup QuartetBitsTable[];
extern PixelGroup QuartetPixelMaskTable[];
#if PSZ == 24
extern int cfb24Shift[];
#endif

View file

@ -1,375 +0,0 @@
/***********************************************************
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.
******************************************************************/
/* pixmap management
written by drewry, september 1986
on a monchrome device, a pixmap is a bitmap.
*/
#include <string.h>
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/Xmd.h>
#include "servermd.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "mi.h"
#include "cfb.h"
#include "cfbmskbits.h"
PixmapPtr
cfbCreatePixmap (pScreen, width, height, depth, usage_hint)
ScreenPtr pScreen;
int width;
int height;
int depth;
unsigned usage_hint;
{
PixmapPtr pPixmap;
size_t datasize;
size_t paddedWidth;
paddedWidth = PixmapBytePad(width, depth);
if (paddedWidth / 4 > 32767 || height > 32767)
return NullPixmap;
datasize = height * paddedWidth;
pPixmap = AllocatePixmap(pScreen, datasize);
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
pPixmap->drawable.class = 0;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
pPixmap->drawable.id = 0;
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->drawable.x = 0;
pPixmap->drawable.y = 0;
pPixmap->drawable.width = width;
pPixmap->drawable.height = height;
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
pPixmap->devPrivate.ptr = datasize ?
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
pPixmap->usage_hint = usage_hint;
return pPixmap;
}
Bool
cfbDestroyPixmap(pPixmap)
PixmapPtr pPixmap;
{
if(--pPixmap->refcnt)
return TRUE;
dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
return TRUE;
}
PixmapPtr
cfbCopyPixmap(pSrc)
register PixmapPtr pSrc;
{
register PixmapPtr pDst;
int size;
ScreenPtr pScreen;
size = pSrc->drawable.height * pSrc->devKind;
pScreen = pSrc->drawable.pScreen;
pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width,
pSrc->drawable.height, pSrc->drawable.depth, 0);
if (!pDst)
return NullPixmap;
memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
return pDst;
}
/* replicates a pattern to be a full 32 bits wide.
relies on the fact that each scnaline is longword padded.
doesn't do anything if pixmap is not a factor of 32 wide.
changes width field of pixmap if successful, so that the fast
cfbXRotatePixmap code gets used if we rotate the pixmap later.
cfbYRotatePixmap code gets used if we rotate the pixmap later.
calculate number of times to repeat
for each scanline of pattern
zero out area to be filled with replicate
left shift and or in original as many times as needed
*/
void
cfbPadPixmap(pPixmap)
PixmapPtr pPixmap;
{
register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel);
register int h;
register CfbBits mask;
register CfbBits *p;
register CfbBits bits; /* real pattern bits */
register int i;
int rep; /* repeat count for pattern */
if (width >= PGSZ)
return;
rep = PGSZ/width;
if (rep*width != PGSZ)
return;
mask = mfbGetendtab(width);
p = (CfbBits *)(pPixmap->devPrivate.ptr);
for (h=0; h < pPixmap->drawable.height; h++)
{
*p &= mask;
bits = *p;
for(i=1; i<rep; i++)
{
#if (BITMAP_BIT_ORDER == MSBFirst)
bits >>= width;
#else
bits <<= width;
#endif
*p |= bits;
}
p++;
}
pPixmap->drawable.width = PGSZ/(pPixmap->drawable.bitsPerPixel);
}
#ifdef notdef
/*
* cfb debugging routine -- assumes pixmap is 1 byte deep
*/
static cfbdumppixmap(pPix)
PixmapPtr pPix;
{
unsigned int *pw;
char *psrc, *pdst;
int i, j;
char line[66];
ErrorF( "pPixmap: 0x%x\n", pPix);
ErrorF( "%d wide %d high\n", pPix->drawable.width, pPix->drawable.height);
if (pPix->drawable.width > 64)
{
ErrorF( "too wide to see\n");
return;
}
pw = (unsigned int *) pPix->devPrivate.ptr;
psrc = (char *) pw;
/*
for ( i=0; i<pPix->drawable.height; ++i )
ErrorF( "0x%x\n", pw[i] );
*/
for ( i = 0; i < pPix->drawable.height; ++i ) {
pdst = line;
for(j = 0; j < pPix->drawable.width; j++) {
*pdst++ = *psrc++ ? 'X' : ' ' ;
}
*pdst++ = '\n';
*pdst++ = '\0';
ErrorF( "%s", line);
}
}
#endif /* notdef */
/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
* words are PGSZ bits wide, and that the least significant bit appears on the
* left.
*/
void
cfbXRotatePixmap(pPix, rw)
PixmapPtr pPix;
register int rw;
{
register CfbBits *pw, *pwFinal;
register CfbBits t;
int rot;
if (pPix == NullPixmap)
return;
switch (((DrawablePtr) pPix)->bitsPerPixel) {
case PSZ:
break;
case 1:
mfbXRotatePixmap(pPix, rw);
return;
default:
ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
return;
}
pw = (CfbBits *)pPix->devPrivate.ptr;
modulus (rw, (int) pPix->drawable.width, rot);
if(pPix->drawable.width == PPW)
{
pwFinal = pw + pPix->drawable.height;
while(pw < pwFinal)
{
t = *pw;
*pw++ = SCRRIGHT(t, rot) |
(SCRLEFT(t, (PPW-rot)) & cfbendtab[rot]);
}
}
else
{
ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n");
#ifdef notdef
register CfbBits *pwTmp;
int size, tsize;
tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth);
pwTmp = (CfbBits *) xalloc(pPix->drawable.height * tsize);
if (!pwTmp)
return;
/* divide pw (the pixmap) in two vertically at (w - rot) and swap */
tsize >>= 2;
size = pPix->devKind >> SIZE0F(PixelGroup);
cfbQuickBlt((CfbBits *)pw, (CfbBits *)pwTmp,
0, 0, 0, 0,
(int)pPix->drawable.width - rot, (int)pPix->drawable.height,
size, tsize);
cfbQuickBlt((CfbBits *)pw, (CfbBits *)pw,
(int)pPix->drawable.width - rot, 0, 0, 0,
rot, (int)pPix->drawable.height,
size, size);
cfbQuickBlt((CfbBits *)pwTmp, (CfbBits *)pw,
0, 0, rot, 0,
(int)pPix->drawable.width - rot, (int)pPix->drawable.height,
tsize, size);
xfree(pwTmp);
#endif
}
}
/* Rotates pixmap pPix by h lines. Assumes that h is always less than
pPix->drawable.height
works on any width.
*/
void
cfbYRotatePixmap(pPix, rh)
register PixmapPtr pPix;
int rh;
{
int nbyDown; /* bytes to move down to row 0; also offset of
row rh */
int nbyUp; /* bytes to move up to line rh; also
offset of first line moved down to 0 */
char *pbase;
char *ptmp;
int rot;
if (pPix == NullPixmap)
return;
switch (((DrawablePtr) pPix)->bitsPerPixel) {
case PSZ:
break;
case 1:
mfbYRotatePixmap(pPix, rh);
return;
default:
ErrorF("cfbYRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
return;
}
modulus (rh, (int) pPix->drawable.height, rot);
pbase = (char *)pPix->devPrivate.ptr;
nbyDown = rot * pPix->devKind;
nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown;
if(!(ptmp = (char *)xalloc(nbyUp)))
return;
memmove(ptmp, pbase, nbyUp); /* save the low rows */
memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */
xfree(ptmp);
}
void
cfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
register PixmapPtr psrcPix, *ppdstPix;
int xrot, yrot;
{
register PixmapPtr pdstPix;
if ((pdstPix = *ppdstPix) &&
(pdstPix->devKind == psrcPix->devKind) &&
(pdstPix->drawable.height == psrcPix->drawable.height))
{
memmove((char *)pdstPix->devPrivate.ptr,
(char *)psrcPix->devPrivate.ptr,
psrcPix->drawable.height * psrcPix->devKind);
pdstPix->drawable.width = psrcPix->drawable.width;
pdstPix->drawable.depth = psrcPix->drawable.depth;
pdstPix->drawable.bitsPerPixel = psrcPix->drawable.bitsPerPixel;
pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
}
else
{
if (pdstPix)
/* FIX XBUG 6168 */
(*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
*ppdstPix = pdstPix = cfbCopyPixmap(psrcPix);
if (!pdstPix)
return;
}
cfbPadPixmap(pdstPix);
if (xrot)
cfbXRotatePixmap(pdstPix, xrot);
if (yrot)
cfbYRotatePixmap(pdstPix, yrot);
}

View file

@ -1,363 +0,0 @@
/*
*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "scrnintstr.h"
#include "mistruct.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfbrrop.h"
void
RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
DrawablePtr pDrawable;
GCPtr pGC;
int shape;
int mode;
int count;
DDXPointPtr ptsIn;
{
cfbPrivGCPtr devPriv;
int nwidth;
CfbBits *addrl, *addr;
#if PSZ == 24
CfbBits startmask, endmask;
register int pidx;
#else
#if PPW > 1
CfbBits mask, bits = ~((CfbBits)0);
#endif
#endif
int maxy;
int origin;
register int vertex1, vertex2;
int c = 0;
BoxPtr extents;
int clip;
int y;
int *vertex1p = NULL, *vertex2p;
int *endp;
int x1 = 0, x2 = 0;
int dx1 = 0, dx2 = 0;
int dy1 = 0, dy2 = 0;
int e1 = 0, e2 = 0;
int step1 = 0, step2 = 0;
int sign1 = 0, sign2 = 0;
int h;
int l;
#if PSZ != 24 && PPW > 1
int r;
#endif
int nmiddle;
RROP_DECLARE
if (mode == CoordModePrevious)
{
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
return;
}
devPriv = cfbGetGCPrivate(pGC);
#ifdef NO_ONE_RECT
if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
{
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
return;
}
#endif
origin = *((int *) &pDrawable->x);
vertex2 = origin - ((origin & 0x8000) << 1);
extents = &pGC->pCompositeClip->extents;
RROP_FETCH_GCPRIV(devPriv);
vertex1 = *((int *) &extents->x1) - vertex2;
vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
clip = 0;
y = 32767;
maxy = 0;
vertex2p = (int *) ptsIn;
endp = vertex2p + count;
if (shape == Convex)
{
while (count--)
{
c = *vertex2p;
clip |= (c - vertex1) | (vertex2 - c);
c = intToY(c);
if (c < y)
{
y = c;
vertex1p = vertex2p;
}
vertex2p++;
if (c > maxy)
maxy = c;
}
}
else
{
int yFlip = 0;
dx1 = 1;
x2 = -1;
x1 = -1;
while (count--)
{
c = *vertex2p;
clip |= (c - vertex1) | (vertex2 - c);
c = intToY(c);
if (c < y)
{
y = c;
vertex1p = vertex2p;
}
vertex2p++;
if (c > maxy)
maxy = c;
if (c == x1)
continue;
if (dx1 > 0)
{
if (x2 < 0)
x2 = c;
else
dx2 = dx1 = (c - x1) >> 31;
}
else
if ((c - x1) >> 31 != dx1)
{
dx1 = ~dx1;
yFlip++;
}
x1 = c;
}
x1 = (x2 - c) >> 31;
if (x1 != dx1)
yFlip++;
if (x1 != dx2)
yFlip++;
if (yFlip != 2)
clip = 0x8000;
}
if (y == maxy)
return;
if (clip & 0x80008000)
{
miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
return;
}
#define AddrYPlus(a,y) (CfbBits *) (((unsigned char *) (a)) + (y) * nwidth)
cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, CfbBits);
addrl = AddrYPlus(addrl,y + pDrawable->y);
origin = intToX(origin);
vertex2p = vertex1p;
vertex2 = vertex1 = *vertex2p++;
if (vertex2p == endp)
vertex2p = (int *) ptsIn;
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
x = intToX(vertex); \
if ((dy = intToY(c) - y)) { \
dx = intToX(c) - x; \
step = 0; \
if (dx >= 0) \
{ \
e = 0; \
sign = 1; \
if (dx >= dy) {\
step = dx / dy; \
dx = dx % dy; \
} \
} \
else \
{ \
e = 1 - dy; \
sign = -1; \
dx = -dx; \
if (dx >= dy) { \
step = - (dx / dy); \
dx = dx % dy; \
} \
} \
} \
x += origin; \
vertex = c; \
}
#define Step(x,dx,dy,e,sign,step) {\
x += step; \
if ((e += dx) > 0) \
{ \
x += sign; \
e -= dy; \
} \
}
for (;;)
{
if (y == intToY(vertex1))
{
do
{
if (vertex1p == (int *) ptsIn)
vertex1p = endp;
c = *--vertex1p;
Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
} while (y >= intToY(vertex1));
h = dy1;
}
else
{
Step(x1,dx1,dy1,e1,sign1,step1)
h = intToY(vertex1) - y;
}
if (y == intToY(vertex2))
{
do
{
c = *vertex2p++;
if (vertex2p == endp)
vertex2p = (int *) ptsIn;
Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
} while (y >= intToY(vertex2));
if (dy2 < h)
h = dy2;
}
else
{
Step(x2,dx2,dy2,e2,sign2,step2)
if ((c = (intToY(vertex2) - y)) < h)
h = c;
}
/* fill spans for this segment */
y += h;
for (;;)
{
l = x1;
#if PSZ != 24 && PPW > 1
r = x2;
#endif
nmiddle = x2 - x1;
if (nmiddle < 0)
{
nmiddle = -nmiddle;
l = x2;
#if PSZ != 24 && PPW > 1
r = x1;
#endif
}
#if PPW > 1
c = l & PIM;
l -= c;
#endif
#if PGSZ == 32
#define LWRD_SHIFT 2
#else /* PGSZ == 64 */
#define LWRD_SHIFT 3
#endif /* PGSZ */
#if PSZ == 24
addr = (CfbBits *)((char *)addrl + ((l * 3) & ~0x03));
if (nmiddle <= 1){
if (nmiddle)
RROP_SOLID24(addr, l);
} else {
maskbits(l, nmiddle, startmask, endmask, nmiddle);
pidx = l & 3;
if (startmask){
RROP_SOLID_MASK(addr, startmask, pidx-1);
addr++;
if (pidx == 3)
pidx = 0;
}
while (--nmiddle >= 0){
RROP_SOLID(addr, pidx);
addr++;
if (++pidx == 3)
pidx = 0;
}
if (endmask)
RROP_SOLID_MASK(addr, endmask, pidx);
}
#else /* PSZ == 24 */
#if PWSH > LWRD_SHIFT
l = l >> (PWSH - LWRD_SHIFT);
#endif
#if PWSH < LWRD_SHIFT
l = l << (LWRD_SHIFT - PWSH);
#endif
addr = (CfbBits *) (((char *) addrl) + l);
#if PPW > 1
if (c + nmiddle < PPW)
{
mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
RROP_SOLID_MASK(addr,mask);
}
else
{
if (c)
{
mask = SCRRIGHT(bits, c);
RROP_SOLID_MASK(addr,mask);
nmiddle += c - PPW;
addr++;
}
#endif
nmiddle >>= PWSH;
while (--nmiddle >= 0) {
RROP_SOLID(addr); addr++;
}
#if PPW > 1
if ((mask = ~SCRRIGHT(bits, r & PIM)))
RROP_SOLID_MASK(addr,mask);
}
#endif
#endif /* PSZ == 24 */
if (!--h)
break;
addrl = AddrYPlus (addrl, 1);
Step(x1,dx1,dy1,e1,sign1,step1)
Step(x2,dx2,dy2,e2,sign2,step2)
}
if (y == maxy)
break;
addrl = AddrYPlus (addrl, 1);
}
RROP_UNDECLARE
}

View file

@ -1,202 +0,0 @@
/************************************************************
Copyright 1989, 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.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "scrnintstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
/* WARNING: pbox contains two shorts. This code assumes they are packed
* and can be referenced together as an INT32.
*/
#define PointLoop(fill) { \
for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \
--nbox >= 0; \
pbox++) \
{ \
c1 = *((INT32 *) &pbox->x1) - off; \
c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \
for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \
{ \
pt = *ppt++; \
if (!isClipped(pt,c1,c2)) { \
fill \
} \
} \
} \
}
#if PSZ == 24
# include "cfbrrop24.h"
#endif
void
cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
GCPtr pGC;
int mode;
int npt;
xPoint *pptInit;
{
register INT32 pt;
register INT32 c1, c2;
register CARD32 ClipMask = 0x80008000;
register CfbBits xor;
#ifdef PIXEL_ADDR
register PixelType *addrp;
register int npwidth;
#if PSZ != 24
PixelType *addrpt;
#endif
#else
register CfbBits *addrl;
register int nlwidth;
register int xoffset;
CfbBits *addrlt;
#endif
#if PSZ == 24
RROP_DECLARE
register int xtmp;
register PixelType *p;
#endif
register INT32 *ppt;
RegionPtr cclip;
int nbox;
register int i;
register BoxPtr pbox;
CfbBits and;
int rop = pGC->alu;
int off;
cfbPrivGCPtr devPriv;
xPoint *pptPrev;
devPriv =cfbGetGCPrivate(pGC);
rop = devPriv->rop;
if (rop == GXnoop)
return;
cclip = pGC->pCompositeClip;
xor = devPriv->xor;
if ((mode == CoordModePrevious) && (npt > 1))
{
for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++)
{
pptPrev->x += (pptPrev-1)->x;
pptPrev->y += (pptPrev-1)->y;
}
}
off = *((int *) &pDrawable->x);
off -= (off & 0x8000) << 1;
#ifdef PIXEL_ADDR
cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp);
#if PSZ == 24
addrp = addrp + pDrawable->y * npwidth;
#else
addrp = addrp + pDrawable->y * npwidth + pDrawable->x;
#endif
if (rop == GXcopy)
{
#if PSZ == 24
RROP_COPY_SETUP(xor)
#endif
if (!(npwidth & (npwidth - 1)))
{
npwidth = ffs(npwidth) - 1;
#if PSZ == 24
PointLoop(
xtmp = pDrawable->x + intToX(pt);
p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2);
RROP_SOLID24_COPY(p, xtmp))
#else
PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;)
#endif
}
#ifdef sun
else if (npwidth == 1152)
{
register int y;
PointLoop(y = intToY(pt); *(addrp + (y << 10) + (y << 7) + intToX(pt)) = xor;)
}
#endif
else
{
#if PSZ == 24
PointLoop(
xtmp = pDrawable->x + intToX(pt);
p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
RROP_SOLID24_COPY(p, xtmp))
#else
PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;)
#endif
}
}
else
{
and = devPriv->and;
#if PSZ == 24
RROP_SET_SETUP(xor, and)
PointLoop(
xtmp = pDrawable->x + intToX(pt);
p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
RROP_SOLID24_SET(p, xtmp))
#else
PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt);
*addrpt = DoRRop (*addrpt, and, xor);)
#endif
}
#else /* !PIXEL_ADDR */
cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl);
addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH);
xoffset = pDrawable->x & PIM;
and = devPriv->and;
#if PSZ == 24
PointLoop( addrlt = addrl + intToY(pt) * nlwidth
+ ((intToX(pt) + xoffset) >> PWSH);
*addrlt = DoRRop (*addrlt,
and | ~cfbmask[(intToX(pt) + xoffset) & PIM],
xor & cfbmask[(intToX(pt) + xoffset) & PIM]);
)
#else
PointLoop( addrlt = addrl + intToY(pt) * nlwidth
+ ((intToX(pt) + xoffset) >> PWSH);
*addrlt = DoRRop (*addrlt,
and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1],
xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]);
)
#endif
#endif /* PIXEL_ADDR */
}

View file

@ -1,184 +0,0 @@
/*
* Push Pixels for 8 bit displays.
*/
/*
Copyright 1989, 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#if PSZ == 8
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
#define MFB_CONSTS_ONLY
#include "maskbits.h"
void
cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
GCPtr pGC;
PixmapPtr pBitmap;
DrawablePtr pDrawable;
int dx, dy, xOrg, yOrg;
{
register CfbBits *src, *dst;
register CfbBits pixel;
register CfbBits c, bits;
CfbBits *pdstLine, *psrcLine;
CfbBits *pdstBase;
int srcWidth;
int dstWidth;
int xoff;
int nBitmapLongs, nPixmapLongs;
int nBitmapTmp, nPixmapTmp;
CfbBits rightMask;
BoxRec bbox;
cfbPrivGCPtr devPriv;
bbox.x1 = xOrg;
bbox.y1 = yOrg;
bbox.x2 = bbox.x1 + dx;
bbox.y2 = bbox.y1 + dy;
devPriv = cfbGetGCPrivate(pGC);
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
{
case rgnPART:
mfbPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg);
case rgnOUT:
return;
}
cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase)
psrcLine = (CfbBits *) pBitmap->devPrivate.ptr;
srcWidth = (int) pBitmap->devKind >> PWSH;
pixel = devPriv->xor;
xoff = xOrg & PIM;
nBitmapLongs = (dx + xoff) >> MFB_PWSH;
nPixmapLongs = (dx + PGSZB + xoff) >> PWSH;
rightMask = ~cfb8BitLenMasks[((dx + xoff) & MFB_PIM)];
pdstLine = pdstBase + (yOrg * dstWidth) + (xOrg >> PWSH);
while (dy--)
{
c = 0;
nPixmapTmp = nPixmapLongs;
nBitmapTmp = nBitmapLongs;
src = psrcLine;
dst = pdstLine;
while (nBitmapTmp--)
{
bits = *src++;
c |= BitRight (bits, xoff);
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
nPixmapTmp -= 8;
c = 0;
if (xoff)
c = BitLeft (bits, PGSZ - xoff);
}
if (BitLeft (rightMask, xoff))
c |= BitRight (*src, xoff);
c &= rightMask;
switch (nPixmapTmp) {
case 8:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 7:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 6:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 5:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 4:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 3:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 2:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 1:
WriteBitGroup(dst, pixel, GetBitGroup(c));
NextBitGroup(c);
dst++;
case 0:
break;
}
pdstLine += dstWidth;
psrcLine += srcWidth;
}
}
#endif

View file

@ -1,593 +0,0 @@
/*
* Fill 32 bit stippled rectangles for 8 bit frame buffers
*/
/*
Copyright 1989, 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.
Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#if PSZ == 8
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "gcstruct.h"
#include "window.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
#define MFB_CONSTS_ONLY
#include "maskbits.h"
void
cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
DrawablePtr pDrawable;
GCPtr pGC;
int nBox; /* number of boxes to fill */
register BoxPtr pBox; /* pointer to list of boxes to fill */
{
CfbBits *src;
int stippleHeight;
int nlwDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
register int h; /* height of current box */
CfbBits startmask;
CfbBits endmask; /* masks for reggedy bits at either end of line */
int nlwMiddle; /* number of longwords between sides of boxes */
register int nlw; /* loop version of nlwMiddle */
CfbBits *dstLine;
register CfbBits *dst; /* pointer to bits we're writing */
CfbBits *dstTmp;
int y; /* current scan line */
CfbBits *pbits;/* pointer to start of pixmap */
register CfbBits bits; /* bits from stipple */
int rot;
register CfbBits xor;
PixmapPtr stipple;
int wEnd;
stipple = pGC->pRotatedPixmap;
cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
stippleHeight = stipple->drawable.height;
src = (CfbBits *)stipple->devPrivate.ptr;
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
while (nBox--)
{
w = pBox->x2 - pBox->x1;
h = pBox->y2 - pBox->y1;
y = pBox->y1;
dstLine = pbits + (pBox->y1 * nlwDst) + ((pBox->x1 & ~PIM) >> PWSH);
if (((pBox->x1 & PIM) + w) <= PPW)
{
maskpartialbits(pBox->x1, w, startmask);
nlwMiddle = 0;
endmask = 0;
}
else
{
maskbits (pBox->x1, w, startmask, endmask, nlwMiddle);
}
rot = (pBox->x1 & ((PGSZ-1) & ~PIM));
pBox++;
y = y % stippleHeight;
#if PPW == 4
if (cfb8StippleRRop == GXcopy)
{
if (w < PGSZ*2)
{
while (h--)
{
bits = src[y];
y++;
if (y == stippleHeight)
y = 0;
if (rot)
RotBitsLeft(bits,rot);
dst = dstLine;
dstLine += nlwDst;
if (startmask)
{
*dst = (*dst & ~startmask) |
(GetPixelGroup (bits) & startmask);
dst++;
RotBitsLeft (bits, PGSZB);
}
nlw = nlwMiddle;
while (nlw--)
{
*dst++ = GetPixelGroup(bits);
RotBitsLeft (bits, PGSZB);
}
if (endmask)
{
*dst = (*dst & ~endmask) |
(GetPixelGroup (bits) & endmask);
}
}
}
else
{
wEnd = 7 - (nlwMiddle & 7);
nlwMiddle = (nlwMiddle >> 3) + 1;
while (h--)
{
bits = src[y];
y++;
if (y == stippleHeight)
y = 0;
if (rot != 0)
RotBitsLeft (bits, rot);
dstTmp = dstLine;
dstLine += nlwDst;
if (startmask)
{
*dstTmp = (*dstTmp & ~startmask) |
(GetPixelGroup (bits) & startmask);
dstTmp++;
RotBitsLeft (bits, PGSZB);
}
w = 7 - wEnd;
while (w--)
{
nlw = nlwMiddle;
dst = dstTmp;
dstTmp++;
xor = GetPixelGroup (bits);
while (nlw--)
{
*dst = xor;
dst += 8;
}
NextBitGroup (bits);
}
nlwMiddle--;
w = wEnd + 1;
if (endmask)
{
dst = dstTmp + (nlwMiddle << 3);
*dst = (*dst & ~endmask) |
(GetPixelGroup(bits) & endmask);
}
while (w--)
{
nlw = nlwMiddle;
dst = dstTmp;
dstTmp++;
xor = GetPixelGroup (bits);
while (nlw--)
{
*dst = xor;
dst += 8;
}
NextBitGroup (bits);
}
nlwMiddle++;
}
}
}
else
#endif /* PPW == 4 */
{
while (h--)
{
bits = src[y];
y++;
if (y == stippleHeight)
y = 0;
if (rot)
RotBitsLeft(bits,rot);
dst = dstLine;
dstLine += nlwDst;
if (startmask)
{
xor = GetBitGroup(bits);
*dst = MaskRRopPixels(*dst, xor, startmask);
dst++;
RotBitsLeft (bits, PGSZB);
}
nlw = nlwMiddle;
while (nlw--)
{
RRopBitGroup(dst, GetBitGroup(bits));
dst++;
RotBitsLeft (bits, PGSZB);
}
if (endmask)
{
xor = GetBitGroup(bits);
*dst = MaskRRopPixels(*dst, xor, endmask);
}
}
}
}
}
void
cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
DrawablePtr pDrawable;
GCPtr pGC;
int nBox; /* number of boxes to fill */
BoxPtr pBox; /* pointer to list of boxes to fill */
{
int x, y, w, h;
int nlwMiddle, nlwDst;
CfbBits startmask, endmask;
register CfbBits *dst;
CfbBits *dstLine, *pbits, *dstTmp;
CfbBits *src;
register CfbBits xor;
register CfbBits bits, mask;
int rot;
int wEnd;
cfbPrivGCPtr devPriv;
PixmapPtr stipple;
int stippleHeight;
register int nlw;
devPriv = cfbGetGCPrivate(pGC);
stipple = pGC->pRotatedPixmap;
src = (CfbBits *)stipple->devPrivate.ptr;
stippleHeight = stipple->drawable.height;
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
while (nBox--)
{
x = pBox->x1;
w = pBox->x2 - x;
if (((x & PIM) + w) <= PPW)
{
maskpartialbits(x, w, startmask);
endmask = 0;
nlwMiddle = 0;
}
else
{
maskbits (x, w, startmask, endmask, nlwMiddle);
}
rot = (x & ((PGSZ-1) & ~PIM));
y = pBox->y1;
dstLine = pbits + (y * nlwDst) + (x >> PWSH);
h = pBox->y2 - y;
pBox++;
y %= stippleHeight;
#if PPW == 4
if (cfb8StippleRRop == GXcopy)
{
xor = devPriv->xor;
if (w < PGSZ*2)
{
while (h--)
{
bits = src[y];
y++;
if (y == stippleHeight)
y = 0;
if (rot != 0)
RotBitsLeft (bits, rot);
dst = dstLine;
dstLine += nlwDst;
if (startmask)
{
mask = cfb8PixelMasks[GetBitGroup(bits)];
*dst = (*dst & ~(mask & startmask)) |
(xor & (mask & startmask));
dst++;
RotBitsLeft (bits, PGSZB);
}
nlw = nlwMiddle;
while (nlw--)
{
WriteBitGroup (dst,xor,GetBitGroup(bits))
dst++;
RotBitsLeft (bits, PGSZB);
}
if (endmask)
{
mask = cfb8PixelMasks[GetBitGroup(bits)];
*dst = (*dst & ~(mask & endmask)) |
(xor & (mask & endmask));
}
}
}
else
{
wEnd = 7 - (nlwMiddle & 7);
nlwMiddle = (nlwMiddle >> 3) + 1;
while (h--)
{
bits = src[y];
y++;
if (y == stippleHeight)
y = 0;
if (rot != 0)
RotBitsLeft (bits, rot);
dstTmp = dstLine;
dstLine += nlwDst;
if (startmask)
{
mask = cfb8PixelMasks[GetBitGroup(bits)];
*dstTmp = (*dstTmp & ~(mask & startmask)) |
(xor & (mask & startmask));
dstTmp++;
RotBitsLeft (bits, PGSZB);
}
w = 7 - wEnd;
while (w--)
{
nlw = nlwMiddle;
dst = dstTmp;
dstTmp++;
#if defined(__GNUC__) && defined(mc68020)
mask = cfb8PixelMasks[GetBitGroup(bits)];
xor = xor & mask;
mask = ~mask;
while (nlw--)
{
*dst = (*dst & mask) | xor;
dst += 8;
}
xor = devPriv->xor;
#else
#define SwitchBitsLoop(body) \
while (nlw--) \
{ \
body \
dst += 8; \
}
SwitchBitGroup(dst, xor, GetBitGroup(bits));
#undef SwitchBitsLoop
#endif
NextBitGroup (bits);
}
nlwMiddle--;
w = wEnd + 1;
if (endmask)
{
mask = cfb8PixelMasks[GetBitGroup(bits)];
dst = dstTmp + (nlwMiddle << 3);
*dst = (*dst & ~(mask & endmask)) |
(xor & (mask & endmask));
}
while (w--)
{
nlw = nlwMiddle;
dst = dstTmp;
dstTmp++;
#if defined(__GNUC__) && defined(mc68020)
mask = cfb8PixelMasks[GetBitGroup(bits)];
xor = xor & mask;
mask = ~mask;
while (nlw--)
{
*dst = (*dst & mask) | xor;
dst += 8;
}
xor = devPriv->xor;
#else
#define SwitchBitsLoop(body) \
while (nlw--) \
{ \
body \
dst += 8; \
}
SwitchBitGroup(dst, xor, GetBitGroup(bits));
#undef SwitchBitsLoop
#endif
NextBitGroup (bits);
}
nlwMiddle++;
}
}
}
else
#endif /* PPW == 4 */
{
while (h--)
{
bits = src[y];
y++;
if (y == stippleHeight)
y = 0;
if (rot != 0)
RotBitsLeft (bits, rot);
dst = dstLine;
dstLine += nlwDst;
if (startmask)
{
xor = GetBitGroup(bits);
*dst = MaskRRopPixels(*dst, xor, startmask);
dst++;
RotBitsLeft (bits, PGSZB);
}
nlw = nlwMiddle;
while (nlw--)
{
RRopBitGroup(dst, GetBitGroup(bits));
dst++;
RotBitsLeft (bits, PGSZB);
}
if (endmask)
{
xor = GetBitGroup(bits);
*dst = MaskRRopPixels(*dst, xor, endmask);
}
}
}
}
}
void
cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox)
DrawablePtr pDrawable;
GCPtr pGC;
int nBox;
register BoxPtr pBox;
{
CfbBits *pdstBase; /* pointer to start of bitmap */
CfbBits *pdstLine; /* current destination line */
int nlwDst; /* width in longwords of bitmap */
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
int nlwMiddle;
register int nlw;
int x, y, w, h, xrem, xSrc, ySrc;
int stwidth, stippleWidth;
int stippleHeight;
register CfbBits bits, inputBits;
register int partBitsLeft;
int nextPartBits;
int bitsLeft, bitsWhole;
register CfbBits *pdst; /* pointer to current word in bitmap */
CfbBits *srcTemp, *srcStart;
CfbBits *psrcBase;
CfbBits startmask, endmask;
if (pGC->fillStyle == FillStippled)
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
else
cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
if (cfb8StippleRRop == GXnoop)
return;
/*
* OK, so what's going on here? We have two Drawables:
*
* The Stipple:
* Depth = 1
* Width = stippleWidth
* Words per scanline = stwidth
* Pointer to pixels = pStipple->devPrivate.ptr
*/
pStipple = pGC->stipple;
stwidth = pStipple->devKind >> PWSH;
stippleWidth = pStipple->drawable.width;
stippleHeight = pStipple->drawable.height;
psrcBase = (CfbBits *) pStipple->devPrivate.ptr;
/*
* The Target:
* Depth = PSZ
* Width = determined from *pwidth
* Words per scanline = nlwDst
* Pointer to pixels = addrlBase
*/
xSrc = pDrawable->x;
ySrc = pDrawable->y;
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase)
/* this replaces rotating the stipple. Instead we just adjust the offset
* at which we start grabbing bits from the stipple.
* Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
* so that iline and xrem always stay within the stipple bounds.
*/
xSrc += (pGC->patOrg.x % stippleWidth) - stippleWidth;
ySrc += (pGC->patOrg.y % stippleHeight) - stippleHeight;
bitsWhole = stippleWidth;
while (nBox--)
{
x = pBox->x1;
y = pBox->y1;
w = pBox->x2 - x;
h = pBox->y2 - y;
pBox++;
pdstLine = pdstBase + y * nlwDst + (x >> PWSH);
y = (y - ySrc) % stippleHeight;
srcStart = psrcBase + y * stwidth;
xrem = ((x & ~PIM) - xSrc) % stippleWidth;
if (((x & PIM) + w) < PPW)
{
maskpartialbits (x, w, startmask);
nlwMiddle = 0;
endmask = 0;
}
else
{
maskbits (x, w, startmask, endmask, nlwMiddle);
}
while (h--)
{
srcTemp = srcStart + (xrem >> MFB_PWSH);
bitsLeft = stippleWidth - (xrem & ~MFB_PIM);
NextUnnaturalStippleWord
NextSomeBits (inputBits, (xrem & MFB_PIM));
partBitsLeft -= (xrem & MFB_PIM);
NextUnnaturalStippleBits
nlw = nlwMiddle;
pdst = pdstLine;
if (startmask)
{
*pdst = MaskRRopPixels(*pdst,bits,startmask);
pdst++;
NextUnnaturalStippleBits
}
while (nlw--)
{
*pdst = RRopPixels(*pdst,bits);
pdst++;
NextUnnaturalStippleBits
}
if (endmask)
*pdst = MaskRRopPixels(*pdst,bits,endmask);
pdstLine += nlwDst;
y++;
srcStart += stwidth;
if (y == stippleHeight)
{
y = 0;
srcStart = psrcBase;
}
}
}
}
#endif /* PSZ == 8 */

View file

@ -1,227 +0,0 @@
/*
*
Copyright 1989, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
/* cfb reduced rasterop computations */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "cfb.h"
#include "cfbmskbits.h"
/* A description:
*
* There are four possible operations on each bit in the destination word,
*
* 1 2 3 4
*
* 0 0 0 1 1
* 1 0 1 0 1
*
* On examination of the reduced rop equation (dst = (dst & and) ^ xor),
* these four fall to reduced rops as follows:
*
* and 0 1 1 0
* xor 0 0 1 1
*
* or, (if 'and' is expensive) (dst = (dst | or) ^ xor)
*
* or 1 0 0 1
* xor 1 0 1 0
*
* The trouble with using this later equation is that trivial
* rasterop reduction is more difficult; some common rasterops
* use complicated expressions of xor/and instead of the simple
* ones while other common rasterops are not made any simpler:
*
* GXcopy: *dst = ~xor instead of *dst = xor
* GXand: *dst = *dst & ~or instead of *dst = *dst & and
* GXor: *dst = *dst | or instead of *dst = *dst | xor
* GXxor: *dst = *dst ^ xor instead of *dst = *dst ^ xor
*
* If you're really set on using this second mechanism, the changes
* are pretty simple.
*
* All that remains is to provide a mechanism for computing and/xor values
* based on the raster op and foreground value.
*
* The 16 rops fall as follows, with the associated reduced
* rop and/xor and or/xor values. The values in parenthesis following the
* reduced values gives an equation using the source value for
* the reduced value, and is one of {0, src, ~src, 1} as appropriate.
*
* clear and andReverse copy
* src 0 1 0 1 0 1 0 1
* dst 0 0 0 0 0 0 0 0 1 0 0 1
* 1 0 0 1 0 1 1 0 0 1 0 1
*
* and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0)
* xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src)
*
* or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1)
* xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src)
*
* andInverted noop xor or
* src 0 1 0 1 0 1 0 1
* dst 0 0 0 0 0 0 0 0 1 0 0 1
* 1 1 0 1 1 1 1 1 0 1 1 1
*
* and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src)
* xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src)
*
* or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src)
* xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0)
*
* nor equiv invert orReverse
* src 0 1 0 1 0 1 0 1
* dst 0 1 0 0 1 0 0 1 1 0 1 1
* 1 0 0 1 0 1 1 0 0 1 0 1
*
* and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src)
* xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1)
*
* or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src)
* xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src)
*
* copyInverted orInverted nand set
* src 0 1 0 1 0 1 0 1
* dst 0 1 0 0 1 0 0 1 1 0 1 1
* 1 1 0 1 1 1 1 1 0 1 1 1
*
* and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0)
* xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1)
*
* or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1)
* xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0)
*/
int
cfbReduceRasterOp (rop, fg, pm, andp, xorp)
int rop;
CfbBits fg, pm;
CfbBits *andp, *xorp;
{
CfbBits and, xor;
int rrop;
fg = PFILL (fg);
pm = PFILL (pm);
switch (rop)
{
case GXclear:
and = 0;
xor = 0;
break;
case GXand:
and = fg;
xor = 0;
break;
case GXandReverse:
and = fg;
xor = fg;
break;
case GXcopy:
and = 0;
xor = fg;
break;
case GXandInverted:
and = ~fg;
xor = 0;
break;
case GXnoop:
and = ~0;
xor = 0;
break;
case GXxor:
and = ~0;
xor = fg;
break;
case GXor:
and = ~fg;
xor = fg;
break;
case GXnor:
and = ~fg;
xor = ~fg;
break;
case GXequiv:
and = ~0;
xor = ~fg;
break;
case GXinvert:
and = ~0;
xor = ~0;
break;
case GXorReverse:
and = ~fg;
xor = ~0;
break;
case GXcopyInverted:
and = 0;
xor = ~fg;
break;
case GXorInverted:
and = fg;
xor = ~fg;
break;
case GXnand:
and = fg;
xor = ~0;
break;
case GXset:
and = 0;
xor = ~0;
break;
default:
and = xor = 0;
break;
}
and |= ~pm;
xor &= pm;
*andp = and;
*xorp = xor;
/* check for some special cases to reduce computation */
if (and == 0)
rrop = GXcopy;
/* nothing checks for GXnoop
else if (and == ~0 && xor == 0)
rrop = GXnoop;
*/
else if (and == ~0)
rrop = GXxor;
else if (xor == 0)
rrop = GXand;
else if ( (and ^ xor) == ~0) /* fix XBUG 6541 */
rrop = GXor;
else
rrop = GXset; /* rop not reduced */
return rrop;
}

View file

@ -1,343 +0,0 @@
/*
*
Copyright 1989, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef GXcopy
#include <X11/X.h>
#endif
#define RROP_FETCH_GC(gc) \
RROP_FETCH_GCPRIV((cfbPrivGCPtr)dixLookupPrivate(&(gc)->devPrivates, \
cfbGCPrivateKey))
#ifndef RROP
#define RROP GXset
#endif
#if RROP == GXcopy
#if PSZ == 24
#define RROP_DECLARE register CfbBits rrop_xor; \
CfbBits piQxelXor[3], spiQxelXor[8];
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
spiQxelXor[2] = rrop_xor << 24; \
spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
spiQxelXor[4] = rrop_xor << 16; \
spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
spiQxelXor[6] = rrop_xor << 8; \
spiQxelXor[1] = spiQxelXor[7] = 0; \
piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
#define RROP_SOLID24(dst,index) {\
register int idx = ((index) & 3)<< 1; \
*(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
if (idx == 2 || idx == 4){ \
idx++; \
*((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
} \
}
#define RROP_SOLID(dst, idx) \
(*(dst) = piQxelXor[(idx)])
#define RROP_SOLID_MASK(dst,mask,idx) \
(*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask)))
#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor;
#else
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
#define RROP_DECLARE register CfbBits rrop_xor;
#define RROP_SOLID(dst) (*(dst) = (rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask)))
#define RROP_UNDECLARE
#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy)
#endif /* GXcopy */
#if RROP == GXxor
#if PSZ == 24
#define RROP_DECLARE register CfbBits rrop_xor; \
CfbBits piQxelXor[3], spiQxelXor[8];
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
spiQxelXor[2] = rrop_xor << 24; \
spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
spiQxelXor[4] = rrop_xor << 16; \
spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
spiQxelXor[6] = rrop_xor << 8; \
spiQxelXor[1] = spiQxelXor[7] = 0; \
piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
#define RROP_SOLID24(dst,index) {\
register int idx = ((index) & 3)<< 1; \
*(dst) ^= spiQxelXor[idx]; \
if (idx == 2 || idx == 4) \
*((dst)+1) ^= spiQxelXor[idx+1]; \
}
#define RROP_SOLID(dst,idx) \
(*(dst) ^= piQxelXor[(idx)])
#define RROP_SOLID_MASK(dst,mask,idx) \
(*(dst) ^= (piQxelXor[(idx)] & (mask)))
#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor;
#else
#define RROP_DECLARE register CfbBits rrop_xor;
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask)))
#define RROP_UNDECLARE
#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor)
#endif /* GXxor */
#if RROP == GXand
#if PSZ == 24
#define RROP_DECLARE register CfbBits rrop_and; \
CfbBits piQxelAnd[3], spiQxelAnd[6];
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \
spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \
spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \
piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16);
#define RROP_SOLID24(dst,index) {\
switch((index) & 3){ \
case 0: \
*(dst) &= spiQxelAnd[0]; \
break; \
case 3: \
*(dst) &= spiQxelAnd[1]; \
break; \
case 1: \
*(dst) &= spiQxelAnd[2]; \
*((dst)+1) &= spiQxelAnd[3]; \
break; \
case 2: \
*(dst) &= spiQxelAnd[4]; \
*((dst)+1) &= spiQxelAnd[5]; \
break; \
} \
}
#define RROP_SOLID(dst,idx) \
(*(dst) &= piQxelAnd[(idx)])
#define RROP_SOLID_MASK(dst,mask,idx) \
(*(dst) &= (piQxelAnd[(idx)] | ~(mask)))
#define RROP_UNDECLARE (void)piQxelAnd; (void)spiQxelAnd;
#else
#define RROP_DECLARE register CfbBits rrop_and;
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and;
#define RROP_SOLID(dst) (*(dst) &= (rrop_and))
#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask)))
#define RROP_UNDECLARE
#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And)
#endif /* GXand */
#if RROP == GXor
#if PSZ == 24
#define RROP_DECLARE register CfbBits rrop_or; \
CfbBits piQxelOr[3], spiQxelOr[6];
#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \
spiQxelOr[0] = rrop_or & 0xFFFFFF; \
spiQxelOr[1] = rrop_or << 24; \
spiQxelOr[2] = rrop_or << 16; \
spiQxelOr[3] = rrop_or << 8; \
spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \
spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \
piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \
piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \
piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16);
#define RROP_SOLID24(dst,index) {\
switch((index) & 3){ \
case 0: \
*(dst) |= spiQxelOr[0]; \
break; \
case 3: \
*(dst) |= spiQxelOr[3]; \
break; \
case 1: \
*(dst) |= spiQxelOr[1]; \
*((dst)+1) |= spiQxelOr[4]; \
break; \
case 2: \
*(dst) |= spiQxelOr[2]; \
*((dst)+1) |= spiQxelOr[5]; \
break; \
} \
}
#define RROP_SOLID(dst,idx) \
(*(dst) |= piQxelOr[(idx)])
#define RROP_SOLID_MASK(dst,mask,idx) \
(*(dst) |= (piQxelOr[(idx)] & (mask)))
#define RROP_UNDECLARE (void)piQxelOr; (void)spiQxelOr;
#else
#define RROP_DECLARE register CfbBits rrop_or;
#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) |= (rrop_or))
#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask)))
#define RROP_UNDECLARE
#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or)
#endif /* GXor */
#if RROP == GXnoop
#define RROP_DECLARE
#define RROP_FETCH_GCPRIV(devPriv)
#define RROP_SOLID(dst)
#define RROP_SOLID_MASK(dst,mask)
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Noop)
#define RROP_UNDECLARE
#endif /* GXnoop */
#if RROP == GXset
#if PSZ == 24
#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \
CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6];
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
rrop_xor = (devPriv)->xor; \
spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
spiQxelXor[1] = rrop_xor << 24; \
spiQxelXor[2] = rrop_xor << 16; \
spiQxelXor[3] = rrop_xor << 8; \
spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \
spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \
spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \
spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \
spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \
piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
#define RROP_SOLID24(dst,index) {\
switch((index) & 3){ \
case 0: \
*(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
break; \
case 3: \
*(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
break; \
case 1: \
*(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
*((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
break; \
case 2: \
*(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
*((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
break; \
} \
}
#define RROP_SOLID(dst,idx) \
(*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)]))
#define RROP_SOLID_MASK(dst,mask,idx) \
(*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask)))
#define RROP_UNDECLARE (void)piQxelAnd; (void)piQxelXor; \
(void)spiQxelAnd; (void)spiQxelXor;
#else
#define RROP_DECLARE register CfbBits rrop_and, rrop_xor;
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
rrop_xor = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask)))
#define RROP_UNDECLARE
#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General)
#endif /* GXset */
#define RROP_UNROLL_CASE1(p,i) case (i): RROP_SOLID((p) - (i));
#define RROP_UNROLL_CASE2(p,i) RROP_UNROLL_CASE1(p,(i)+1) RROP_UNROLL_CASE1(p,i)
#define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i)
#define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i)
#define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i)
#define RROP_UNROLL_CASE32(p,i) RROP_UNROLL_CASE16(p,(i)+16) RROP_UNROLL_CASE16(p,i)
#define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1)
#define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p)
#define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p)
#define RROP_UNROLL_CASE31(p) RROP_UNROLL_CASE16(p,16) RROP_UNROLL_CASE15(p)
#ifdef LONG64
#define RROP_UNROLL_CASE63(p) RROP_UNROLL_CASE32(p,32) RROP_UNROLL_CASE31(p)
#endif /* LONG64 */
#define RROP_UNROLL_LOOP1(p,i) RROP_SOLID((p) + (i));
#define RROP_UNROLL_LOOP2(p,i) RROP_UNROLL_LOOP1(p,(i)) RROP_UNROLL_LOOP1(p,(i)+1)
#define RROP_UNROLL_LOOP4(p,i) RROP_UNROLL_LOOP2(p,(i)) RROP_UNROLL_LOOP2(p,(i)+2)
#define RROP_UNROLL_LOOP8(p,i) RROP_UNROLL_LOOP4(p,(i)) RROP_UNROLL_LOOP4(p,(i)+4)
#define RROP_UNROLL_LOOP16(p,i) RROP_UNROLL_LOOP8(p,(i)) RROP_UNROLL_LOOP8(p,(i)+8)
#define RROP_UNROLL_LOOP32(p,i) RROP_UNROLL_LOOP16(p,(i)) RROP_UNROLL_LOOP16(p,(i)+16)
#ifdef LONG64
#define RROP_UNROLL_LOOP64(p,i) RROP_UNROLL_LOOP32(p,(i)) RROP_UNROLL_LOOP32(p,(i)+32)
#endif /* LONG64 */
#if defined (FAST_CONSTANT_OFFSET_MODE) && defined (SHARED_IDCACHE) && (RROP == GXcopy)
#ifdef LONG64
#define RROP_UNROLL_SHIFT 6
#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE63(p)
#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP64(p,-64)
#else /* not LONG64 */
#define RROP_UNROLL_SHIFT 5
#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE31(p)
#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP32(p,-32)
#endif /* LONG64 */
#define RROP_UNROLL (1<<RROP_UNROLL_SHIFT)
#define RROP_UNROLL_MASK (RROP_UNROLL-1)
#define RROP_SPAN(pdst,nmiddle) {\
int part = (nmiddle) & RROP_UNROLL_MASK; \
(nmiddle) >>= RROP_UNROLL_SHIFT; \
(pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \
switch (part) {\
RROP_UNROLL_CASE((CfbBits *) (pdst)) \
} \
while (--(nmiddle) >= 0) { \
(pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \
RROP_UNROLL_LOOP((CfbBits *) (pdst)) \
} \
}
#else
#define RROP_SPAN(pdst,nmiddle) \
while (--(nmiddle) >= 0) { \
RROP_SOLID((CfbBits *) (pdst)); \
(pdst) += sizeof (CfbBits) / sizeof (*pdst); \
}
#endif
#if !defined(UNIXCPP) || defined(ANSICPP)
#define RROP_NAME_CAT(prefix,suffix) prefix##suffix
#else
#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix
#endif

View file

@ -1,223 +0,0 @@
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
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 no-
tice appear in all copies and that both that copyright no-
tice and this permission notice appear in supporting docu-
mentation, and that the names of Sun or The Open Group
not be used in advertising or publicity pertaining to
distribution of the software without specific prior
written permission. Sun and The Open Group make no
representations about the suitability of this software for
any purpose. It is provided "as is" without any express or
implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
ABLE 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 <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "resource.h"
#include "colormap.h"
#include "colormapst.h"
#include "cfb.h"
#include "mi.h"
#include "mistruct.h"
#include "dix.h"
#include "cfbmskbits.h"
#include "mibstore.h"
Bool
cfbCloseScreen (index, pScreen)
int index;
ScreenPtr pScreen;
{
int d;
DepthPtr depths = pScreen->allowedDepths;
for (d = 0; d < pScreen->numDepths; d++)
xfree (depths[d].vids);
xfree (depths);
xfree (pScreen->visuals);
#ifdef CFB_NEED_SCREEN_PRIVATE
xfree (dixLookupPrivate(&pScreen->devPrivates, cfbScreenPrivateKey));
#else
xfree (pScreen->devPrivate);
#endif
return TRUE;
}
static void DestroyColormapNoop(
ColormapPtr pColormap)
{
/* NOOP */
}
static void StoreColorsNoop(
ColormapPtr pColormap,
int ndef,
xColorItem * pdef)
{
/* NOOP */
}
Bool
cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
register ScreenPtr pScreen;
pointer pbits; /* pointer to screen bitmap */
int xsize, ysize; /* in pixels */
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
if (!cfbAllocatePrivates(pScreen, NULL))
return FALSE;
pScreen->defColormap = FakeClientID(0);
/* let CreateDefColormap do whatever it wants for pixels */
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
pScreen->QueryBestSize = mfbQueryBestSizeWeak();
/* SaveScreen */
pScreen->GetImage = cfbGetImage;
pScreen->GetSpans = cfbGetSpans;
pScreen->CreateWindow = cfbCreateWindow;
pScreen->DestroyWindow = cfbDestroyWindow;
pScreen->PositionWindow = cfbPositionWindow;
pScreen->ChangeWindowAttributes = cfbChangeWindowAttributes;
pScreen->RealizeWindow = cfbMapWindow;
pScreen->UnrealizeWindow = cfbUnmapWindow;
pScreen->CopyWindow = cfbCopyWindow;
pScreen->CreatePixmap = cfbCreatePixmap;
pScreen->DestroyPixmap = cfbDestroyPixmap;
pScreen->RealizeFont = mfbRealizeFontWeak();
pScreen->UnrealizeFont = mfbUnrealizeFontWeak();
pScreen->CreateGC = cfbCreateGC;
pScreen->CreateColormap = cfbInitializeColormap;
pScreen->DestroyColormap = DestroyColormapNoop;
pScreen->InstallColormap = cfbInstallColormap;
pScreen->UninstallColormap = cfbUninstallColormap;
pScreen->ListInstalledColormaps = cfbListInstalledColormaps;
pScreen->StoreColors = StoreColorsNoop;
pScreen->ResolveColor = cfbResolveColor;
pScreen->BitmapToRegion = mfbPixmapToRegionWeak();
mfbRegisterCopyPlaneProc (pScreen, cfbCopyPlane);
return TRUE;
}
#ifdef CFB_NEED_SCREEN_PRIVATE
Bool
cfbCreateScreenResources(pScreen)
ScreenPtr pScreen;
{
Bool retval;
pointer oldDevPrivate = pScreen->devPrivate;
pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates,
cfbScreenPrivateKey);
retval = miCreateScreenResources(pScreen);
dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey,
pScreen->devPrivate);
pScreen->devPrivate = oldDevPrivate;
return retval;
}
#endif
Bool
cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
register ScreenPtr pScreen;
pointer pbits; /* pointer to screen bitmap */
int xsize, ysize; /* in pixels */
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
#ifdef CFB_NEED_SCREEN_PRIVATE
pointer oldDevPrivate;
#endif
VisualPtr visuals;
DepthPtr depths;
int nvisuals;
int ndepths;
int rootdepth;
VisualID defaultVisual;
rootdepth = 0;
if (!cfbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
&defaultVisual,((unsigned long)1<<(PSZ-1)), 8))
return FALSE;
#ifdef CFB_NEED_SCREEN_PRIVATE
oldDevPrivate = pScreen->devPrivate;
#endif
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
rootdepth, ndepths, depths,
defaultVisual, nvisuals, visuals))
return FALSE;
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = cfbCloseScreen;
#ifdef CFB_NEED_SCREEN_PRIVATE
pScreen->CreateScreenResources = cfbCreateScreenResources;
dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey,
pScreen->devPrivate);
pScreen->devPrivate = oldDevPrivate;
#endif
pScreen->GetScreenPixmap = cfbGetScreenPixmap;
pScreen->SetScreenPixmap = cfbSetScreenPixmap;
return TRUE;
}
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
Bool
cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
register ScreenPtr pScreen;
pointer pbits; /* pointer to screen bitmap */
int xsize, ysize; /* in pixels */
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
if (!cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
return FALSE;
return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
}
PixmapPtr
cfbGetScreenPixmap(pScreen)
ScreenPtr pScreen;
{
#ifdef CFB_NEED_SCREEN_PRIVATE
return (PixmapPtr)dixLookupPrivate(&pScreen->devPrivates,
cfbScreenPrivateKey);
#else
return (PixmapPtr)pScreen->devPrivate;
#endif
}
void
cfbSetScreenPixmap(pPix)
PixmapPtr pPix;
{
#ifdef CFB_NEED_SCREEN_PRIVATE
if (pPix)
dixSetPrivate(&pPix->drawable.pScreen->devPrivates,
cfbScreenPrivateKey, pPix);
#else
if (pPix)
pPix->drawable.pScreen->devPrivate = (pointer)pPix;
#endif
}

View file

@ -1,316 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "misc.h"
#include "regionstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include <mergerop.h>
/* cfbSetScanline -- copies the bits from psrc to the drawable starting at
* (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
* starts on the scanline. (I.e., if this scanline passes through multiple
* boxes, we may not want to start grabbing bits at psrc but at some offset
* further on.)
*/
void
cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask)
int y;
int xOrigin; /* where this scanline starts */
int xStart; /* first bit to use from scanline */
int xEnd; /* last bit to use from scanline + 1 */
register unsigned int *psrc;
register int alu; /* raster op */
int *pdstBase; /* start of the drawable */
int widthDst; /* width of drawable in words */
unsigned long planemask;
{
int w; /* width of scanline in bits */
register int *pdst; /* where to put the bits */
register int tmpSrc; /* scratch buffer to collect bits in */
int offSrc;
int nl;
#if PSZ == 24
register char *psrcb, *pdstb;
register int xIndex;
#else
int dstBit; /* offset in bits from beginning of
* word */
register int nstart; /* number of bits from first partial */
#if PSZ != 32 || PPW != 1
register int nend; /* " " last partial word */
#endif
int startmask, endmask, nlMiddle;
#endif
DeclareMergeRop()
InitializeMergeRop(alu,planemask);
#if PSZ == 24
pdst = pdstBase + (y * widthDst);
xIndex = xStart;
pdstb = (char *)pdst + (xStart * 3);
offSrc = xStart - xOrigin;
psrcb = (char *)psrc + (offSrc * 3);
#else
pdst = pdstBase + (y * widthDst) + (xStart >> PWSH);
psrc += (xStart - xOrigin) >> PWSH;
offSrc = (xStart - xOrigin) & PIM;
#endif
w = xEnd - xStart;
#if PSZ == 24
nl = w;
while (nl--){
psrc = (unsigned int *)((unsigned long)psrcb & ~0x03);
getbits24(psrc, tmpSrc, offSrc);
pdst = (int *)((unsigned long)pdstb & ~0x03);
DoMergeRop24(tmpSrc, pdst, xIndex);
offSrc++;
psrcb += 3;
xIndex++;
pdstb += 3;
}
#else /* PSZ == 24 */
dstBit = xStart & PIM;
if (dstBit + w <= PPW)
{
maskpartialbits(dstBit, w, startmask);
endmask = 0;
nlMiddle = 0;
}
else
{
maskbits(xStart, w, startmask, endmask, nlMiddle);
}
if (startmask)
nstart = PPW - dstBit;
else
nstart = 0;
#if PSZ != 32 || PPW != 1
if (endmask)
nend = xEnd & PIM;
else
nend = 0;
#endif
if (startmask)
{
getbits(psrc, offSrc, nstart, tmpSrc);
putbitsmropshort(tmpSrc, dstBit, nstart, pdst);
pdst++;
offSrc += nstart;
if (offSrc > PLST)
{
psrc++;
offSrc -= PPW;
}
}
nl = nlMiddle;
while (nl--)
{
getbits(psrc, offSrc, PPW, tmpSrc);
*pdst = DoMergeRop(tmpSrc, *pdst);
pdst++;
psrc++;
}
if (endmask)
{
getbits(psrc, offSrc, nend, tmpSrc);
putbitsmropshort(tmpSrc, 0, nend, pdst);
}
#endif /* PSZ == 24 */
}
/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
* ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
* are in increasing Y order.
* Source bit lines are server scanline padded so that they always begin
* on a word boundary.
*/
void
cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
DrawablePtr pDrawable;
GCPtr pGC;
char *pcharsrc;
register DDXPointPtr ppt;
int *pwidth;
int nspans;
int fSorted;
{
unsigned int *psrc = (unsigned int *)pcharsrc;
CfbBits *pdstBase; /* start of dst bitmap */
int widthDst; /* width of bitmap in words */
register BoxPtr pbox, pboxLast, pboxTest;
register DDXPointPtr pptLast;
int alu;
RegionPtr prgnDst;
int xStart, xEnd;
int yMax;
alu = pGC->alu;
prgnDst = cfbGetCompositeClip(pGC);
pptLast = ppt + nspans;
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
yMax = (int) pDrawable->y + (int) pDrawable->height;
pbox = REGION_RECTS(prgnDst);
pboxLast = pbox + REGION_NUM_RECTS(prgnDst);
if(fSorted)
{
/* scan lines sorted in ascending order. Because they are sorted, we
* don't have to check each scanline against each clip box. We can be
* sure that this scanline only has to be clipped to boxes at or after the
* beginning of this y-band
*/
pboxTest = pbox;
while(ppt < pptLast)
{
pbox = pboxTest;
if(ppt->y >= yMax)
break;
while(pbox < pboxLast)
{
if(pbox->y1 > ppt->y)
{
/* scanline is before clip box */
break;
}
else if(pbox->y2 <= ppt->y)
{
/* clip box is before scanline */
pboxTest = ++pbox;
continue;
}
else if(pbox->x1 > ppt->x + *pwidth)
{
/* clip box is to right of scanline */
break;
}
else if(pbox->x2 <= ppt->x)
{
/* scanline is to right of clip box */
pbox++;
continue;
}
/* at least some of the scanline is in the current clip box */
xStart = max(pbox->x1, ppt->x);
xEnd = min(ppt->x + *pwidth, pbox->x2);
cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
(int *)pdstBase, widthDst, pGC->planemask);
if(ppt->x + *pwidth <= pbox->x2)
{
/* End of the line, as it were */
break;
}
else
pbox++;
}
/* We've tried this line against every box; it must be outside them
* all. move on to the next point */
ppt++;
psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
pwidth++;
}
}
else
{
/* scan lines not sorted. We must clip each line against all the boxes */
while(ppt < pptLast)
{
if(ppt->y >= 0 && ppt->y < yMax)
{
for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++)
{
if(pbox->y1 > ppt->y)
{
/* rest of clip region is above this scanline,
* skip it */
break;
}
if(pbox->y2 <= ppt->y)
{
/* clip box is below scanline */
pbox++;
break;
}
if(pbox->x1 <= ppt->x + *pwidth &&
pbox->x2 > ppt->x)
{
xStart = max(pbox->x1, ppt->x);
xEnd = min(pbox->x2, ppt->x + *pwidth);
cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
(int *)pdstBase, widthDst, pGC->planemask);
}
}
}
psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
ppt++;
pwidth++;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,589 +0,0 @@
/*
* TEGblt - ImageText expanded glyph fonts only. For
* 8 bit displays, in Copy mode with no clipping.
*/
/*
Copyright 1989, 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#if PSZ == 8
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "cfb.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
/*
* this code supports up to 5 characters at a time. The performance
* differences between 4 and 5 is usually small (~7% on PMAX) and
* frequently negative (SPARC and Sun3), so this file is compiled
* only once for now. If you want to use the other options, you'll
* need to hack cfbgc.c as well.
*/
#ifndef NGLYPHS
#define NGLYPHS 4
#define DO_COMMON
#endif
#ifdef DO_COMMON
#define CFBTEGBLT8 cfbTEGlyphBlt8
#endif
/*
* On little-endian machines (or where fonts are padded to 32-bit
* boundaries) we can use some magic to avoid the expense of getleftbits
*/
#if ((BITMAP_BIT_ORDER == LSBFirst && NGLYPHS >= 4) || GLYPHPADBYTES == 4)
#if GLYPHPADBYTES == 1
typedef unsigned char *glyphPointer;
#define USE_LEFTBITS
#endif
#if GLYPHPADBYTES == 2
typedef unsigned short *glyphPointer;
#define USE_LEFTBITS
#endif
#if GLYPHPADBYTES == 4
typedef unsigned int *glyphPointer;
#endif
#define GetBitsL c = BitLeft (*leftChar++, lshift)
#define NGetBits1S(r) c = BitRight(*char1++ r, xoff1)
#define NGetBits1L(r) GetBitsL | BitRight(*char1++ r, xoff1)
#define NGetBits1U(r) c = *char1++ r
#define NGetBits2S(r) NGetBits1S(| BitRight(*char2++ r, widthGlyph))
#define NGetBits2L(r) NGetBits1L(| BitRight(*char2++ r, widthGlyph))
#define NGetBits2U(r) NGetBits1U(| BitRight(*char2++ r, widthGlyph))
#define NGetBits3S(r) NGetBits2S(| BitRight(*char3++ r, widthGlyph))
#define NGetBits3L(r) NGetBits2L(| BitRight(*char3++ r, widthGlyph))
#define NGetBits3U(r) NGetBits2U(| BitRight(*char3++ r, widthGlyph))
#define NGetBits4S(r) NGetBits3S(| BitRight(*char4++ r, widthGlyph))
#define NGetBits4L(r) NGetBits3L(| BitRight(*char4++ r, widthGlyph))
#define NGetBits4U(r) NGetBits3U(| BitRight(*char4++ r, widthGlyph))
#define NGetBits5S(r) NGetBits4S(| BitRight(*char5++ r, widthGlyph))
#define NGetBits5L(r) NGetBits4L(| BitRight(*char5++ r, widthGlyph))
#define NGetBits5U(r) NGetBits4U(| BitRight(*char5++ r, widthGlyph))
#define GetBits1S c = BitRight(*char1++, xoff1)
#define GetBits1L GetBitsL | BitRight(*char1++, xoff1)
#define GetBits1U c = *char1++
#define GetBits2S NGetBits1S(| BitRight(*char2++, widthGlyph))
#define GetBits2L NGetBits1L(| BitRight(*char2++, widthGlyph))
#define GetBits2U NGetBits1U(| BitRight(*char2++, widthGlyph))
#define GetBits3S NGetBits2S(| BitRight(*char3++, widthGlyph))
#define GetBits3L NGetBits2L(| BitRight(*char3++, widthGlyph))
#define GetBits3U NGetBits2U(| BitRight(*char3++, widthGlyph))
#define GetBits4S NGetBits3S(| BitRight(*char4++, widthGlyph))
#define GetBits4L NGetBits3L(| BitRight(*char4++, widthGlyph))
#define GetBits4U NGetBits3U(| BitRight(*char4++, widthGlyph))
#define GetBits5S NGetBits4S(| BitRight(*char5++, widthGlyph))
#define GetBits5L NGetBits4L(| BitRight(*char5++, widthGlyph))
#define GetBits5U NGetBits4U(| BitRight(*char5++, widthGlyph))
#else
typedef unsigned int *glyphPointer;
#define USE_LEFTBITS
#define ALL_LEFTBITS
#define GetBitsL WGetBitsL
#define GetBits1S WGetBits1S
#define GetBits1L WGetBits1L
#define GetBits1U WGetBits1U
#define GetBits2S GetBits1S Get1Bits (char2, tmpSrc) \
c |= BitRight(tmpSrc, xoff2);
#define GetBits2L GetBits1L Get1Bits (char2, tmpSrc) \
c |= BitRight(tmpSrc, xoff2);
#define GetBits2U GetBits1U Get1Bits (char2, tmpSrc) \
c |= BitRight(tmpSrc, xoff2);
#define GetBits3S GetBits2S Get1Bits (char3, tmpSrc) \
c |= BitRight(tmpSrc, xoff3);
#define GetBits3L GetBits2L Get1Bits (char3, tmpSrc) \
c |= BitRight(tmpSrc, xoff3);
#define GetBits3U GetBits2U Get1Bits (char3, tmpSrc) \
c |= BitRight(tmpSrc, xoff3);
#define GetBits4S GetBits3S Get1Bits (char4, tmpSrc) \
c |= BitRight(tmpSrc, xoff4);
#define GetBits4L GetBits3L Get1Bits (char4, tmpSrc) \
c |= BitRight(tmpSrc, xoff4);
#define GetBits4U GetBits3U Get1Bits (char4, tmpSrc) \
c |= BitRight(tmpSrc, xoff4);
#define GetBits5S GetBits4S Get1Bits (char5, tmpSrc) \
c |= BitRight(tmpSrc, xoff5);
#define GetBits5L GetBits4L Get1Bits (char5, tmpSrc) \
c |= BitRight(tmpSrc, xoff5);
#define GetBits5U GetBits4U Get1Bits (char5, tmpSrc) \
c |= BitRight(tmpSrc, xoff5);
#endif
#ifdef USE_LEFTBITS
#define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes))
#define Get1Bits(ch,dst) glyphbits (ch, widthGlyph, glyphMask, dst); \
IncChar (ch);
#define glyphbits(bits,width,mask,dst) getleftbits(bits,width,dst); \
dst &= mask;
#define WGetBitsL Get1Bits(leftChar,c); \
c = BitLeft (c, lshift);
#define WGetBits1S Get1Bits (char1, c) \
c = BitRight (c, xoff1);
#define WGetBits1L WGetBitsL Get1Bits (char1, tmpSrc) \
c |= BitRight (tmpSrc, xoff1);
#define WGetBits1U Get1Bits (char1, c)
#else
#define WGetBitsL GetBitsL
#define WGetBits1S GetBits1S
#define WGetBits1L GetBits1L
#define WGetBits1U GetBits1U
#endif
#if NGLYPHS == 2
# define GetBitsNS GetBits2S
# define GetBitsNL GetBits2L
# define GetBitsNU GetBits2U
# define LastChar char2
#ifndef CFBTEGBLT8
# define CFBTEGBLT8 cfbTEGlyphBlt8x2
#endif
#endif
#if NGLYPHS == 3
# define GetBitsNS GetBits3S
# define GetBitsNL GetBits3L
# define GetBitsNU GetBits3U
# define LastChar char3
#ifndef CFBTEGBLT8
# define CFBTEGBLT8 cfbTEGlyphBlt8x3
#endif
#endif
#if NGLYPHS == 4
# define GetBitsNS GetBits4S
# define GetBitsNL GetBits4L
# define GetBitsNU GetBits4U
# define LastChar char4
#ifndef CFBTEGBLT8
# define CFBTEGBLT8 cfbTEGlyphBlt8x4
#endif
#endif
#if NGLYPHS == 5
# define GetBitsNS GetBits5S
# define GetBitsNL GetBits5L
# define GetBitsNU GetBits5U
# define LastChar char5
#ifndef CFBTEGBLT8
# define CFBTEGBLT8 cfbTEGlyphBlt8x5
#endif
#endif
/* another ugly giant macro */
#define SwitchEm switch (ew) \
{ \
case 0: \
break; \
case 1: \
while (hTmp--) { \
GetBits; \
StoreBits0 \
Loop \
} \
break; \
case 2: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) \
Loop \
} \
break; \
case 3: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \
Loop \
} \
break; \
case 4: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) Step \
StoreBits(2) Step StoreBits(3) \
Loop \
} \
break; \
case 5: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) Step \
StoreBits(2) Step StoreBits(3) Step \
StoreBits(4) \
Loop \
} \
break; \
case 6: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) Step \
StoreBits(2) Step StoreBits(3) Step \
StoreBits(4) Step StoreBits(5) \
Loop \
} \
break; \
case 7: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) Step \
StoreBits(2) Step StoreBits(3) Step \
StoreBits(4) Step StoreBits(5) Step \
StoreBits(6) \
Loop \
} \
break; \
case 8: \
while (hTmp--) { \
GetBits; \
StoreBits0 FirstStep StoreBits(1) Step \
StoreBits(2) Step StoreBits(3) Step \
StoreBits(4) Step StoreBits(5) Step \
StoreBits(6) Step StoreBits(7) \
Loop \
} \
break; \
}
#ifdef FAST_CONSTANT_OFFSET_MODE
#define StorePixels(o,p) dst[o] = p
#define Loop dst += widthDst;
#else
#define StorePixels(o,p) do { *dst = (p); dst++; } while (0)
#define Loop dst += widthLeft;
#endif
#define Step NextBitGroup(c);
#if (BITMAP_BIT_ORDER == MSBFirst)
#define StoreBits(o) StorePixels(o,GetPixelGroup(c));
#define FirstStep Step
#else
#if PGSZ == 64
#define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]);
#define FirstStep Step
#else /* PGSZ == 32 */
#define StoreBits(o) StorePixels(o,*((CfbBits *) (((char *) cfb8Pixels) + (c & 0x3c))));
#define FirstStep c = BitLeft (c, 2);
#endif /* PGSZ */
#endif /* BITMAP_BIT_ORDER */
void
CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
int xInit, yInit;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
register CfbBits c;
register CfbBits *dst;
register CfbBits leftMask, rightMask;
register int hTmp;
register int xoff1;
register glyphPointer char1;
register glyphPointer char2;
#if NGLYPHS >= 3
register glyphPointer char3;
#endif
#if NGLYPHS >= 4
register glyphPointer char4;
#endif
#if NGLYPHS >= 5
register glyphPointer char5;
#endif
#ifdef ALL_LEFTBITS
int xoff2, xoff3, xoff4, xoff5;
#endif
FontPtr pfont = pGC->font;
CfbBits *dstLine;
glyphPointer oldRightChar;
CfbBits *pdstBase;
glyphPointer leftChar;
int widthDst;
#ifndef FAST_CONSTANT_OFFSET_MODE
int widthLeft;
#endif
int widthGlyph;
int h;
int ew;
int x, y;
BoxRec bbox; /* for clipping */
int lshift;
int widthGlyphs;
#ifdef USE_LEFTBITS
register CfbBits glyphMask;
register CfbBits tmpSrc;
register int glyphBytes;
#endif
widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
h = FONTASCENT(pfont) + FONTDESCENT(pfont);
if (!h)
return;
x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x;
y = yInit - FONTASCENT(pfont) + pDrawable->y;
bbox.x1 = x;
bbox.x2 = x + (widthGlyph * nglyph);
bbox.y1 = y;
bbox.y2 = y + h;
switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox))
{
case rgnPART:
cfbImageGlyphBlt8(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
case rgnOUT:
return;
}
if (!cfb8CheckPixels (pGC->fgPixel, pGC->bgPixel))
cfb8SetPixels (pGC->fgPixel, pGC->bgPixel);
leftChar = 0;
cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase)
#if NGLYPHS == 2
widthGlyphs = widthGlyph << 1;
#else
#if NGLYPHS == 4
widthGlyphs = widthGlyph << 2;
#else
widthGlyphs = widthGlyph * NGLYPHS;
#endif
#endif
#ifdef USE_LEFTBITS
glyphMask = mfbGetendtab(widthGlyph);
glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
#endif
pdstBase += y * widthDst;
#ifdef DO_COMMON
if (widthGlyphs <= 32)
#endif
while (nglyph >= NGLYPHS)
{
nglyph -= NGLYPHS;
hTmp = h;
dstLine = pdstBase + (x >> PWSH);
xoff1 = x & PIM;
char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
#ifdef ALL_LEFTBITS
xoff2 = xoff1 + widthGlyph;
#endif
#if NGLYPHS >= 3
char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
#ifdef ALL_LEFTBITS
xoff3 = xoff2 + widthGlyph;
#endif
#endif
#if NGLYPHS >= 4
char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
#ifdef ALL_LEFTBITS
xoff4 = xoff3 + widthGlyph;
#endif
#endif
#if NGLYPHS >= 5
char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
#ifdef ALL_LEFTBITS
xoff5 = xoff4 + widthGlyph;
#endif
#endif
oldRightChar = LastChar;
dst = dstLine;
if (xoff1)
{
ew = ((widthGlyphs - (PGSZB - xoff1)) >> PWSH) + 1;
#ifndef FAST_CONSTANT_OFFSET_MODE
widthLeft = widthDst - ew;
#endif
if (!leftChar)
{
leftMask = cfbendtab[xoff1];
rightMask = cfbstarttab[xoff1];
#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \
(GetPixelGroup(c) & rightMask));
#define GetBits GetBitsNS
SwitchEm
#undef GetBits
#undef StoreBits0
}
else
{
lshift = widthGlyph - xoff1;
#define StoreBits0 StorePixels (0,GetPixelGroup(c));
#define GetBits GetBitsNL
SwitchEm
#undef GetBits
#undef StoreBits0
}
}
else
{
#if NGLYPHS == 4 && PGSZ == 32
ew = widthGlyph; /* widthGlyphs >> 2 */
#else
ew = widthGlyphs >> PWSH;
#endif
#ifndef FAST_CONSTANT_OFFSET_MODE
widthLeft = widthDst - ew;
#endif
#define StoreBits0 StorePixels (0,GetPixelGroup(c));
#define GetBits GetBitsNU
SwitchEm
#undef GetBits
#undef StoreBits0
}
x += widthGlyphs;
leftChar = oldRightChar;
}
while (nglyph--)
{
xoff1 = x & PIM;
char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
hTmp = h;
dstLine = pdstBase + (x >> PWSH);
oldRightChar = char1;
dst = dstLine;
if (xoff1)
{
ew = ((widthGlyph - (PGSZB - xoff1)) >> PWSH) + 1;
#ifndef FAST_CONSTANT_OFFSET_MODE
widthLeft = widthDst - ew;
#endif
if (!leftChar)
{
leftMask = cfbendtab[xoff1];
rightMask = cfbstarttab[xoff1];
#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \
(GetPixelGroup(c) & rightMask));
#define GetBits WGetBits1S
SwitchEm
#undef GetBits
#undef StoreBits0
}
else
{
lshift = widthGlyph - xoff1;
#define StoreBits0 StorePixels (0,GetPixelGroup(c));
#define GetBits WGetBits1L
SwitchEm
#undef GetBits
#undef StoreBits0
}
}
else
{
ew = widthGlyph >> PWSH;
#ifndef FAST_CONSTANT_OFFSET_MODE
widthLeft = widthDst - ew;
#endif
#define StoreBits0 StorePixels (0,GetPixelGroup(c));
#define GetBits WGetBits1U
SwitchEm
#undef GetBits
#undef StoreBits0
}
x += widthGlyph;
leftChar = oldRightChar;
}
/*
* draw the tail of the last character
*/
xoff1 = x & PIM;
if (xoff1)
{
rightMask = cfbstarttab[xoff1];
leftMask = cfbendtab[xoff1];
lshift = widthGlyph - xoff1;
dst = pdstBase + (x >> PWSH);
hTmp = h;
while (hTmp--)
{
GetBitsL;
*dst = (*dst & rightMask) | (GetPixelGroup(c) & leftMask);
dst += widthDst;
}
}
}
#endif /* PSZ == 8 */

View file

@ -1,218 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "cfb.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "cfbmskbits.h"
#include "mi.h"
#define MFB_CONSTS_ONLY
#include "maskbits.h"
/*
this works for fonts with glyphs <= 32 bits wide, on an
arbitrarily deep display. Use cfbTEGlyphBlt8 for 8 bit displays.
This should be called only with a terminal-emulator font;
this means that the FIXED_METRICS flag is set, and that
glyphbounds == charbounds.
in theory, this goes faster; even if it doesn't, it reduces the
flicker caused by writing a string over itself with image text (since
the background gets repainted per character instead of per string.)
this seems to be important for some converted X10 applications.
Image text looks at the bits in the glyph and the fg and bg in the
GC. it paints a rectangle, as defined in the protocol dcoument,
and the paints the characters.
*/
void
cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
FontPtr pfont = pGC->font;
int widthDst;
CfbBits *pdstBase; /* pointer to longword with top row
of current glyph */
int w; /* width of glyph and char */
int h; /* height of glyph and char */
register int xpos=x; /* current x%32 */
int ypos=y; /* current y%32 */
register unsigned char *pglyph;
int widthGlyph;
register CfbBits *pdst;/* pointer to current longword in dst */
int hTmp; /* counter for height */
BoxRec bbox; /* for clipping */
register int wtmp,xtemp,width;
CfbBits bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp;
#if PSZ != 24
int tmpx;
#endif
xpos += pDrawable->x;
ypos += pDrawable->y;
cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
wtmp = FONTMAXBOUNDS(pfont,characterWidth);
h = FONTASCENT(pfont) + FONTDESCENT(pfont);
widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci);
xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
ypos -= FONTASCENT(pfont);
bbox.x1 = xpos;
bbox.x2 = xpos + (wtmp * nglyph);
bbox.y1 = ypos;
bbox.y2 = ypos + h;
fgfill = PFILL(pGC->fgPixel);
bgfill = PFILL(pGC->bgPixel);
switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox))
{
case rgnOUT:
break;
case rgnPART:
/* this is the WRONG thing to do, but it works.
calling the non-terminal text is easy, but slow, given
what we know about the font.
the right thing to do is something like:
for each clip rectangle
compute at which row the glyph starts to be in it,
and at which row the glyph ceases to be in it
compute which is the first glyph inside the left
edge, and the last one inside the right edge
draw a fractional first glyph, using only
the rows we know are in
draw all the whole glyphs, using the appropriate rows
draw any pieces of the last glyph, using the right rows
this way, the code would take advantage of knowing that
all glyphs are the same height and don't overlap.
one day...
*/
cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
break;
case rgnIN:
pdtmp = pdstBase + (widthDst * ypos);
while(nglyph--)
{
pglyph = FONTGLYPHBITS(pglyphBase, *ppci++);
pdst = pdtmp;
hTmp = h;
while (hTmp--)
{
x = xpos;
width = wtmp;
xtemp = 0;
while (width > 0)
{
#if PSZ == 24
w = 1;
ptemp = (CfbBits *)(pglyph + ((xtemp *3)>> 2));
getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp);
getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp);
#else
tmpx = x & PIM;
w = min(width, PPW - tmpx);
w = min(w, (PGSZ - xtemp));
ptemp = (CfbBits *)(pglyph + (xtemp >> MFB_PWSH));
getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1);
getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2);
#endif
{
CfbBits tmpDst = tmpDst1 | tmpDst2;
#if PSZ == 24
CfbBits *pdsttmp = pdst + ((x*3) >> 2);
putbits24(tmpDst,w,pdsttmp,pGC->planemask,x);
#else
CfbBits *pdsttmp = pdst + (x >> PWSH);
putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask);
#endif
}
x += w;
xtemp += w;
width -= w;
}
pglyph += widthGlyph;
pdst += widthDst;
}
xpos += wtmp;
}
break;
}
}

View file

@ -1,517 +0,0 @@
/*
* Fill 32 bit tiled rectangles. Used by PolyFillRect.
* no depth dependencies.
*/
/*
Copyright 1989, 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "servermd.h"
#include "gcstruct.h"
#include "window.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "cfb8bit.h"
#include "mergerop.h"
#include "mi.h"
#include "mispans.h"
#ifdef sparc
#define SHARED_IDCACHE
#endif
#if PSZ == 24
#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
/*#define STORE24(p,index) {\
register int idx = ((index) & 3)<< 1; \
*(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<<cfb24Shift[idx])&cfbmask[idx])| \
(*(p)&cfbrmask[idx])); \
idx++; \
(p)++; \
*(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))>>cfb24Shift[idx])&cfbmask[idx])| \
(*(p)&cfbrmask[idx])); \
(p)--; \
}*/
#define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index)
#define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask)))
#define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \
(p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \
(p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
# define Expand(left,right) {\
int part = nlwMiddle & ((PGSZB*2)-1); \
nlwMiddle *= 3; \
nlwMiddle >>= PWSH + 3; \
while (h--) { \
srcpix = psrc[srcy]; \
MROP_PREBUILD(srcpix); \
++srcy; \
if (srcy == tileHeight) \
srcy = 0; \
left \
p += part; \
switch (part) { \
case 7: \
STORE24(p - 7, xtmp - 7); \
case 6: \
STORE24(p - 6, xtmp - 6); \
case 5: \
STORE24(p - 5, xtmp - 5); \
case 4: \
STORE24(p - 4, xtmp - 4); \
case 3: \
STORE24(p - 3, xtmp - 3); \
case 2: \
STORE24(p - 2, xtmp - 2); \
case 1: \
STORE24(p - 1, xtmp - 1); \
} \
nlw = nlwMiddle; \
while (nlw) { \
STORE24 (p + 0, xtmp + 0); \
STORE24 (p + 1, xtmp + 1); \
STORE24 (p + 2, xtmp + 2); \
STORE24 (p + 3, xtmp + 3); \
STORE24 (p + 4, xtmp + 4); \
STORE24 (p + 5, xtmp + 5); \
STORE24 (p + 6, xtmp + 6); \
STORE24 (p + 7, xtmp + 7); \
p += 8; \
xtmp += 8; \
nlw--; \
} \
right \
p += nlwExtra; \
} \
}
#else
#define Expand(left,right) {\
while (h--) { \
srcpix = psrc[srcy]; \
MROP_PREBUILD(srcpix); \
++srcy; \
if (srcy == tileHeight) \
srcy = 0; \
left \
while (nlw--) \
{ \
STORE24(p,xtmp); \
if(xtmp&3) p++; \
xtmp++; \
} \
right \
p += nlwExtra; \
} \
}
#endif
#else /*PSZ != 24*/
#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
# define Expand(left,right) {\
int part = nlwMiddle & ((PGSZB*2)-1); \
nlwMiddle >>= PWSH + 1; \
while (h--) { \
srcpix = psrc[srcy]; \
MROP_PREBUILD(srcpix); \
++srcy; \
if (srcy == tileHeight) \
srcy = 0; \
left \
p += part; \
switch (part) { \
case 7: \
STORE(p - 7); \
case 6: \
STORE(p - 6); \
case 5: \
STORE(p - 5); \
case 4: \
STORE(p - 4); \
case 3: \
STORE(p - 3); \
case 2: \
STORE(p - 2); \
case 1: \
STORE(p - 1); \
} \
nlw = nlwMiddle; \
while (nlw) { \
STORE (p + 0); \
STORE (p + 1); \
STORE (p + 2); \
STORE (p + 3); \
STORE (p + 4); \
STORE (p + 5); \
STORE (p + 6); \
STORE (p + 7); \
p += 8; \
nlw--; \
} \
right \
p += nlwExtra; \
} \
}
#else
#define Expand(left,right) {\
while (h--) { \
srcpix = psrc[srcy]; \
MROP_PREBUILD(srcpix); \
++srcy; \
if (srcy == tileHeight) \
srcy = 0; \
left \
nlw = nlwMiddle; \
while (nlw--) \
{ \
STORE(p); \
p++; \
} \
right \
p += nlwExtra; \
} \
}
#endif
#endif /*PSZ == 24*/
void
MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox)
DrawablePtr pDrawable;
GCPtr pGC;
int nBox; /* number of boxes to fill */
BoxPtr pBox; /* pointer to list of boxes to fill */
{
register CfbBits srcpix;
CfbBits *psrc; /* pointer to bits in tile, if needed */
int tileHeight; /* height of the tile */
int nlwDst; /* width in longwords of the dest pixmap */
int w; /* width of current box */
register int h; /* height of current box */
register CfbBits startmask;
register CfbBits endmask; /* masks for reggedy bits at either end of line */
int nlwMiddle; /* number of longwords between sides of boxes */
int nlwExtra; /* to get from right of box to left of next span */
register int nlw = 0; /* loop version of nlwMiddle */
register CfbBits *p; /* pointer to bits we're writing */
int y; /* current scan line */
int srcy; /* current tile position */
CfbBits *pbits;/* pointer to start of pixmap */
PixmapPtr tile; /* rotated, expanded tile */
#if MROP == 0 && PSZ == 24
DeclareMergeRop()
#else
MROP_DECLARE_REG()
#endif
MROP_PREBUILT_DECLARE()
#if PSZ == 24
CfbBits xtmp;
#endif
tile = pGC->pRotatedPixmap;
tileHeight = tile->drawable.height;
psrc = (CfbBits *)tile->devPrivate.ptr;
#if MROP == 0 && PSZ == 24
InitializeMergeRop(pGC->alu, pGC->planemask);
#else
MROP_INITIALIZE(pGC->alu, pGC->planemask);
#endif
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
while (nBox--)
{
w = pBox->x2 - pBox->x1;
h = pBox->y2 - pBox->y1;
y = pBox->y1;
#if PSZ == 24
xtmp = pBox->x1;
p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2);
/* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/
#else
p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH);
#endif
srcy = y % tileHeight;
#if PSZ == 24
if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3))
#else
if ( ((pBox->x1 & PIM) + w) <= PPW)
#endif
{
maskpartialbits(pBox->x1, w, startmask);
nlwExtra = nlwDst;
while (h--)
{
srcpix = psrc[srcy];
MROP_PREBUILD(srcpix);
++srcy;
if (srcy == tileHeight)
srcy = 0;
*p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
p += nlwExtra;
}
}
else
{
maskbits(pBox->x1, w, startmask, endmask, nlwMiddle);
nlwExtra = nlwDst - nlwMiddle;
if (startmask)
{
nlwExtra -= 1;
if (endmask)
{
Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;,
*p = MROP_PREBUILT_MASK(srcpix, *p, endmask);)
}
else
{
Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;,
;)
}
}
else
{
if (endmask)
{
Expand(;,
*p = MROP_PREBUILT_MASK(srcpix, *p, endmask);)
}
else
{
Expand(;,
;)
}
}
}
pBox++;
}
}
void
MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
DrawablePtr pDrawable;
GCPtr pGC;
int nInit; /* number of spans to fill */
DDXPointPtr pptInit; /* pointer to list of start points */
int *pwidthInit; /* pointer to list of n widths */
int fSorted;
{
/* next three parameters are post-clip */
int n; /* number of spans to fill */
DDXPointPtr ppt; /* pointer to list of start points */
int *pwidth;/* pointer to list of n widths */
CfbBits *pbits; /* pointer to start of bitmap */
int nlwDst; /* width in longwords of bitmap */
register CfbBits *p; /* pointer to current longword in bitmap */
register int w; /* current span width */
register int nlw;
register int x;
register CfbBits startmask;
register CfbBits endmask;
register CfbBits srcpix;
int y;
int *pwidthFree;/* copies of the pointers to free */
DDXPointPtr pptFree;
PixmapPtr tile;
CfbBits *psrc; /* pointer to bits in tile */
int tileHeight;/* height of the tile */
#if MROP == 0 && PSZ == 24
DeclareMergeRop()
#else
MROP_DECLARE_REG()
#endif
MROP_PREBUILT_DECLARE()
#if PSZ == 24
CfbBits xtmp;
#endif
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree)
{
if (pptFree) xfree(pptFree);
if (pwidthFree) xfree(pwidthFree);
return;
}
pwidth = pwidthFree;
ppt = pptFree;
n = miClipSpans( cfbGetCompositeClip(pGC),
pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted);
tile = pGC->pRotatedPixmap;
tileHeight = tile->drawable.height;
psrc = (CfbBits *)tile->devPrivate.ptr;
#if MROP == 0 && PSZ == 24
InitializeMergeRop(pGC->alu, pGC->planemask);
#else
MROP_INITIALIZE(pGC->alu, pGC->planemask);
#endif
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
#if MROP == Mcopy
if (!(tileHeight & (tileHeight-1)))
{
tileHeight--;
while (n--)
{
x = ppt->x;
y = ppt->y;
++ppt;
w = *pwidth++;
#if PSZ == 24
/* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/
xtmp = x;
p = pbits + (y * nlwDst) + ((x >> 2)*3);
#else
p = pbits + (y * nlwDst) + (x >> PWSH);
#endif
srcpix = psrc[y & tileHeight];
MROP_PREBUILD(srcpix);
#if PSZ == 24
if ((x & 3) + w < 5)
#else
if ((x & PIM) + w < PPW)
#endif
{
maskpartialbits(x, w, startmask);
*p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
}
else
{
maskbits(x, w, startmask, endmask, nlw);
if (startmask)
{
*p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
#if PSZ == 24
if(xtmp&3) p++;
xtmp++;
#else
p++;
#endif
}
while (nlw--)
{
#if PSZ == 24
STORE24(p,xtmp);
if(xtmp&3) p++;
++xtmp;
#else
STORE(p);
++p;
#endif
}
if (endmask)
{
*p = MROP_PREBUILT_MASK(srcpix, *p, endmask);
}
}
}
}
else
#endif
{
while (n--)
{
x = ppt->x;
y = ppt->y;
++ppt;
w = *pwidth++;
#if PSZ == 24
/* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/
p = pbits + (y * nlwDst) + ((x >> 2)*3);
xtmp = x;
#else
p = pbits + (y * nlwDst) + (x >> PWSH);
#endif
srcpix = psrc[y % tileHeight];
MROP_PREBUILD(srcpix);
#if PSZ == 24
if ((x & 3) + w < 5)
#else
if ((x & PIM) + w < PPW)
#endif
{
maskpartialbits(x, w, startmask);
*p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
}
else
{
maskbits(x, w, startmask, endmask, nlw);
if (startmask)
{
*p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
#if PSZ == 24
if(xtmp&3)p++;
xtmp++;
#else
p++;
#endif
}
while (nlw--)
{
#if PSZ == 24
STORE24(p,xtmp);
if(xtmp&3)p++;
xtmp++;
#else
STORE(p);
++p;
#endif
}
if (endmask)
{
*p = MROP_PREBUILT_MASK(srcpix, *p, endmask);
}
}
}
}
xfree(pptFree);
xfree(pwidthFree);
}

File diff suppressed because it is too large Load diff

View file

@ -1,161 +0,0 @@
/*
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
*
* 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, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 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
* XFREE86 PROJECT 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 XFree86 Project 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
* XFree86 Project.
*/
/*
* Unmap names
*/
#undef CFBNAME
#undef CATNAME
#undef QuartetBitsTable
#undef QuartetPixelMaskTable
#undef cfb8ClippedLineCopy
#undef cfb8ClippedLineGeneral
#undef cfb8ClippedLineXor
#undef cfb8LineSS1Rect
#undef cfb8LineSS1RectCopy
#undef cfb8LineSS1RectGeneral
#undef cfb8LineSS1RectPreviousCopy
#undef cfb8LineSS1RectXor
#undef cfb8SegmentSS1Rect
#undef cfb8SegmentSS1RectCopy
#undef cfb8SegmentSS1RectGeneral
#undef cfb8SegmentSS1RectShiftCopy
#undef cfb8SegmentSS1RectXor
#undef cfbAllocatePrivates
#undef cfbBSFuncRec
#undef cfbBitBlt
#undef cfbBresD
#undef cfbBresS
#undef cfbChangeWindowAttributes
#undef cfbClearVisualTypes
#undef cfbCloseScreen
#undef cfbCreateDefColormap
#undef cfbCopyArea
#undef cfbCopyImagePlane
#undef cfbCopyPixmap
#undef cfbCopyPlane
#undef cfbCopyPlaneReduce
#undef cfbCopyRotatePixmap
#undef cfbCopyWindow
#undef cfbCreateGC
#undef cfbCreatePixmap
#undef cfbCreateScreenResources
#undef cfbCreateWindow
#undef cfbDestroyPixmap
#undef cfbDestroyWindow
#undef cfbDoBitblt
#undef cfbDoBitbltCopy
#undef cfbDoBitbltGeneral
#undef cfbDoBitbltOr
#undef cfbDoBitbltXor
#undef cfbExpandDirectColors
#undef cfbFillBoxTile32sCopy
#undef cfbFillBoxTile32sGeneral
#undef cfbFillBoxTileOdd
#undef cfbFillBoxTileOddCopy
#undef cfbFillBoxTileOddGeneral
#undef cfbFillPoly1RectCopy
#undef cfbFillPoly1RectGeneral
#undef cfbFillRectSolidCopy
#undef cfbFillRectSolidGeneral
#undef cfbFillRectSolidXor
#undef cfbFillRectTile32Copy
#undef cfbFillRectTile32General
#undef cfbFillRectTileOdd
#undef cfbFillSpanTile32sCopy
#undef cfbFillSpanTile32sGeneral
#undef cfbFillSpanTileOddCopy
#undef cfbFillSpanTileOddGeneral
#undef cfbFinishScreenInit
#undef cfbGCFuncs
#undef cfbGCPrivateKey
#undef cfbGetImage
#undef cfbGetScreenPixmap
#undef cfbGetSpans
#undef cfbHorzS
#undef cfbImageGlyphBlt8
#undef cfbInitializeColormap
#undef cfbInitVisuals
#undef cfbInstallColormap
#undef cfbLineSD
#undef cfbLineSS
#undef cfbListInstalledColormaps
#undef cfbMapWindow
#undef cfbMatchCommon
#undef cfbNonTEOps
#undef cfbNonTEOps1Rect
#undef cfbPadPixmap
#undef cfbPolyFillArcSolidCopy
#undef cfbPolyFillArcSolidGeneral
#undef cfbPolyFillRect
#undef cfbPolyGlyphBlt8
#undef cfbPolyGlyphRop8
#undef cfbPolyPoint
#undef cfbPositionWindow
#undef cfbPutImage
#undef cfbReduceRasterOp
#undef cfbResolveColor
#undef cfbRestoreAreas
#undef cfbSaveAreas
#undef cfbScreenInit
#undef cfbScreenPrivateKey
#undef cfbSegmentSD
#undef cfbSegmentSS
#undef cfbSetScanline
#undef cfbSetScreenPixmap
#undef cfbSetSpans
#undef cfbSetVisualTypes
#undef cfbSetupScreen
#undef cfbSolidSpansCopy
#undef cfbSolidSpansGeneral
#undef cfbSolidSpansXor
#undef cfbStippleStack
#undef cfbStippleStackTE
#undef cfbTEGlyphBlt
#undef cfbTEOps
#undef cfbTEOps1Rect
#undef cfbTile32FSCopy
#undef cfbTile32FSGeneral
#undef cfbUninstallColormap
#undef cfbUnmapWindow
#undef cfbUnnaturalStippleFS
#undef cfbUnnaturalTileFS
#undef cfbValidateGC
#undef cfbVertS
#undef cfbWindowPrivateKey
#undef cfbXRotatePixmap
#undef cfbYRotatePixmap
#undef cfbZeroPolyArcSS8Copy
#undef cfbZeroPolyArcSS8General
#undef cfbZeroPolyArcSS8Xor
#undef cfbendpartial
#undef cfbendtab
#undef cfbmask
#undef cfbrmask
#undef cfbstartpartial
#undef cfbstarttab

View file

@ -1,160 +0,0 @@
/***********************************************************
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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include "scrnintstr.h"
#include "windowstr.h"
#include "cfb.h"
#include "mistruct.h"
#include "regionstr.h"
#include "cfbmskbits.h"
Bool
cfbCreateWindow(WindowPtr pWin)
{
#ifdef PIXMAP_PER_WINDOW
/* Setup pointer to Screen pixmap */
dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey,
cfbGetScreenPixmap(pWin->drawable.pScreen));
#endif
return TRUE;
}
Bool
cfbDestroyWindow(WindowPtr pWin)
{
return(TRUE);
}
/*ARGSUSED*/
Bool
cfbMapWindow(pWindow)
WindowPtr pWindow;
{
return(TRUE);
}
/*ARGSUSED*/
Bool
cfbPositionWindow(WindowPtr pWin, int x, int y)
{
return (TRUE);
}
/*ARGSUSED*/
Bool
cfbUnmapWindow(pWindow)
WindowPtr pWindow;
{
return (TRUE);
}
/* UNCLEAN!
this code calls the bitblt helper code directly.
cfbCopyWindow copies only the parts of the destination that are
visible in the source.
*/
void
cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
WindowPtr pWin;
DDXPointRec ptOldOrg;
RegionPtr prgnSrc;
{
DDXPointPtr pptSrc;
register DDXPointPtr ppt;
RegionRec rgnDst;
register BoxPtr pbox;
register int dx, dy;
register int i, nbox;
WindowPtr pwinRoot;
pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
REGION_NULL(pWin->drawable.pScreen, &rgnDst);
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
pbox = REGION_RECTS(&rgnDst);
nbox = REGION_NUM_RECTS(&rgnDst);
if(!nbox || !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
{
REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
return;
}
ppt = pptSrc;
for (i = nbox; --i >= 0; ppt++, pbox++)
{
ppt->x = pbox->x1 + dx;
ppt->y = pbox->y1 + dy;
}
cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
GXcopy, &rgnDst, pptSrc, ~0L);
xfree(pptSrc);
REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
}
Bool
cfbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
return (TRUE);
}

View file

@ -1,322 +0,0 @@
/************************************************************
Copyright 1989, 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.
********************************************************/
/* Derived from:
* "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
* by M. L. V. Pitteway
* The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <limits.h>
#include <X11/X.h>
#include <X11/Xprotostr.h>
#include "regionstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "cfb.h"
#include "cfbmskbits.h"
#include "mizerarc.h"
#include "cfbrrop.h"
#include "mi.h"
#ifdef PIXEL_ADDR
static void
RROP_NAME(cfbZeroArcSS8)(
DrawablePtr pDraw,
GCPtr pGC,
xArc *arc)
{
miZeroArcRec info;
Bool do360;
register int x;
PixelType *addrp;
register PixelType *yorgp, *yorgop;
#if PSZ == 24
int xorg, xorg3, xorgo, xorgo3;
register int xtmp;
#endif
RROP_DECLARE
register int yoffset;
int npwidth, dyoffset;
register int y, a, b, d, mask;
register int k1, k3, dx, dy;
cfbGetPixelWidthAndPointer(pDraw,npwidth, addrp)
RROP_FETCH_GC (pGC);
do360 = miZeroArcSetup(arc, &info, TRUE);
yorgp = addrp + ((info.yorg + pDraw->y) * npwidth);
yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth);
info.xorg += pDraw->x;
info.xorgo += pDraw->x;
#if PSZ == 24
xorg = info.xorg;
xorg3 = xorg * 3;
info.xorg = (info.xorg * 3) >> 2;
xorgo = info.xorgo;
xorgo3 = xorgo * 3;
info.xorgo = (info.xorgo * 3) >> 2;
#endif
MIARCSETUP();
yoffset = y ? npwidth : 0;
dyoffset = 0;
mask = info.initialMask;
if (!(arc->width & 1))
{
#if PSZ == 24
if (mask & 2)
RROP_SOLID24((yorgp + info.xorgo), xorgo);
if (mask & 8)
RROP_SOLID24((yorgop + info.xorgo), xorgo);
#else
if (mask & 2)
RROP_SOLID((yorgp + info.xorgo));
if (mask & 8)
RROP_SOLID((yorgop + info.xorgo));
#endif /* PSZ == 24 */
}
if (!info.end.x || !info.end.y)
{
mask = info.end.mask;
info.end = info.altend;
}
if (do360 && (arc->width == arc->height) && !(arc->width & 1))
{
register int xoffset = npwidth;
#if PSZ == 24
PixelType *yorghb = yorgp + (info.h * npwidth);
register int tmp1, tmp2, tmp1_3, tmp2_3;
tmp1 = xorg + info.h;
tmp1_3 = tmp1 * 3;
tmp2 = xorg - info.h;
tmp2_3 = tmp2 * 3;
while (1)
{
xtmp = (xorg3 + x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
xtmp = (xorg3 - x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x);
RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x);
if (a < 0)
break;
xtmp = (tmp1_3 - y * 3) >> 2;
RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y);
RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y);
xtmp = (tmp2_3 + y * 3) >> 2;
RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y);
RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y);
xoffset += npwidth;
MIARCCIRCLESTEP(yoffset += npwidth;);
}
#else
PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg;
PixelType *yorgohb = yorghb - info.h;
yorgp += info.xorg;
yorgop += info.xorg;
yorghb += info.h;
while (1)
{
RROP_SOLID(yorgp + yoffset + x);
RROP_SOLID(yorgp + yoffset - x);
RROP_SOLID(yorgop - yoffset - x);
RROP_SOLID(yorgop - yoffset + x);
if (a < 0)
break;
RROP_SOLID(yorghb - xoffset - y);
RROP_SOLID(yorgohb - xoffset + y);
RROP_SOLID(yorgohb + xoffset + y);
RROP_SOLID(yorghb + xoffset - y);
xoffset += npwidth;
MIARCCIRCLESTEP(yoffset += npwidth;);
}
yorgp -= info.xorg;
yorgop -= info.xorg;
#endif /* PSZ == 24 */
x = info.w;
yoffset = info.h * npwidth;
}
else if (do360)
{
while (y < info.h || x < info.w)
{
MIARCOCTANTSHIFT(dyoffset = npwidth;);
#if PSZ == 24
xtmp = (xorg3 + x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
xtmp = (xorgo3 - x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
#else
RROP_SOLID(yorgp + yoffset + info.xorg + x);
RROP_SOLID(yorgp + yoffset + info.xorgo - x);
RROP_SOLID(yorgop - yoffset + info.xorgo - x);
RROP_SOLID(yorgop - yoffset + info.xorg + x);
#endif
MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
}
}
else
{
while (y < info.h || x < info.w)
{
MIARCOCTANTSHIFT(dyoffset = npwidth;);
if ((x == info.start.x) || (y == info.start.y))
{
mask = info.start.mask;
info.start = info.altstart;
}
#if PSZ == 24
if (mask & 1){
xtmp = (xorg3 + x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
}
if (mask & 2){
xtmp = (xorgo3 - x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
}
if (mask & 4){
xtmp = (xorgo3 - x * 3) >> 2;
RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
}
if (mask & 8){
xtmp = (xorg3 + x * 3) >> 2;
RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
}
#else
if (mask & 1)
RROP_SOLID(yorgp + yoffset + info.xorg + x);
if (mask & 2)
RROP_SOLID(yorgp + yoffset + info.xorgo - x);
if (mask & 4)
RROP_SOLID(yorgop - yoffset + info.xorgo - x);
if (mask & 8)
RROP_SOLID(yorgop - yoffset + info.xorg + x);
#endif /* PSZ == 24 */
if ((x == info.end.x) || (y == info.end.y))
{
mask = info.end.mask;
info.end = info.altend;
}
MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
}
}
if ((x == info.start.x) || (y == info.start.y))
mask = info.start.mask;
#if PSZ == 24
if (mask & 1){
xtmp = (xorg3 + x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
}
if (mask & 4){
xtmp = (xorgo3 - x * 3) >> 2;
RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
}
#else
if (mask & 1)
RROP_SOLID(yorgp + yoffset + info.xorg + x);
if (mask & 4)
RROP_SOLID(yorgop - yoffset + info.xorgo - x);
#endif /* PSZ == 24 */
if (arc->height & 1)
{
#if PSZ == 24
if (mask & 2){
xtmp = (xorgo3 - x * 3) >> 2;
RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
}
if (mask & 8){
xtmp = (xorg3 + x * 3) >> 2;
RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
}
#else
if (mask & 2)
RROP_SOLID(yorgp + yoffset + info.xorgo - x);
if (mask & 8)
RROP_SOLID(yorgop - yoffset + info.xorg + x);
#endif /* PSZ == 24 */
}
RROP_UNDECLARE
}
void
RROP_NAME (cfbZeroPolyArcSS8) (pDraw, pGC, narcs, parcs)
register DrawablePtr pDraw;
GCPtr pGC;
int narcs;
xArc *parcs;
{
register xArc *arc;
register int i;
BoxRec box;
int x2, y2;
RegionPtr cclip;
cclip = cfbGetCompositeClip(pGC);
for (arc = parcs, i = narcs; --i >= 0; arc++)
{
if (miCanZeroArc(arc))
{
box.x1 = arc->x + pDraw->x;
box.y1 = arc->y + pDraw->y;
/*
* Because box.x2 and box.y2 get truncated to 16 bits, and the
* RECT_IN_REGION test treats the resulting number as a signed
* integer, the RECT_IN_REGION test alone can go the wrong way.
* This can result in a server crash because the rendering
* routines in this file deal directly with cpu addresses
* of pixels to be stored, and do not clip or otherwise check
* that all such addresses are within their respective pixmaps.
* So we only allow the RECT_IN_REGION test to be used for
* values that can be expressed correctly in a signed short.
*/
x2 = box.x1 + (int)arc->width + 1;
box.x2 = x2;
y2 = box.y1 + (int)arc->height + 1;
box.y2 = y2;
if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
(RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
RROP_NAME (cfbZeroArcSS8) (pDraw, pGC, arc);
else
miZeroPolyArc(pDraw, pGC, 1, arc);
}
else
miPolyArc(pDraw, pGC, 1, arc);
}
}
#endif

View file

@ -1,121 +0,0 @@
/*
*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
/*
* Stipple stack macro for 68k GCC
*/
#define STIPPLE(addr,stipple,value,width,count,shift) \
__asm volatile ( \
"lea 5f,%/a1\n\
moveq #28,%/d2\n\
addl %2,%/d2\n\
moveq #28,%/d3\n\
subql #4,%2\n\
negl %2\n\
1:\n\
movel %0,%/a0\n\
addl %6,%0\n\
movel %3@+,%/d1\n\
jeq 3f\n\
movel %/d1,%/d0\n\
lsrl %/d2,%/d0\n\
lsll #5,%/d0\n\
lsll %2,%/d1\n\
jmp %/a1@(%/d0:l)\n\
2:\n\
addl #4,%/a0\n\
movel %/d1,%/d0\n\
lsrl %/d3,%/d0\n\
lsll #5,%/d0\n\
lsll #4,%/d1\n\
jmp %/a1@(%/d0:l)\n\
5:\n\
jne 2b ; dbra %1,1b ; jra 4f\n\
. = 5b + 0x20\n\
moveb %5,%/a0@(3)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
. = 5b + 0x40\n\
moveb %5,%/a0@(2)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
. = 5b + 0x60\n\
movew %5,%/a0@(2)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
. = 5b + 0x80\n\
moveb %5,%/a0@(1)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0xa0\n\
moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0xc0\n\
movew %5,%/a0@(1)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0xe0\n\
movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x100\n\
moveb %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x120\n\
moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x140\n\
moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x160\n\
movew %5,%/a0@(2) ; moveb %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x180\n\
movew %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x1a0\n\
moveb %5,%/a0@(3) ; movew %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x1c0\n\
moveb %5,%/a0@(2) ; movew %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
. = 5b + 0x1e0\n\
movel %5,%/a0@\n\
andl %/d1,%/d1 ; jne 2b ; \n\
3: dbra %1,1b ; \n\
4:\n"\
: "=a" (addr), /* %0 */ \
"=d" (count), /* %1 */ \
"=d" (shift), /* %2 */ \
"=a" (stipple) /* %3 */ \
: "0" (addr), /* %4 */ \
"d" (value), /* %5 */ \
"a" (width), /* %6 */ \
"1" (count-1), /* %7 */ \
"2" (shift), /* %8 */ \
"3" (stipple) /* %9 */ \
: /* ctemp */ "d0", \
/* c */ "d1", \
/* lshift */ "d2", \
/* rshift */ "d3", \
/* atemp */ "a0", \
/* case */ "a1")

View file

@ -1,281 +0,0 @@
/*
* $Xorg: stipmips.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
/*
* MIPS assembly code for optimized text rendering.
*
* Other stippling could be done in assembly, but the payoff is
* not nearly as large. Mostly because large areas are heavily
* optimized already.
*/
#ifdef MIPSEL
# define BitsR sll
# define BitsL srl
# define BO(o) o
# define HO(o) o
# define WO(o) o
# define FourBits(dest,bits) and dest, bits, 0xf
#else
# define BitsR srl
# define BitsL sll
# define BO(o) 3-o
# define HO(o) 2-o
# define WO(o) o
# define FourBits(dest,bits) srl dest, bits, 28
#endif
/* reordering instructions would be fatal here */
.set noreorder
/*
* cfbStippleStack(addr, stipple, value, stride, Count, Shift)
* 4 5 6 7 16(sp) 20(sp)
*
* Apply successive 32-bit stipples starting at addr, addr+stride, ...
*
* Used for text rendering, but only when no data could be lost
* when the stipple is shifted left by Shift bits
*/
/* arguments */
#define addr $4
#define stipple $5
#define value $6
#define stride $7
#define Count 16($sp)
#define Shift 20($sp)
/* local variables */
#define count $14
#define shift $13
#define atemp $12
#define bits $11
#define lshift $9
#define sbase $8
#define stemp $2
#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
#define CASE_MASK 0x1e0 /* first case mask */
#define ForEachLine $200
#define NextLine $201
#define NextLine1 $202
#define CaseBegin $203
#define ForEachBits $204
#define ForEachBits1 $205
#define NextBits $206
#ifdef TETEXT
#define cfbStippleStack cfbStippleStackTE
#endif
.globl cfbStippleStack
.ent cfbStippleStack 2
cfbStippleStack:
.frame $sp, 0, $31
lw count, Count /* fetch stack params */
la sbase,CaseBegin /* load up switch table */
lw shift, Shift
li lshift, 4 /* compute offset within */
subu lshift, lshift, shift /* stipple of remaining bits */
#ifdef MIPSEL
addu shift, shift, CASE_SIZE /* first shift for LSB */
#else
addu shift, shift, 28-CASE_SIZE /* first shift for MSB */
#endif
/* do ... while (--count > 0); */
ForEachLine:
lw bits, 0(stipple) /* get stipple bits */
move atemp, addr /* set up for this line */
#ifdef TETEXT
/* Terminal emulator fonts are expanded and have many 0 rows */
beqz bits, NextLine /* skip out early on 0 */
#endif
addu addr, addr, stride /* step for the loop */
BitsR stemp, bits, shift /* get first bits */
and stemp, stemp, CASE_MASK /* compute first branch */
addu stemp, stemp, sbase /* ... */
j stemp /* ... */
BitsL bits, bits, lshift /* set remaining bits */
ForEachBits:
addu atemp, atemp, 4
ForEachBits1:
FourBits(stemp, bits) /* compute jump for */
sll stemp, stemp, CASE_SIZE /* next four bits */
addu stemp, stemp, sbase /* ... */
j stemp /* ... */
BitsL bits, bits, 4 /* step for remaining bits */
CaseBegin:
bnez bits, ForEachBits1 /* 0 */
addu atemp, atemp, 4
NextLine:
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
bnez bits, ForEachBits /* 1 */
sb value, BO(0)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
bnez bits, ForEachBits /* 2 */
sb value, BO(1)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
bnez bits, ForEachBits /* 3 */
sh value, HO(0)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
bnez bits, ForEachBits /* 4 */
sb value, BO(2)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
sb value, BO(0)(atemp) /* 5 */
bnez bits, ForEachBits
sb value, BO(2)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
sb value, BO(1)(atemp) /* 6 */
bnez bits, ForEachBits
sb value, BO(2)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
bnez bits, ForEachBits /* 7 */
swl value, BO(2)(atemp) /* untested on MSB */
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
bnez bits, ForEachBits /* 8 */
sb value, BO(3)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
sb value, BO(0)(atemp) /* 9 */
bnez bits, ForEachBits
sb value, BO(3)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
sb value, BO(1)(atemp) /* a */
bnez bits, ForEachBits
sb value, BO(3)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
sh value, HO(0)(atemp) /* b */
bnez bits, ForEachBits
sb value, BO(3)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
bnez bits, ForEachBits /* c */
sh value, HO(2)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
sb value, BO(0)(atemp) /* d */
bnez bits, ForEachBits
sh value, HO(2)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
bnez bits, ForEachBits /* e */
swr value, BO(1)(atemp) /* untested on MSB */
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
bnez bits, ForEachBits /* f */
sw value, WO(0)(atemp)
addu count, count, -1
bnez count, ForEachLine
addu stipple, stipple, 4
j $31
nop
nop
.end cfbStippleStack

View file

@ -1,290 +0,0 @@
/*
* $Xorg: stipsparc.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
* $XdotOrg: $
*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */
/*
* SPARC assembly code for optimized text rendering.
*
* Other stippling could be done in assembly, but the payoff is
* not nearly as large. Mostly because large areas are heavily
* optimized already.
*/
/* not that I expect to ever see an LSB SPARC, but ... */
#ifdef LITTLE_ENDIAN
# define BitsR sll
# define BitsL srl
# define BO(o) o
# define HO(o) o
# define WO(o) o
# define FourBits(dest,bits) and bits, 0xf, dest
#else
# define BitsR srl
# define BitsL sll
# define BO(o) 3-o
# define HO(o) 2-o
# define WO(o) o
# define FourBits(dest,bits) srl bits, 28, dest
#endif
/*
* cfbStippleStack(addr, stipple, value, stride, Count, Shift)
* 4 5 6 7 16(sp) 20(sp)
*
* Apply successive 32-bit stipples starting at addr, addr+stride, ...
*
* Used for text rendering, but only when no data could be lost
* when the stipple is shifted left by Shift bits
*/
/* arguments */
#define addr %i0
#define stipple %i1
#define value %i2
#define stride %i3
#define count %i4
#define shift %i5
/* local variables */
#define atemp %l0
#define bits %l1
#define lshift %l2
#define sbase %l3
#define stemp %l4
#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
#define CASE_MASK 0x1e0 /* first case mask */
#define ForEachLine LY1
#define NextLine LY2
#define CaseBegin LY3
#define ForEachBits LY4
#define NextBits LY5
#if defined(SVR4) || defined(__ELF__)
#ifdef TETEXT
#define _cfbStippleStack cfbStippleStackTE
#else
#define _cfbStippleStack cfbStippleStack
#endif
#else
#ifdef TETEXT
#define _cfbStippleStack _cfbStippleStackTE
#endif
#endif
.seg "text"
.proc 16
.globl _cfbStippleStack
_cfbStippleStack:
save %sp,-64,%sp
#ifdef SHAREDCODE
1:
call 2f
nop
2:
mov %o7,sbase /* sbase = 1b(1:) */
add sbase, CaseBegin-1b, sbase
#else /* !SHAREDCODE */
sethi %hi(CaseBegin),sbase /* load up switch table */
or sbase,%lo(CaseBegin),sbase
#endif /* SHAREDCODE */
mov 4,lshift /* compute offset within */
sub lshift, shift, lshift /* stipple of remaining bits */
#ifdef LITTLE_ENDIAN
inc CASE_SIZE, shift /* first shift for LSB */
#else
inc 28-CASE_SIZE, shift /* first shift for MSB */
#endif
/* do ... while (--count > 0); */
ForEachLine:
ld [stipple],bits /* get stipple bits */
mov addr,atemp /* set up for this line */
#ifdef TETEXT
/* Terminal emulator fonts are expanded and have many 0 rows */
tst bits
bz NextLine /* skip out early on 0 */
#endif
add addr, stride, addr /* step for the loop */
BitsR bits, shift, stemp /* get first bits */
and stemp, CASE_MASK, stemp /* compute first jump */
BitsL bits, lshift, bits /* set remaining bits */
jmp sbase+stemp /* ... */
tst bits
ForEachBits:
inc 4, atemp
ForEachBits1:
FourBits(stemp, bits) /* compute jump for */
sll stemp, CASE_SIZE, stemp /* these four bits */
BitsL bits, 4, bits /* step for remaining bits */
jmp sbase+stemp /* jump */
tst bits
CaseBegin:
bnz,a ForEachBits1 /* 0 */
inc 4, atemp
NextLine:
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
bnz ForEachBits /* 1 */
stb value, [atemp+BO(0)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
bnz ForEachBits /* 2 */
stb value, [atemp+BO(1)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
bnz ForEachBits /* 3 */
sth value, [atemp+HO(0)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
bnz ForEachBits /* 4 */
stb value, [atemp+BO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
stb value, [atemp+BO(0)] /* 5 */
bnz ForEachBits
stb value, [atemp+BO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
stb value, [atemp+BO(1)] /* 6 */
bnz ForEachBits
stb value, [atemp+BO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
sth value, [atemp+HO(0)] /* 7 */
bnz ForEachBits
stb value, [atemp+BO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
bnz ForEachBits /* 8 */
stb value, [atemp+BO(3)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
stb value, [atemp+BO(0)] /* 9 */
bnz ForEachBits
stb value, [atemp+BO(3)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
stb value, [atemp+BO(1)] /* a */
bnz ForEachBits
stb value, [atemp+BO(3)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
sth value, [atemp+HO(0)] /* b */
bnz ForEachBits
stb value, [atemp+BO(3)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
bnz ForEachBits /* c */
sth value, [atemp+HO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
stb value, [atemp+BO(0)] /* d */
bnz ForEachBits
sth value, [atemp+HO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
stb value, [atemp+BO(1)] /* e */
bnz ForEachBits
sth value, [atemp+HO(2)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
bnz ForEachBits /* f */
st value, [atemp+WO(0)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore

View file

@ -1,291 +0,0 @@
/*
* $Xorg: stipsprc32.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
* $XdotOrg: $
*
Copyright 1990, 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.
*
* Author: Keith Packard, MIT X Consortium
*/
/* $XFree86: xc/programs/Xserver/cfb/stipsprc32.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */
/*
* SPARC assembly code for optimized text rendering.
*
* Other stippling could be done in assembly, but the payoff is
* not nearly as large. Mostly because large areas are heavily
* optimized already.
*/
/* not that I expect to ever see an LSB SPARC, but ... */
#ifdef LITTLE_ENDIAN
# define BitsR sll
# define BitsL srl
# define WO(o) 3-o
# define FourBits(dest,bits) and bits, 0xf, dest
#else
# define BitsR srl
# define BitsL sll
# define WO(o) o
# define FourBits(dest,bits) srl bits, 28, dest
#endif
/*
* cfb32StippleStack(addr, stipple, value, stride, Count, Shift)
* 4 5 6 7 16(sp) 20(sp)
*
* Apply successive 32-bit stipples starting at addr, addr+stride, ...
*
* Used for text rendering, but only when no data could be lost
* when the stipple is shifted left by Shift bits
*/
/* arguments */
#define addr %i0
#define stipple %i1
#define value %i2
#define stride %i3
#define count %i4
#define shift %i5
/* local variables */
#define atemp %l0
#define bits %l1
#define lshift %l2
#define sbase %l3
#define stemp %l4
#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
#define CASE_MASK 0x1e0 /* first case mask */
#define ForEachLine LY1
#define NextLine LY2
#define CaseBegin LY3
#define ForEachBits LY4
#define NextBits LY5
#if defined(SVR4) || defined(__ELF__)
#ifdef TETEXT
#define _cfb32StippleStack cfb32StippleStackTE
#else
#define _cfb32StippleStack cfb32StippleStack
#endif
#else
#ifdef TETEXT
#define _cfb32StippleStack _cfb32StippleStackTE
#endif
#endif
.seg "text"
.proc 16
.globl _cfb32StippleStack
_cfb32StippleStack:
save %sp,-64,%sp
#ifdef SHAREDCODE
1:
call 2f
nop
2:
mov %o7,sbase /* sbase = 1b(1:) */
add sbase, CaseBegin-1b, sbase
#else /* !SHAREDCODE */
sethi %hi(CaseBegin),sbase /* load up switch table */
or sbase,%lo(CaseBegin),sbase
#endif /* !SHAREDCODE */
mov 4,lshift /* compute offset within */
sub lshift, shift, lshift /* stipple of remaining bits */
#ifdef LITTLE_ENDIAN
inc CASE_SIZE, shift /* first shift for LSB */
#else
inc 28-CASE_SIZE, shift /* first shift for MSB */
#endif
/* do ... while (--count > 0); */
ForEachLine:
ld [stipple],bits /* get stipple bits */
mov addr,atemp /* set up for this line */
#ifdef TETEXT
/* Terminal emulator fonts are expanded and have many 0 rows */
tst bits
bz NextLine /* skip out early on 0 */
#endif
add addr, stride, addr /* step for the loop */
BitsR bits, shift, stemp /* get first bits */
and stemp, CASE_MASK, stemp /* compute first jump */
BitsL bits, lshift, bits /* set remaining bits */
jmp sbase+stemp /* ... */
tst bits
ForEachBits:
inc 16, atemp
ForEachBits1:
FourBits(stemp, bits) /* compute jump for */
sll stemp, CASE_SIZE, stemp /* these four bits */
BitsL bits, 4, bits /* step for remaining bits */
jmp sbase+stemp /* jump */
tst bits
CaseBegin:
bnz,a ForEachBits1 /* 0 */
inc 16, atemp
NextLine:
deccc 1, count
NextLine1:
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
bnz ForEachBits /* 1 */
st value, [atemp+WO(12)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
bnz ForEachBits /* 2 */
st value, [atemp+WO(8)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
st value, [atemp+WO(8)] /* 3 */
bnz ForEachBits
st value, [atemp+WO(12)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
bnz ForEachBits /* 4 */
st value, [atemp+WO(4)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
st value, [atemp+WO(4)] /* 5 */
bnz ForEachBits
st value, [atemp+WO(12)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
st value, [atemp+WO(4)] /* 6 */
bnz ForEachBits
st value, [atemp+WO(8)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
st value, [atemp+WO(4)] /* 7 */
st value, [atemp+WO(8)]
bnz ForEachBits
st value, [atemp+WO(12)]
b NextLine1
deccc 1, count
nop
nop
bnz ForEachBits /* 8 */
st value, [atemp+WO(0)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
nop
st value, [atemp+WO(0)] /* 9 */
bnz ForEachBits
st value, [atemp+WO(12)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
st value, [atemp+WO(0)] /* a */
bnz ForEachBits
st value, [atemp+WO(8)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
st value, [atemp+WO(0)] /* b */
st value, [atemp+WO(8)]
bnz ForEachBits
st value, [atemp+WO(12)]
b NextLine1
deccc 1, count
nop
nop
st value, [atemp+WO(0)] /* c */
bnz ForEachBits
st value, [atemp+WO(4)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore
st value, [atemp+WO(0)] /* d */
st value, [atemp+WO(4)]
bnz ForEachBits
st value, [atemp+WO(12)]
b NextLine1
deccc 1, count
nop
nop
st value, [atemp+WO(0)] /* e */
st value, [atemp+WO(4)]
bnz ForEachBits
st value, [atemp+WO(8)]
b NextLine1
deccc 1, count
nop
nop
st value, [atemp+WO(0)] /* f */
st value, [atemp+WO(4)]
st value, [atemp+WO(8)]
bnz ForEachBits
st value, [atemp+WO(12)]
deccc 1, count
bnz,a ForEachLine
inc 4, stipple
ret
restore

View file

@ -1,9 +0,0 @@
noinst_LTLIBRARIES = libcfb32.la
include $(top_srcdir)/cfb/Makefile.am.inc
libcfb32_la_SOURCES = $(libcfb_common_sources) $(libcfb_gen_sources)
INCLUDES = $(CFB_INCLUDES) $(DIX_CFLAGS) -I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/common
AM_CFLAGS = -DPSZ=32 $(PLATFORMDEFS)

View file

@ -289,8 +289,14 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
if (!pPixmap)
return BadMatch;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
pPixmap, RT_WINDOW, pWin, DixCreateAccess);
if (rc != Success)
return rc;
++pPixmap->refcnt;
if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
return BadAlloc;

View file

@ -92,7 +92,7 @@ static Bool
compRepaintBorder (ClientPtr pClient, pointer closure)
{
WindowPtr pWindow;
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess);
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient, DixWriteAccess);
if (rc == Success) {
RegionRec exposed;

View file

@ -213,7 +213,7 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
MALFORMED_MESSAGE_ERROR();
}
dixLookupDevice(&dev, deviceid, serverClient, DixUnknownAccess);
dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess);
if (!dev) {
DebugF("[config/dbus] bogus device id %d given\n", deviceid);
ret = BadMatch;

View file

@ -38,9 +38,10 @@
#include "config-backends.h"
#include "os.h"
#define TYPE_NONE 0
#define TYPE_KEYS 1
#define TYPE_POINTER 2
#define LIBHAL_PROP_KEY "input.x11_options."
#define LIBHAL_XKB_PROP_KEY "input.xkb."
struct config_hal_info {
DBusConnection *system_bus;
@ -50,7 +51,8 @@ struct config_hal_info {
static void
remove_device(DeviceIntPtr dev)
{
DebugF("[config/hal] removing device %s\n", dev->name);
/* this only gets called for devices that have already been added */
LogMessage(X_INFO, "config/hal: removing device %s\n", dev->name);
/* Call PIE here so we don't try to dereference a device that's
* already been removed. */
@ -105,7 +107,7 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
char *prop, *ret;
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
DebugF("[config/hal] getting %s on %s returned %s\n", name, udi, prop);
LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop);
if (prop) {
ret = xstrdup(prop);
libhal_free_string(prop);
@ -117,6 +119,9 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
return ret;
}
/* this function is no longer used... keep it here in case its needed in
* the future. */
#if 0
static char *
get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
{
@ -150,117 +155,146 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
return ret;
}
#endif
static void
device_added(LibHalContext *hal_ctx, const char *udi)
{
char **props;
char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL;
char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL;
char *xkb_options = NULL, *config_info = NULL;
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
InputOption *options = NULL, *tmpo = NULL;
DeviceIntPtr dev;
DBusError error;
int type = TYPE_NONE;
int i;
LibHalPropertySet *set = NULL;
LibHalPropertySetIterator set_iter;
char *psi_key = NULL, *tmp_val, *tmp_key;
dbus_error_init(&error);
props = libhal_device_get_property_strlist(hal_ctx, udi,
"info.capabilities", &error);
if (!props) {
DebugF("[config/hal] couldn't get capabilities for %s: %s (%s)\n",
udi, error.name, error.message);
goto out_error;
}
for (i = 0; props[i]; i++) {
/* input.keys is the new, of which input.keyboard is a subset, but
* input.keyboard is the old 'we have keys', so we have to keep it
* around. */
if (strcmp(props[i], "input.keys") == 0 ||
strcmp(props[i], "input.keyboard") == 0)
type |= TYPE_KEYS;
if (strcmp(props[i], "input.mouse") == 0 ||
strcmp(props[i], "input.touchpad") == 0)
type |= TYPE_POINTER;
}
libhal_free_string_array(props);
if (type == TYPE_NONE)
goto out_error;
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
path = get_prop_string(hal_ctx, udi, "input.device");
if (!driver || !path) {
DebugF("[config/hal] no driver or path specified for %s\n", udi);
if (!driver){
/* verbose, don't tell the user unless they _want_ to see it */
LogMessageVerb(X_INFO,7,"config/hal: no driver specified for device %s\n", udi);
goto unwind;
}
path = get_prop_string(hal_ctx, udi, "input.device");
if (!path) {
LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
goto unwind;
}
name = get_prop_string(hal_ctx, udi, "info.product");
if (!name)
name = xstrdup("(unnamed)");
if (type & TYPE_KEYS) {
xkb_rules = get_prop_string(hal_ctx, udi, "input.xkb.rules");
xkb_model = get_prop_string(hal_ctx, udi, "input.xkb.model");
xkb_layout = get_prop_string(hal_ctx, udi, "input.xkb.layout");
xkb_variant = get_prop_string(hal_ctx, udi, "input.xkb.variant");
xkb_options = get_prop_string_array(hal_ctx, udi, "input.xkb.options");
}
options = xcalloc(sizeof(*options), 1);
if (!options){
LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
goto unwind;
}
options->key = xstrdup("_source");
options->value = xstrdup("server/hal");
if (!options->key || !options->value) {
ErrorF("[config] couldn't allocate first key/value pair\n");
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
goto unwind;
}
/* most drivers use device.. not path. evdev uses both however, but the
* path version isn't documented apparently. support both for now. */
add_option(&options, "path", path);
add_option(&options, "device", path);
add_option(&options, "driver", driver);
add_option(&options, "name", name);
config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */
if (!config_info)
if (!config_info) {
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
}
sprintf(config_info, "hal:%s", udi);
if (xkb_rules)
add_option(&options, "xkb_rules", xkb_rules);
if (xkb_model)
add_option(&options, "xkb_model", xkb_model);
if (xkb_layout)
add_option(&options, "xkb_layout", xkb_layout);
if (xkb_variant)
add_option(&options, "xkb_variant", xkb_variant);
if (xkb_options)
add_option(&options, "xkb_options", xkb_options);
/* ok, grab options from hal.. iterate through all properties
* and lets see if any of them are options that we can add */
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
if (!set) {
LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n",
udi, error.name, error.message);
goto unwind;
}
libhal_psi_init(&set_iter,set);
while (libhal_psi_has_more(&set_iter)) {
/* we are looking for supported keys.. extract and add to options */
psi_key = libhal_psi_get_key(&set_iter);
if (psi_key){
DebugF("[config/hal] Adding device %s\n", name);
/* normal options first (input.x11_options.<propname>) */
if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
/* only support strings for all values */
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
if (tmp_val){
add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
xfree(tmp_val);
}
/* evdev's XKB options... we should probably depreciate this usage */
} else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
/* only support strings for all values */
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
if (tmp_val){
/* add "xkb_" + NULL */
tmp_key = xalloc(strlen(psi_key) - ( sizeof(LIBHAL_XKB_PROP_KEY) - 1) + 5);
if (!tmp_key){
LogMessage(X_ERROR, "config/hal: couldn't allocate memory for option %s\n", psi_key);
} else {
sprintf(tmp_key, "xkb_%s", psi_key + sizeof(LIBHAL_XKB_PROP_KEY)-1);
add_option(&options, tmp_key, tmp_val);
xfree(tmp_key);
}
xfree(tmp_val);
}
}
}
/* psi_key doesn't need to be freed */
libhal_psi_next(&set_iter);
}
/* this isn't an error, but how else do you output something that the user can see? */
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
if (NewInputDeviceRequest(options, &dev) != Success) {
ErrorF("[config/hal] NewInputDeviceRequest failed\n");
LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
dev = NULL;
goto unwind;
}
for (; dev; dev = dev->next)
for (; dev; dev = dev->next){
if (dev->config_info)
xfree(dev->config_info);
dev->config_info = xstrdup(config_info);
}
unwind:
if (set)
libhal_free_property_set(set);
if (path)
xfree(path);
if (driver)
xfree(driver);
if (name)
xfree(name);
if (xkb_rules)
xfree(xkb_rules);
if (xkb_model)
xfree(xkb_model);
if (xkb_layout)
xfree(xkb_layout);
if (xkb_variant)
xfree(xkb_variant);
if (xkb_options)
xfree(xkb_options);
if (config_info)
xfree(config_info);
while (!dev && (tmpo = options)) {
@ -270,7 +304,6 @@ unwind:
xfree(tmpo);
}
out_error:
dbus_error_free(&error);
return;
@ -286,7 +319,7 @@ disconnect_hook(void *data)
if (dbus_connection_get_is_connected(info->system_bus)) {
dbus_error_init(&error);
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
error.name, error.message);
dbus_error_free(&error);
}
@ -312,21 +345,21 @@ connect_hook(DBusConnection *connection, void *data)
if (!info->hal_ctx)
info->hal_ctx = libhal_ctx_new();
if (!info->hal_ctx) {
ErrorF("[config/hal] couldn't create HAL context\n");
LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n");
goto out_err;
}
if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
ErrorF("[config/hal] couldn't associate HAL context with bus\n");
LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
goto out_ctx;
}
if (!libhal_ctx_init(info->hal_ctx, &error)) {
ErrorF("[config/hal] couldn't initialise context: %s (%s)\n",
LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
error.name, error.message);
goto out_ctx;
}
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
ErrorF("[config/hal] couldn't watch all properties: %s (%s)\n",
LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
error.name, error.message);
goto out_ctx2;
}
@ -346,7 +379,7 @@ connect_hook(DBusConnection *connection, void *data)
out_ctx2:
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
error.name, error.message);
out_ctx:
libhal_ctx_free(info->hal_ctx);
@ -374,10 +407,13 @@ config_hal_init(void)
hal_info.hal_ctx = NULL;
if (!config_dbus_core_add_hook(&hook)) {
ErrorF("[config/hal] failed to add D-Bus hook\n");
LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n");
return 0;
}
/* verbose message */
LogMessageVerb(X_INFO,7,"config/hal: initialized");
return 1;
}

View file

@ -1,7 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<!-- FIXME: Support tablets too. -->
<!-- The way this works:
Match against some input device (see the HAL specification for more
information), and then merge in keys, which you can use to specify
the configuration similar to the way you would in xorg.conf. You will
need to restart HAL after making changes. If you are having issues,
starting X with the -logverbose 7 flag may yield useful information.
Keys Supported:
Key "input.x11_driver" (string)
This specifies the driver to use. You MUST specify this option,
or a driver will not be loaded and the rest will be ignored by
Xorg
Key "input.x11_options.<option name>" (string)
This allows you to specify arbitrary options to pass to the driver.
Anything you would normally specify in xorg.conf goes here. So, for
option "Mode" in xorg.conf, you would specify the key name of
"input.x11_options.Mode".
Do not specify "input.x11_options.Device" since "input.device"
will be used automatically.
Legacy Keys
"input.xkb.rules"
"input.xkb.model"
"input.xkb.layout"
"input.xkb.variant"
"input.xkb.options"
These keys are deprecated. Use these instead:
"input.x11_options.XkbRules"
"input.x11_options.XkbModel"
"input.x11_options.XkbLayout"
"input.x11_options.XkbVariant"
"input.x11_options.XkbOptions"
See the evdev documentation for more information.
You will probably want to add the following option to the ServerFlags of
your xorg.conf:
Option "AllowEmptyInput" "True"
FIXME: Support tablets too.
TODO: I think its fixed, can't test
-->
<match key="info.capabilities" contains="input.mouse">
<merge key="input.x11_driver" type="string">mouse</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
@ -11,21 +61,21 @@
</match>
<match key="info.capabilities" contains="input.keys">
<merge key="input.xkb.rules" type="string">base</merge>
<merge key="input.x11_options.XkbRules" type="string">base</merge>
<!-- If we're using Linux, we use evdev by default (falling back to
keyboard otherwise). -->
<merge key="input.x11_driver" type="string">keyboard</merge>
<merge key="input.xkb.model" type="string">pc105</merge>
<merge key="input.x11_options.XkbModel" type="string">pc105</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
string="Linux">
<merge key="input.x11_driver" type="string">evdev</merge>
<merge key="input.xkb.model" type="string">evdev</merge>
<merge key="input.x11_options.XkbModel" type="string">evdev</merge>
</match>
<merge key="input.xkb.layout" type="string">us</merge>
<merge key="input.x11_options.XkbLayout" type="string">us</merge>
<merge key="input.xkb.variant" type="string" />
<merge key="input.x11_options.XkbVariant" type="string" />
</match>
</device>
</deviceinfo>

View file

@ -26,7 +26,7 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
AC_INIT([xorg-server], 1.4.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_INIT([xorg-server], 1.5.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
@ -58,6 +58,7 @@ AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
DOLT
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_PROG_LEX
@ -293,7 +294,6 @@ dnl Bus options and CPU capabilities. Replaces logic in
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
dnl ---------------------------------------------------------------------------
DEFAULT_INT10="x86emu"
use_x86_asm="no"
dnl Override defaults as needed for specific platforms:
@ -310,12 +310,11 @@ case $host_cpu in
ARM_VIDEO=yes
;;
i*86)
use_x86_asm="yes"
I386_VIDEO=yes
case $host_os in
darwin*) use_x86_asm="no" ;;
*linux*) DEFAULT_INT10=vm86 ;;
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
*dragonfly*) AC_DEFINE(USE_DEV_IO) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL)
SYS_LIBS=-li386
;;
@ -337,11 +336,10 @@ case $host_cpu in
GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
;;
x86_64*|amd64*)
use_x86_asm="yes"
I386_VIDEO=yes
case $host_os in
darwin*) use_x86_asm="no" ;;
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
*dragonfly*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
SYS_LIBS=-lx86_64
;;
@ -372,7 +370,7 @@ DRI2=no
KDRIVE_HW=no
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
*freebsd*)
*freebsd* | *dragonfly*)
case $host_os in
kfreebsd*-gnu) ;;
*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
@ -576,9 +574,8 @@ AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
dnl legacy fb support
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG])
AC_ARG_ENABLE(cfb, AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG])
AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG])
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: disable)]), [AFB=$enableval], [AFB=no])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@ -710,6 +707,15 @@ if test "x$NEED_DBUS" = xyes; then
fi
CONFIG_LIB='$(top_builddir)/config/libconfig.a'
AC_MSG_CHECKING([for glibc...])
AC_PREPROC_IFELSE([
#include <features.h>
#ifndef __GLIBC__
#error
#endif
], glibc=yes, glibc=no)
AC_MSG_RESULT([$glibc])
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
[have_clock_gettime=no])])
@ -725,9 +731,13 @@ if ! test "x$have_clock_gettime" = xno; then
LIBS_SAVE="$LIBS"
LIBS="$CLOCK_LIBS"
CPPFLAGS_SAVE="$CPPFLAGS"
if test x"$glibc" = xyes; then
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
fi
AC_RUN_IFELSE([
#define _POSIX_C_SOURCE 199309L
#include <time.h>
int main(int argc, char *argv[[]]) {
@ -742,6 +752,7 @@ int main(int argc, char *argv[[]]) {
[MONOTONIC_CLOCK="cross compiling"])
LIBS="$LIBS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
else
MONOTONIC_CLOCK=no
fi
@ -758,7 +769,6 @@ if test "x$XV" = xyes; then
AC_DEFINE(XV, 1, [Support Xv extension])
AC_DEFINE(XvExtension, 1, [Build Xv extension])
REQUIRED_MODULES="$REQUIRED_MODULES videoproto"
PKG_CHECK_MODULES(XV, [xv >= 0.22])
else
XVMC=no
fi
@ -874,7 +884,7 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
if test "x$DRI2" = xyes; then
# FIXME: Bump the versions once we have releases of these.
AC_DEFINE(DRI2, 1, [Build DRI2 extension])
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto >= 2.0.3])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1])
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1])
fi
@ -1023,6 +1033,8 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have 'strcasecmp'.]))
AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
[Do not have 'strncasecmp'.]))
if test "x$NULL_ROOT_CURSOR" = xyes; then
AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
@ -1094,8 +1106,6 @@ AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrappe
if test "x$DEBUGGING" = xyes; then
AC_DEFINE(DEBUG, 1, [Enable debugging code])
else
AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
@ -1151,6 +1161,9 @@ XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${LIBCRYPTO}"
AC_SUBST([XSERVER_LIBS])
AC_SUBST([XSERVER_SYS_LIBS])
UTILS_SYS_LIBS="${SYS_LIBS}"
AC_SUBST([UTILS_SYS_LIBS])
# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this. gcc should set these flags
# when -rdynamic is passed to it, other compilers/linkers may need to be added
@ -1168,9 +1181,6 @@ if test "x$GCC" = "xyes"; then
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
darwin*)
LD_EXPORT_SYMBOLS_FLAG=""
;;
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
@ -1330,6 +1340,13 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB"
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
SAVE_LIBS=$LIBS
SAVE_CFLAGS=$CFLAGS
CFLAGS=$PCIACCESS_CFLAGS
LIBS=$PCIACCESS_LIBS
AC_CHECK_FUNCS([pci_system_init_dev_mem])
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
@ -1359,7 +1376,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
;;
esac
;;
freebsd* | kfreebsd*-gnu)
freebsd* | kfreebsd*-gnu | dragonfly*)
XORG_OS="freebsd"
XORG_OS_SUBDIR="bsd"
xorg_bus_bsdpci="yes"
@ -1439,17 +1456,9 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
esac
case $host_cpu in
i*86)
case $host_os in
darwin*) ;;
*bsd*) ;;
linux*) ;;
*) xorg_bus_ix86pci=yes ;;
esac
;;
powerpc*)
case $host_os in
darwin*|linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
;;
*)
xorg_bus_ppcpci="yes"
@ -1460,9 +1469,9 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
xorg_bus_sparcpci="yes"
xorg_bus_sparc="yes"
;;
x86_64*|amd64*)
i*86|x86_64*|amd64*)
case $host_os in
darwin*|*bsd*|linux*)
*bsd*|linux*)
;;
*)
xorg_bus_ix86pci="yes"
@ -1562,7 +1571,11 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
abi_xinput=`extract_abi XINPUT`
abi_extension=`extract_abi EXTENSION`
abi_font=`extract_abi FONT`
AC_SUBST([abi_ansic abi_videodrv abi_xinput abi_extension abi_font])
AC_SUBST([abi_ansic])
AC_SUBST([abi_videodrv])
AC_SUBST([abi_xinput])
AC_SUBST([abi_extension])
AC_SUBST([abi_font])
fi
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
@ -1583,12 +1596,10 @@ AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
dnl legacy fb support
test "x$MFB" = xauto && MFB="$XORG"
test "x$CFB" = xauto && CFB="$XORG"
test "x$AFB" = xauto && AFB="$XORG"
AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
AM_CONDITIONAL(CFB, [test "x$CFB" = xyes])
AM_CONDITIONAL(AFB, [test "x$AFB" = xyes])
if test "x$MFB" = xyes -o "x$CFB" = xyes -o "x$AFB" = xyes; then
if test "x$MFB" = xyes -o "x$AFB" = xyes; then
if test "x$XORG" != xyes; then
AC_MSG_ERROR([legacy fb support requires the Xorg server])
fi
@ -1665,17 +1676,17 @@ fi
AC_MSG_RESULT([$XWIN])
if test "x$XWIN" = xyes; then
XWIN_SERVER_NAME=XWin
case $host_os in
cygwin*)
XWIN_SERVER_NAME=XWin
PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
CFLAGS="$CFLAGS -DFD_SETSIZE=256"
;;
mingw*)
PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
XWIN_SERVER_NAME=Xming
PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
XWIN_SYS_LIBS=-lwinsock2
@ -1737,7 +1748,8 @@ if test "X$XQUARTZ" = Xauto; then
fi
if test "x$XQUARTZ" = xyes; then
AC_DEFINE([XQUARTZ],[1],[Have Quartz])
AC_DEFINE(XQUARTZ,1,[Have Quartz])
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
#glxAGL / glxCGL don't work yet
# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
@ -1771,10 +1783,6 @@ if test "x$XQUARTZ" = xyes; then
AC_MSG_NOTICE([Disabling DGA extension])
DGA=no
fi
if test "x$DMX" = xyes || test "x$DMX" = xauto; then
AC_MSG_NOTICE([Disabling DMX DDX])
DMX=no
fi
fi
# Support for objc in autotools is minimal and not documented.
@ -1817,51 +1825,58 @@ if test "x$LAUNCHD" = "xyes" ; then
fi
AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
dnl DMX DDX
AC_MSG_CHECKING([whether to build Xdmx DDX])
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
if test "x$DMX" = xauto; then
DMX="$have_dmx"
DMX="$have_dmx"
case $host_os in
cygwin*) DMX="no" ;;
darwin*) DMX="no" ;;
esac
fi
AC_MSG_RESULT([$DMX])
AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])
if test "x$DMX" = xyes; then
if test "x$have_dmx" = xno; then
AC_MSG_ERROR([Xdmx build explicitly requested, but required
modules not found.])
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
XDMX_CFLAGS="$DMXMODULES_CFLAGS"
XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
AC_SUBST([XDMX_CFLAGS])
AC_SUBST([XDMX_LIBS])
AC_SUBST([XDMX_SYS_LIBS])
if test "x$have_dmx" = xno; then
AC_MSG_ERROR([Xdmx build explicitly requested, but required
modules not found.])
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
XDMX_CFLAGS="$DMXMODULES_CFLAGS"
XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
AC_SUBST([XDMX_CFLAGS])
AC_SUBST([XDMX_LIBS])
AC_SUBST([XDMX_SYS_LIBS])
dnl USB sources in DMX require <linux/input.h>
AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
DMX_BUILD_USB="no")
AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
DMX_BUILD_USB="no")
dnl Linux sources in DMX require <linux/keyboard.h>
AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
DMX_BUILD_LNX="no")
if test "x$GLX" = xyes; then
PKG_CHECK_MODULES([GL], [glproto])
fi
PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11])
AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
AC_SUBST(XDMXCONFIG_DEP_LIBS)
PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11])
AC_SUBST(DMXEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11])
AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11])
AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11])
AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11])
AC_SUBST(XRESEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11])
AC_SUBST(X11EXAMPLES_DEP_LIBS)
AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
DMX_BUILD_LNX="no")
if test "x$GLX" = xyes; then
PKG_CHECK_MODULES([GL], [glproto])
fi
PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11])
AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
AC_SUBST(XDMXCONFIG_DEP_LIBS)
PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11])
AC_SUBST(DMXEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11])
AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11])
AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11])
AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11])
AC_SUBST(XRESEXAMPLES_DEP_LIBS)
PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11])
AC_SUBST(X11EXAMPLES_DEP_LIBS)
fi
AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
@ -1925,7 +1940,11 @@ if test "$KDRIVE" = yes; then
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
fi
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
XEPHYR_REQUIRED_LIBS="x11 xext xfont xau xdmcp"
if test "x$XV" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
fi
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
if test "x$XEPHYR" = xauto; then
XEPHYR=$xephyr
fi
@ -1957,7 +1976,7 @@ if test "$KDRIVE" = yes; then
KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS $XV_CFLAGS"
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
@ -1971,10 +1990,10 @@ if test "$KDRIVE" = yes; then
KDRIVE_LOCAL_LIBS="$TSLIB_LIBS $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB $CONFIG_LIB"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB"
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $XV_LIBS"
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS"
# check if we can build Xephyr
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
AC_SUBST([XEPHYR_LIBS])
AC_SUBST([XEPHYR_INCS])
@ -2094,7 +2113,9 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
AC_SUBST([DIX_CFLAGS])
AC_SUBST([libdir exec_prefix prefix])
AC_SUBST([libdir])
AC_SUBST([exec_prefix])
AC_SUBST([prefix])
# Man page sections - used in config utils & generating man pages
XORG_MANPAGE_SECTIONS
@ -2127,8 +2148,6 @@ fb/Makefile
record/Makefile
XTrap/Makefile
mfb/Makefile
cfb/Makefile
cfb32/Makefile
config/Makefile
mi/Makefile
miext/Makefile
@ -2136,7 +2155,6 @@ miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/rootless/Makefile
miext/rootless/safeAlpha/Makefile
miext/rootless/accel/Makefile
os/Makefile
randr/Makefile
@ -2191,7 +2209,6 @@ hw/xfree86/xaa/Makefile
hw/xfree86/xf1bpp/Makefile
hw/xfree86/xf4bpp/Makefile
hw/xfree86/xf8_16bpp/Makefile
hw/xfree86/xf8_32bpp/Makefile
hw/xfree86/utils/Makefile
hw/xfree86/utils/cvt/Makefile
hw/xfree86/utils/gtf/Makefile

View file

@ -29,6 +29,7 @@ libdix_la_SOURCES = \
property.c \
registry.c \
resource.c \
selection.c \
swaprep.c \
swapreq.c \
tables.c \

View file

@ -1006,6 +1006,7 @@ FakeAllocColor (ColormapPtr pmap, xColorItem *item)
switch (class) {
case GrayScale:
case PseudoColor:
temp = 0;
item->pixel = 0;
if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP,
-1, AllComp) == Success) {

View file

@ -618,12 +618,12 @@ CloseDownDevices(void)
for (dev = inputInfo.devices; dev; dev = next)
{
next = dev->next;
CloseDevice(dev);
DeleteInputDeviceRequest(dev);
}
for (dev = inputInfo.off_devices; dev; dev = next)
{
next = dev->next;
CloseDevice(dev);
DeleteInputDeviceRequest(dev);
}
inputInfo.devices = NULL;
inputInfo.off_devices = NULL;

View file

@ -165,10 +165,6 @@ typedef const char *string;
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
_X_EXPORT Selection *CurrentSelections;
_X_EXPORT int NumCurrentSelections;
CallbackListPtr SelectionCallback = NULL;
static ClientPtr grabClient;
#define GrabNone 0
#define GrabActive 1
@ -181,8 +177,6 @@ extern int connBlockScreenStart;
static void KillAllClients(void);
static void DeleteClientFromAnySelections(ClientPtr client);
static int nextFreeClientID; /* always MIN free client ID */
static int nClients; /* number of authorized clients */
@ -246,14 +240,6 @@ UpdateCurrentTimeIf(void)
currentTime = systime;
}
static void
InitSelections(void)
{
if (CurrentSelections)
xfree(CurrentSelections);
CurrentSelections = (Selection *)NULL;
NumCurrentSelections = 0;
}
#ifdef SMART_SCHEDULE
#undef SMART_DEBUG
@ -372,7 +358,6 @@ Dispatch(void)
#endif
nextFreeClientID = 1;
InitSelections();
nClients = 0;
clientReady = (int *) xalloc(sizeof(int) * MaxClients);
@ -967,217 +952,6 @@ ProcGetAtomName(ClientPtr client)
}
}
int
ProcSetSelectionOwner(ClientPtr client)
{
WindowPtr pWin;
TimeStamp time;
int rc;
REQUEST(xSetSelectionOwnerReq);
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
UpdateCurrentTime();
time = ClientTimeToServerTime(stuff->time);
/* If the client's time stamp is in the future relative to the server's
time stamp, do not set the selection, just return success. */
if (CompareTimeStamps(time, currentTime) == LATER)
return Success;
if (stuff->window != None)
{
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
if (rc != Success)
return rc;
}
else
pWin = (WindowPtr)None;
if (ValidAtom(stuff->selection))
{
int i = 0;
rc = XaceHookSelectionAccess(client, stuff->selection,
DixSetAttrAccess);
if (rc != Success)
return rc;
/*
* First, see if the selection is already set...
*/
while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != stuff->selection)
i++;
if (i < NumCurrentSelections)
{
xEvent event;
/* If the timestamp in client's request is in the past relative
to the time stamp indicating the last time the owner of the
selection was set, do not set the selection, just return
success. */
if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged)
== EARLIER)
return Success;
if (CurrentSelections[i].client &&
(!pWin || (CurrentSelections[i].client != client)))
{
event.u.u.type = SelectionClear;
event.u.selectionClear.time = time.milliseconds;
event.u.selectionClear.window = CurrentSelections[i].window;
event.u.selectionClear.atom = CurrentSelections[i].selection;
(void) TryClientEvents (CurrentSelections[i].client, &event, 1,
NoEventMask, NoEventMask /* CantBeFiltered */,
NullGrab);
}
}
else
{
/*
* It doesn't exist, so add it...
*/
Selection *newsels;
if (i == 0)
newsels = (Selection *)xalloc(sizeof(Selection));
else
newsels = (Selection *)xrealloc(CurrentSelections,
(NumCurrentSelections + 1) * sizeof(Selection));
if (!newsels)
return BadAlloc;
NumCurrentSelections++;
CurrentSelections = newsels;
CurrentSelections[i].selection = stuff->selection;
CurrentSelections[i].devPrivates = NULL;
}
CurrentSelections[i].lastTimeChanged = time;
CurrentSelections[i].window = stuff->window;
CurrentSelections[i].pWin = pWin;
CurrentSelections[i].client = (pWin ? client : NullClient);
if (SelectionCallback)
{
SelectionInfoRec info;
info.selection = &CurrentSelections[i];
info.client = client;
info.kind= SelectionSetOwner;
CallCallbacks(&SelectionCallback, &info);
}
return (client->noClientException);
}
else
{
client->errorValue = stuff->selection;
return (BadAtom);
}
}
int
ProcGetSelectionOwner(ClientPtr client)
{
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
if (ValidAtom(stuff->id))
{
int rc, i;
xGetSelectionOwnerReply reply;
rc = XaceHookSelectionAccess(client, stuff->id, DixGetAttrAccess);
if (rc != Success)
return rc;
i = 0;
while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != stuff->id) i++;
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
if (i < NumCurrentSelections) {
if (SelectionCallback) {
SelectionInfoRec info;
info.selection = &CurrentSelections[i];
info.client = client;
info.kind= SelectionGetOwner;
CallCallbacks(&SelectionCallback, &info);
}
reply.owner = CurrentSelections[i].window;
} else
reply.owner = None;
WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
return(client->noClientException);
}
else
{
client->errorValue = stuff->id;
return (BadAtom);
}
}
int
ProcConvertSelection(ClientPtr client)
{
Bool paramsOkay;
xEvent event;
WindowPtr pWin;
REQUEST(xConvertSelectionReq);
int rc;
REQUEST_SIZE_MATCH(xConvertSelectionReq);
rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHookSelectionAccess(client, stuff->selection, DixReadAccess);
if (rc != Success)
return rc;
paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target));
if (stuff->property != None)
paramsOkay &= ValidAtom(stuff->property);
if (paramsOkay)
{
int i;
i = 0;
while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != stuff->selection) i++;
if (i < NumCurrentSelections && CurrentSelections[i].window != None) {
if (SelectionCallback) {
SelectionInfoRec info;
info.selection = &CurrentSelections[i];
info.client = client;
info.kind= SelectionConvertSelection;
CallCallbacks(&SelectionCallback, &info);
}
event.u.u.type = SelectionRequest;
event.u.selectionRequest.time = stuff->time;
event.u.selectionRequest.owner = CurrentSelections[i].window;
event.u.selectionRequest.requestor = stuff->requestor;
event.u.selectionRequest.selection = stuff->selection;
event.u.selectionRequest.target = stuff->target;
event.u.selectionRequest.property = stuff->property;
if (TryClientEvents(
CurrentSelections[i].client, &event, 1, NoEventMask,
NoEventMask /* CantBeFiltered */, NullGrab))
return (client->noClientException);
}
event.u.u.type = SelectionNotify;
event.u.selectionNotify.time = stuff->time;
event.u.selectionNotify.requestor = stuff->requestor;
event.u.selectionNotify.selection = stuff->selection;
event.u.selectionNotify.target = stuff->target;
event.u.selectionNotify.property = None;
(void) TryClientEvents(client, &event, 1, NoEventMask,
NoEventMask /* CantBeFiltered */, NullGrab);
return (client->noClientException);
}
else
{
client->errorValue = stuff->property;
return (BadAtom);
}
}
int
ProcGrabServer(ClientPtr client)
{
@ -3980,54 +3754,6 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
WriteEventsToClient (client, 1, (xEvent *)&rep);
}
void
DeleteWindowFromAnySelections(WindowPtr pWin)
{
int i;
for (i = 0; i< NumCurrentSelections; i++)
if (CurrentSelections[i].pWin == pWin)
{
if (SelectionCallback)
{
SelectionInfoRec info;
info.selection = &CurrentSelections[i];
info.kind = SelectionWindowDestroy;
CallCallbacks(&SelectionCallback, &info);
}
dixFreePrivates(CurrentSelections[i].devPrivates);
CurrentSelections[i].pWin = (WindowPtr)NULL;
CurrentSelections[i].window = None;
CurrentSelections[i].client = NullClient;
CurrentSelections[i].devPrivates = NULL;
}
}
static void
DeleteClientFromAnySelections(ClientPtr client)
{
int i;
for (i = 0; i< NumCurrentSelections; i++)
if (CurrentSelections[i].client == client)
{
if (SelectionCallback)
{
SelectionInfoRec info;
info.selection = &CurrentSelections[i];
info.kind = SelectionWindowDestroy;
CallCallbacks(&SelectionCallback, &info);
}
dixFreePrivates(CurrentSelections[i].devPrivates);
CurrentSelections[i].pWin = (WindowPtr)NULL;
CurrentSelections[i].window = None;
CurrentSelections[i].client = NullClient;
CurrentSelections[i].devPrivates = NULL;
}
}
void
MarkClientException(ClientPtr client)
{

View file

@ -2170,6 +2170,13 @@ XYToWindow(int x, int y)
wInputShape(pWin),
x - pWin->drawable.x,
y - pWin->drawable.y, &box))
#endif
#ifdef ROOTLESS
/* In rootless mode windows may be offscreen, even when
* they're in X's stack. (E.g. if the native window system
* implements some form of virtual desktop system).
*/
&& !pWin->rootlessUnhittable
#endif
)
{

View file

@ -349,7 +349,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
xv->type = DeviceValuator;
xv->first_valuator = i;
xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i);
xv->num_valuators = ((final_valuator - i) > 6) ? 6 : (final_valuator - i);
xv->deviceid = pDev->id;
switch (final_valuator - i) {
case 6:

View file

@ -93,6 +93,7 @@ Equipment Corporation.
#include "colormap.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "selection.h"
#include <X11/fonts/font.h>
#include "opaque.h"
#include "servermd.h"
@ -112,6 +113,9 @@ Equipment Corporation.
#include "dispatch.h" /* InitProcVectors() */
#endif
#include <pthread.h>
pthread_key_t threadname_key=0;
#ifdef DPMSExtension
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
@ -247,6 +251,17 @@ main(int argc, char *argv[], char *envp[])
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL));
ErrorF("threadname_key = %d\n", threadname_key);
if(pthread_getspecific(threadname_key) == NULL) {
char *nameptr = malloc(32);
sprintf(nameptr, "main thread %d", random());
// strcpy(nameptr, "main thread");
ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr));
if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key));
} else {
if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key));
}
display = "0";
InitGlobals();
@ -346,6 +361,7 @@ main(int argc, char *argv[], char *envp[])
InitAtoms();
InitEvents();
InitSelections();
InitGlyphCaching();
if (!dixResetPrivates())
FatalError("couldn't init private data storage");

View file

@ -63,11 +63,10 @@ SOFTWARE.
/*****************************************************************
* Property Stuff
*
* ChangeProperty, DeleteProperty, GetProperties,
* ListProperties
* dixLookupProperty, dixChangeProperty, DeleteProperty
*
* Properties below to windows. A allocate slots each time
* a property is added. No fancy searching done.
* Properties belong to windows. The list of properties should not be
* traversed directly. Instead, use the three functions listed above.
*
*****************************************************************/
@ -91,17 +90,22 @@ PrintPropertys(WindowPtr pWin)
}
#endif
static _X_INLINE PropertyPtr
FindProperty(WindowPtr pWin, Atom propertyName)
_X_EXPORT int
dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
ClientPtr client, Mask access_mode)
{
PropertyPtr pProp = wUserProps(pWin);
while (pProp)
{
PropertyPtr pProp;
int rc = BadMatch;
client->errorValue = propertyName;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
if (pProp->propertyName == propertyName)
break;
pProp = pProp->next;
}
return pProp;
if (pProp)
rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
*result = pProp;
return rc;
}
static void
@ -125,65 +129,69 @@ ProcRotateProperties(ClientPtr client)
WindowPtr pWin;
Atom * atoms;
PropertyPtr * props; /* array of pointer */
PropertyPtr pProp;
PropertyPtr pProp, saved;
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
if (rc != Success)
if (rc != Success || stuff->nAtoms <= 0)
return rc;
if (!stuff->nAtoms)
return(Success);
atoms = (Atom *) & stuff[1];
props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr));
if (!props)
return(BadAlloc);
saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec));
if (!props || !saved) {
rc = BadAlloc;
goto out;
}
for (i = 0; i < stuff->nAtoms; i++)
{
if (!ValidAtom(atoms[i])) {
xfree(props);
rc = BadAtom;
client->errorValue = atoms[i];
return BadAtom;
goto out;
}
for (j = i + 1; j < stuff->nAtoms; j++)
if (atoms[j] == atoms[i])
{
xfree(props);
return BadMatch;
rc = BadMatch;
goto out;
}
pProp = FindProperty(pWin, atoms[i]);
if (!pProp) {
xfree(props);
return BadMatch;
}
rc = XaceHookPropertyAccess(client, pWin, pProp,
DixReadAccess|DixWriteAccess);
if (rc != Success) {
xfree(props);
client->errorValue = atoms[i];
return rc;
}
rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
DixReadAccess|DixWriteAccess);
if (rc != Success)
goto out;
props[i] = pProp;
saved[i] = *pProp;
}
delta = stuff->nPositions;
/* If the rotation is a complete 360 degrees, then moving the properties
around and generating PropertyNotify events should be skipped. */
if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 )
if (abs(delta) % stuff->nAtoms)
{
while (delta < 0) /* faster if abs value is small */
delta += stuff->nAtoms;
for (i = 0; i < stuff->nAtoms; i++)
{
deliverPropertyNotifyEvent(pWin, PropertyNewValue,
props[i]->propertyName);
props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
j = (i + delta) % stuff->nAtoms;
deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
/* Preserve name and devPrivates */
props[j]->type = saved[i].type;
props[j]->format = saved[i].format;
props[j]->size = saved[i].size;
props[j]->data = saved[i].data;
}
}
out:
xfree(saved);
xfree(props);
return Success;
return rc;
}
int
@ -248,14 +256,16 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
PropertyPtr pProp;
int sizeInBytes, totalSize, rc;
pointer data;
Mask access_mode;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess;
/* first see if property already exists */
pProp = FindProperty(pWin, property);
rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode);
if (!pProp) /* just add to list */
if (rc == BadMatch) /* just add to list */
{
if (!pWin->optional && !MakeWindowOptional (pWin))
return(BadAlloc);
@ -276,7 +286,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
memmove((char *)data, (char *)value, totalSize);
pProp->size = len;
pProp->devPrivates = NULL;
rc = XaceHookPropertyAccess(pClient, pWin, pProp,
rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
DixCreateAccess|DixWriteAccess);
if (rc != Success) {
xfree(data);
@ -287,13 +297,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
}
else
else if (rc == Success)
{
rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess);
if (rc != Success) {
pClient->errorValue = property;
return rc;
}
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
@ -347,6 +352,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
pProp->size += len;
}
}
else
return rc;
if (sendevent)
deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
@ -369,37 +376,29 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
PropertyPtr pProp, prevProp;
int rc;
if (!(pProp = wUserProps (pWin)))
return(Success);
prevProp = (PropertyPtr)NULL;
while (pProp)
{
if (pProp->propertyName == propName)
break;
prevProp = pProp;
pProp = pProp->next;
}
if (pProp)
{
rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess);
if (rc != Success)
return rc;
rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess);
if (rc == BadMatch)
return Success; /* Succeed if property does not exist */
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (rc == Success) {
if (pWin->optional->userProps == pProp) {
/* Takes care of head */
if (!(pWin->optional->userProps = pProp->next))
CheckWindowOptionalNeed (pWin);
}
else
{
prevProp->next = pProp->next;
}
} else {
/* Need to traverse to find the previous element */
prevProp = pWin->optional->userProps;
while (prevProp->next != pProp)
prevProp = prevProp->next;
prevProp->next = pProp->next;
}
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
dixFreePrivates(pProp->devPrivates);
xfree(pProp->data);
xfree(pProp);
}
return(Success);
return rc;
}
void
@ -453,15 +452,16 @@ ProcGetProperty(ClientPtr client)
int rc;
WindowPtr pWin;
xGetPropertyReply reply;
Mask access_mode = DixGetPropAccess;
Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess;
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete) {
UpdateCurrentTime();
access_mode |= DixSetPropAccess;
win_mode |= DixSetPropAccess;
prop_mode |= DixDestroyAccess;
}
rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
rc = dixLookupWindow(&pWin, stuff->window, client, win_mode);
if (rc != Success)
return rc;
@ -481,30 +481,14 @@ ProcGetProperty(ClientPtr client)
return(BadAtom);
}
pProp = wUserProps (pWin);
prevProp = (PropertyPtr)NULL;
while (pProp)
{
if (pProp->propertyName == stuff->property)
break;
prevProp = pProp;
pProp = pProp->next;
}
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (!pProp)
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
if (rc == BadMatch)
return NullPropertyReply(client, None, 0, &reply);
access_mode = DixReadAccess;
if (stuff->delete)
access_mode |= DixDestroyAccess;
rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode);
if (rc != Success) {
client->errorValue = stuff->property;
else if (rc != Success)
return rc;
}
/* If the request type and actual type don't match. Return the
property information, but not the data. */
@ -560,15 +544,20 @@ ProcGetProperty(ClientPtr client)
(char *)pProp->data + ind);
}
if (stuff->delete && (reply.bytesAfter == 0))
{ /* delete the Property */
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (!(pWin->optional->userProps = pProp->next))
if (stuff->delete && (reply.bytesAfter == 0)) {
/* Delete the Property */
if (pWin->optional->userProps == pProp) {
/* Takes care of head */
if (!(pWin->optional->userProps = pProp->next))
CheckWindowOptionalNeed (pWin);
}
else
} else {
/* Need to traverse to find the previous element */
prevProp = pWin->optional->userProps;
while (prevProp->next != pProp)
prevProp = prevProp->next;
prevProp->next = pProp->next;
}
dixFreePrivates(pProp->devPrivates);
xfree(pProp->data);
xfree(pProp);
@ -583,7 +572,7 @@ ProcListProperties(ClientPtr client)
xListPropertiesReply xlpr;
int rc, numProps = 0;
WindowPtr pWin;
PropertyPtr pProp;
PropertyPtr pProp, realProp;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@ -591,34 +580,34 @@ ProcListProperties(ClientPtr client)
if (rc != Success)
return rc;
pProp = wUserProps (pWin);
while (pProp)
{
pProp = pProp->next;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
numProps++;
if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
return BadAlloc;
numProps = 0;
temppAtoms = pAtoms;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
realProp = pProp;
rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
if (rc == Success && realProp == pProp) {
*temppAtoms++ = pProp->propertyName;
numProps++;
}
}
if (numProps)
if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
return(BadAlloc);
xlpr.type = X_Reply;
xlpr.nProperties = numProps;
xlpr.length = (numProps * sizeof(Atom)) >> 2;
xlpr.sequenceNumber = client->sequence;
pProp = wUserProps (pWin);
temppAtoms = pAtoms;
while (pProp)
{
*temppAtoms++ = pProp->propertyName;
pProp = pProp->next;
}
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
if (numProps)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
xfree(pAtoms);
}
xfree(pAtoms);
return(client->noClientException);
}

311
dix/selection.c Normal file
View file

@ -0,0 +1,311 @@
/************************************************************
Copyright 1987, 1989, 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, 1989 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.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h"
#include "dixstruct.h"
#include "dispatch.h"
#include "selection.h"
#include "xace.h"
/*****************************************************************
* Selection Stuff
*
* dixLookupSelection
*
* Selections are global to the server. The list of selections should
* not be traversed directly. Instead, use the functions listed above.
*
*****************************************************************/
_X_EXPORT Selection *CurrentSelections;
CallbackListPtr SelectionCallback;
_X_EXPORT int
dixLookupSelection(Selection **result, Atom selectionName,
ClientPtr client, Mask access_mode)
{
Selection *pSel;
int rc = BadMatch;
client->errorValue = selectionName;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
if (pSel->selection == selectionName)
break;
if (pSel)
rc = XaceHookSelectionAccess(client, &pSel, access_mode);
*result = pSel;
return rc;
}
void
InitSelections(void)
{
Selection *pSel, *pNextSel;
pSel = CurrentSelections;
while (pSel) {
pNextSel = pSel->next;
dixFreePrivates(pSel->devPrivates);
xfree(pSel);
pSel = pNextSel;
}
CurrentSelections = NULL;
}
static _X_INLINE void
CallSelectionCallback(Selection *pSel, ClientPtr client,
SelectionCallbackKind kind)
{
SelectionInfoRec info = { pSel, client, kind };
CallCallbacks(&SelectionCallback, &info);
}
void
DeleteWindowFromAnySelections(WindowPtr pWin)
{
Selection *pSel;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
if (pSel->pWin == pWin) {
CallSelectionCallback(pSel, NULL, SelectionWindowDestroy);
pSel->pWin = (WindowPtr)NULL;
pSel->window = None;
pSel->client = NullClient;
}
}
void
DeleteClientFromAnySelections(ClientPtr client)
{
Selection *pSel;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
if (pSel->client == client) {
CallSelectionCallback(pSel, NULL, SelectionClientClose);
pSel->pWin = (WindowPtr)NULL;
pSel->window = None;
pSel->client = NullClient;
}
}
int
ProcSetSelectionOwner(ClientPtr client)
{
WindowPtr pWin = NULL;
TimeStamp time;
Selection *pSel;
int rc;
REQUEST(xSetSelectionOwnerReq);
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
UpdateCurrentTime();
time = ClientTimeToServerTime(stuff->time);
/* If the client's time stamp is in the future relative to the server's
time stamp, do not set the selection, just return success. */
if (CompareTimeStamps(time, currentTime) == LATER)
return Success;
if (stuff->window != None) {
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
if (rc != Success)
return rc;
}
if (!ValidAtom(stuff->selection)) {
client->errorValue = stuff->selection;
return BadAtom;
}
/*
* First, see if the selection is already set...
*/
rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess);
if (rc == Success) {
xEvent event;
/* If the timestamp in client's request is in the past relative
to the time stamp indicating the last time the owner of the
selection was set, do not set the selection, just return
success. */
if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER)
return Success;
if (pSel->client && (!pWin || (pSel->client != client)))
{
event.u.u.type = SelectionClear;
event.u.selectionClear.time = time.milliseconds;
event.u.selectionClear.window = pSel->window;
event.u.selectionClear.atom = pSel->selection;
TryClientEvents(pSel->client, &event, 1, NoEventMask,
NoEventMask /* CantBeFiltered */, NullGrab);
}
}
else if (rc == BadMatch)
{
/*
* It doesn't exist, so add it...
*/
pSel = xalloc(sizeof(Selection));
if (!pSel)
return BadAlloc;
pSel->selection = stuff->selection;
pSel->devPrivates = NULL;
/* security creation/labeling check */
rc = XaceHookSelectionAccess(client, &pSel,
DixCreateAccess|DixSetAttrAccess);
if (rc != Success) {
xfree(pSel);
return rc;
}
pSel->next = CurrentSelections;
CurrentSelections = pSel;
}
else
return rc;
pSel->lastTimeChanged = time;
pSel->window = stuff->window;
pSel->pWin = pWin;
pSel->client = (pWin ? client : NullClient);
CallSelectionCallback(pSel, client, SelectionSetOwner);
return client->noClientException;
}
int
ProcGetSelectionOwner(ClientPtr client)
{
int rc;
Selection *pSel;
xGetSelectionOwnerReply reply;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
if (!ValidAtom(stuff->id)) {
client->errorValue = stuff->id;
return BadAtom;
}
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
if (rc == Success)
reply.owner = pSel->window;
else if (rc == BadMatch)
reply.owner = None;
else
return rc;
WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
return client->noClientException;
}
int
ProcConvertSelection(ClientPtr client)
{
Bool paramsOkay;
xEvent event;
WindowPtr pWin;
Selection *pSel;
int rc;
REQUEST(xConvertSelectionReq);
REQUEST_SIZE_MATCH(xConvertSelectionReq);
rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
if (rc != Success)
return rc;
paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target);
paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property);
if (!paramsOkay) {
client->errorValue = stuff->property;
return BadAtom;
}
rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess);
if (rc != Success && rc != BadMatch)
return rc;
else if (rc == Success && pSel->window != None) {
event.u.u.type = SelectionRequest;
event.u.selectionRequest.owner = pSel->window;
event.u.selectionRequest.time = stuff->time;
event.u.selectionRequest.requestor = stuff->requestor;
event.u.selectionRequest.selection = stuff->selection;
event.u.selectionRequest.target = stuff->target;
event.u.selectionRequest.property = stuff->property;
if (TryClientEvents(pSel->client, &event, 1, NoEventMask,
NoEventMask /* CantBeFiltered */, NullGrab))
return client->noClientException;
}
event.u.u.type = SelectionNotify;
event.u.selectionNotify.time = stuff->time;
event.u.selectionNotify.requestor = stuff->requestor;
event.u.selectionNotify.selection = stuff->selection;
event.u.selectionNotify.target = stuff->target;
event.u.selectionNotify.property = None;
TryClientEvents(client, &event, 1, NoEventMask,
NoEventMask /* CantBeFiltered */, NullGrab);
return client->noClientException;
}

View file

@ -293,6 +293,9 @@ SetWindowToDefaults(WindowPtr pWin)
pWin->forcedBS = FALSE;
pWin->redirectDraw = RedirectDrawNone;
pWin->forcedBG = FALSE;
#ifdef ROOTLESS
pWin->rootlessUnhittable = FALSE;
#endif
}
static void

Some files were not shown because too many files have changed in this diff Show more