Commit 809fed64 authored by Mike Gabriel's avatar Mike Gabriel

hw/nxagent/NXmiexpose.c: Shrink file, drop duplicate code that can identically…

hw/nxagent/NXmiexpose.c: Shrink file, drop duplicate code that can identically be found in mi/miexpose.c.
parent 69ac9816
...@@ -93,48 +93,9 @@ Equipment Corporation. ...@@ -93,48 +93,9 @@ Equipment Corporation.
/* $Xorg: miexpose.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */ /* $Xorg: miexpose.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <nx-X11/X.h>
#define NEED_EVENTS
#include <nx-X11/Xproto.h>
#include <nx-X11/Xprotostr.h>
#include "misc.h"
#include "regionstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmap.h"
#include "input.h"
#include "dixstruct.h"
#include "mi.h"
#include <nx-X11/Xmd.h>
#include "globals.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
/*
machine-independent graphics exposure code. any device that uses
the region package can call this.
*/
#ifdef NXAGENT_SERVER
#include "Windows.h" #include "Windows.h"
#endif #include "../../mi/miexpose.c"
#ifndef RECTLIMIT
#define RECTLIMIT 25 /* pick a number, any number > 8 */
#endif
/* miHandleExposures /* miHandleExposures
generate a region for exposures for areas that were copied from obscured or generate a region for exposures for areas that were copied from obscured or
...@@ -181,8 +142,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, ...@@ -181,8 +142,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
BoxRec expBox; BoxRec expBox;
Bool extents; Bool extents;
#ifdef NXAGENT_SERVER
/* /*
* Set the elements reported by the compiler * Set the elements reported by the compiler
* as uninitialized. * as uninitialized.
...@@ -193,8 +152,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, ...@@ -193,8 +152,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
expBox.x2 = 0; expBox.x2 = 0;
expBox.y2 = 0; expBox.y2 = 0;
#endif
/* This prevents warning about pscr not being used. */ /* This prevents warning about pscr not being used. */
pGC->pScreen = pscr = pGC->pScreen; pGC->pScreen = pscr = pGC->pScreen;
...@@ -414,133 +371,14 @@ miHandleExposures(pSrcDrawable, pDstDrawable, ...@@ -414,133 +371,14 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
} }
} }
/* send GraphicsExpose events, or a NoExpose event, based on the region */
void
miSendGraphicsExpose (client, pRgn, drawable, major, minor)
ClientPtr client;
RegionPtr pRgn;
XID drawable;
int major;
int minor;
{
if (pRgn && !RegionNil(pRgn))
{
xEvent *pEvent;
register xEvent *pe;
register BoxPtr pBox;
register int i;
int numRects;
numRects = RegionNumRects(pRgn);
pBox = RegionRects(pRgn);
if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
return;
pe = pEvent;
for (i=1; i<=numRects; i++, pe++, pBox++)
{
pe->u.u.type = GraphicsExpose;
pe->u.graphicsExposure.drawable = drawable;
pe->u.graphicsExposure.x = pBox->x1;
pe->u.graphicsExposure.y = pBox->y1;
pe->u.graphicsExposure.width = pBox->x2 - pBox->x1;
pe->u.graphicsExposure.height = pBox->y2 - pBox->y1;
pe->u.graphicsExposure.count = numRects - i;
pe->u.graphicsExposure.majorEvent = major;
pe->u.graphicsExposure.minorEvent = minor;
}
TryClientEvents(client, pEvent, numRects,
(Mask)0, NoEventMask, NullGrab);
DEALLOCATE_LOCAL(pEvent);
}
else
{
xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = NoExpose;
event.u.noExposure.drawable = drawable;
event.u.noExposure.majorEvent = major;
event.u.noExposure.minorEvent = minor;
TryClientEvents(client, &event, 1,
(Mask)0, NoEventMask, NullGrab);
}
}
void
miSendExposures(pWin, pRgn, dx, dy)
WindowPtr pWin;
RegionPtr pRgn;
register int dx, dy;
{
register BoxPtr pBox;
int numRects;
register xEvent *pEvent, *pe;
register int i;
pBox = RegionRects(pRgn);
numRects = RegionNumRects(pRgn);
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
return;
memset(pEvent, 0, numRects * sizeof(xEvent));
for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
{
pe->u.u.type = Expose;
pe->u.expose.window = pWin->drawable.id;
pe->u.expose.x = pBox->x1 - dx;
pe->u.expose.y = pBox->y1 - dy;
pe->u.expose.width = pBox->x2 - pBox->x1;
pe->u.expose.height = pBox->y2 - pBox->y1;
pe->u.expose.count = i;
}
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
int scrnum = pWin->drawable.pScreen->myNum;
int x = 0, y = 0;
XID realWin = 0;
if(!pWin->parent) {
x = panoramiXdataPtr[scrnum].x;
y = panoramiXdataPtr[scrnum].y;
pWin = screenInfo.screens[0]->root;
realWin = pWin->drawable.id;
} else if (scrnum) {
PanoramiXRes *win;
win = PanoramiXFindIDByScrnum(XRT_WINDOW,
pWin->drawable.id, scrnum);
if(!win) {
DEALLOCATE_LOCAL(pEvent);
return;
}
realWin = win->info[0].id;
pWin = LookupIDByType(realWin, RT_WINDOW);
}
if(x || y || scrnum)
for (i = 0; i < numRects; i++) {
pEvent[i].u.expose.window = realWin;
pEvent[i].u.expose.x += x;
pEvent[i].u.expose.y += y;
}
}
#endif
DeliverEvents(pWin, pEvent, numRects, NullWindow);
DEALLOCATE_LOCAL(pEvent);
}
void void
miWindowExposures(pWin, prgn, other_exposed) miWindowExposures(pWin, prgn, other_exposed)
WindowPtr pWin; WindowPtr pWin;
register RegionPtr prgn, other_exposed; register RegionPtr prgn, other_exposed;
{ {
#ifdef NXAGENT_SERVER
int total; int total;
#endif
RegionPtr exposures = prgn; RegionPtr exposures = prgn;
if (pWin->backStorage && prgn) if (pWin->backStorage && prgn)
/* /*
...@@ -576,7 +414,6 @@ miWindowExposures(pWin, prgn, other_exposed) ...@@ -576,7 +414,6 @@ miWindowExposures(pWin, prgn, other_exposed)
} }
exposures = other_exposed; exposures = other_exposed;
} }
#ifdef NXAGENT_SERVER
/* /*
* If the number of rectangles is greater * If the number of rectangles is greater
...@@ -587,9 +424,6 @@ miWindowExposures(pWin, prgn, other_exposed) ...@@ -587,9 +424,6 @@ miWindowExposures(pWin, prgn, other_exposed)
if (clientInterested && exposures && (total > RECTLIMIT || if (clientInterested && exposures && (total > RECTLIMIT ||
(total > 4 && nxagentExtentsPredicate(total) == 1))) (total > 4 && nxagentExtentsPredicate(total) == 1)))
#else
if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT))
#endif
{ {
/* /*
* If we have LOTS of rectangles, we decide to take the extents * If we have LOTS of rectangles, we decide to take the extents
...@@ -638,54 +472,6 @@ miWindowExposures(pWin, prgn, other_exposed) ...@@ -638,54 +472,6 @@ miWindowExposures(pWin, prgn, other_exposed)
RegionDestroy(exposures); RegionDestroy(exposures);
} }
/*
this code is highly unlikely. it is not haile selassie.
there is some hair here. we can't just use the window's
clip region as it is, because if we are painting the border,
the border is not in the client area and so we will be excluded
when we validate the GC, and if we are painting a parent-relative
background, the area we want to paint is in some other window.
since we trust the code calling us to tell us to paint only areas
that are really ours, we will temporarily give the window a
clipList the size of the whole screen and an origin at (0,0).
this more or less assumes that ddX code will do translation
based on the window's absolute position, and that ValidateGC will
look at clipList, and that no other fields from the
window will be used. it's not possible to just draw
in the root because it may be a different depth.
to get the tile to align correctly we set the GC's tile origin to
be the (x,y) of the window's upper left corner, after which we
get the right bits when drawing into the root.
because the clip_mask is being set to None, we may call DoChangeGC with
fPointer set true, thus we no longer need to install the background or
border tile in the resource table.
*/
static RESTYPE ResType = 0;
static int numGCs = 0;
static GCPtr screenContext[MAXSCREENS];
/*ARGSUSED*/
static int
tossGC (
void * value,
XID id)
{
GCPtr pGC = (GCPtr)value;
screenContext[pGC->pScreen->myNum] = (GCPtr)NULL;
FreeGC (pGC, id);
numGCs--;
if (!numGCs)
ResType = 0;
return 0;
}
void void
miPaintWindow(pWin, prgn, what) miPaintWindow(pWin, prgn, what)
register WindowPtr pWin; register WindowPtr pWin;
...@@ -722,8 +508,6 @@ int what; ...@@ -722,8 +508,6 @@ int what;
register xRectangle *prect; register xRectangle *prect;
int numRects; int numRects;
#ifdef NXAGENT_SERVER
/* /*
* Set the elements reported by the compiler * Set the elements reported by the compiler
* as uninitialized. * as uninitialized.
...@@ -739,8 +523,6 @@ int what; ...@@ -739,8 +523,6 @@ int what;
oldCorner.x = 0; oldCorner.x = 0;
oldCorner.y = 0; oldCorner.y = 0;
#endif
gcmask = 0; gcmask = 0;
if (what == PW_BACKGROUND) if (what == PW_BACKGROUND)
...@@ -954,27 +736,3 @@ int what; ...@@ -954,27 +736,3 @@ int what;
FreeScratchGC(pGC); FreeScratchGC(pGC);
} }
} }
/* MICLEARDRAWABLE -- sets the entire drawable to the background color of
* the GC. Useful when we have a scratch drawable and need to initialize
* it. */
void
miClearDrawable(pDraw, pGC)
DrawablePtr pDraw;
GCPtr pGC;
{
XID fg = pGC->fgPixel;
XID bg = pGC->bgPixel;
xRectangle rect;
rect.x = 0;
rect.y = 0;
rect.width = pDraw->width;
rect.height = pDraw->height;
DoChangeGC(pGC, GCForeground, &bg, 0);
ValidateGC(pDraw, pGC);
(*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);
DoChangeGC(pGC, GCForeground, &fg, 0);
ValidateGC(pDraw, pGC);
}
...@@ -38,6 +38,15 @@ MIINITEXTSRC = miinitext.c ...@@ -38,6 +38,15 @@ MIINITEXTSRC = miinitext.c
MIINITEXTOBJ = miinitext.o MIINITEXTOBJ = miinitext.o
#endif #endif
#if (!(defined(NXAgentServer) && NXAgentServer))
NXAGENT_SKIP_SRCS = \
miexpose.c \
$(NULL)
NXAGENT_SKIP_OBJS = \
miexpose.o \
$(NULL)
#endif
SRCS = $(CBRT_SRC) \ SRCS = $(CBRT_SRC) \
mivaltree.c \ mivaltree.c \
mipolyseg.c \ mipolyseg.c \
...@@ -58,7 +67,6 @@ SRCS = $(CBRT_SRC) \ ...@@ -58,7 +67,6 @@ SRCS = $(CBRT_SRC) \
mibitblt.c \ mibitblt.c \
mipolypnt.c \ mipolypnt.c \
mipushpxl.c \ mipushpxl.c \
miexpose.c \
miglblt.c \ miglblt.c \
mizerline.c \ mizerline.c \
mizerclip.c \ mizerclip.c \
...@@ -76,6 +84,7 @@ SRCS = $(CBRT_SRC) \ ...@@ -76,6 +84,7 @@ SRCS = $(CBRT_SRC) \
migc.c \ migc.c \
micmap.c \ micmap.c \
mioverlay.c \ mioverlay.c \
$(NXAGENT_SKIP_SRCS) \
$(NULL) $(NULL)
OBJS = $(CBRT_OBJ) \ OBJS = $(CBRT_OBJ) \
...@@ -98,7 +107,6 @@ OBJS = $(CBRT_OBJ) \ ...@@ -98,7 +107,6 @@ OBJS = $(CBRT_OBJ) \
mibitblt.o \ mibitblt.o \
mipolypnt.o \ mipolypnt.o \
mipushpxl.o \ mipushpxl.o \
miexpose.o \
miglblt.o \ miglblt.o \
mizerline.o \ mizerline.o \
mizerclip.o \ mizerclip.o \
...@@ -116,6 +124,7 @@ OBJS = $(CBRT_OBJ) \ ...@@ -116,6 +124,7 @@ OBJS = $(CBRT_OBJ) \
migc.o \ migc.o \
micmap.o \ micmap.o \
mioverlay.o \ mioverlay.o \
$(NXAGENT_SKIP_OBJS) \
$(NULL) $(NULL)
#if defined(XorgVersion) #if defined(XorgVersion)
......
...@@ -130,6 +130,7 @@ exposing is done by the backing store's GraphicsExpose function, of course. ...@@ -130,6 +130,7 @@ exposing is done by the backing store's GraphicsExpose function, of course.
*/ */
#ifndef NXAGENT_SERVER
RegionPtr RegionPtr
miHandleExposures(pSrcDrawable, pDstDrawable, miHandleExposures(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, plane) pGC, srcx, srcy, width, height, dstx, dsty, plane)
...@@ -376,6 +377,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable, ...@@ -376,6 +377,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
return NULL; return NULL;
} }
} }
#endif
/* send GraphicsExpose events, or a NoExpose event, based on the region */ /* send GraphicsExpose events, or a NoExpose event, based on the region */
...@@ -495,6 +497,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -495,6 +497,7 @@ miSendExposures(pWin, pRgn, dx, dy)
DEALLOCATE_LOCAL(pEvent); DEALLOCATE_LOCAL(pEvent);
} }
#ifndef NXAGENT_SERVER
void void
miWindowExposures(pWin, prgn, other_exposed) miWindowExposures(pWin, prgn, other_exposed)
WindowPtr pWin; WindowPtr pWin;
...@@ -583,7 +586,7 @@ miWindowExposures(pWin, prgn, other_exposed) ...@@ -583,7 +586,7 @@ miWindowExposures(pWin, prgn, other_exposed)
else if (exposures && exposures != prgn) else if (exposures && exposures != prgn)
RegionDestroy(exposures); RegionDestroy(exposures);
} }
#endif
/* /*
this code is highly unlikely. it is not haile selassie. this code is highly unlikely. it is not haile selassie.
...@@ -631,7 +634,7 @@ tossGC ( ...@@ -631,7 +634,7 @@ tossGC (
return 0; return 0;
} }
#ifndef NXAGENT_SERVER
void void
miPaintWindow(pWin, prgn, what) miPaintWindow(pWin, prgn, what)
register WindowPtr pWin; register WindowPtr pWin;
...@@ -654,7 +657,7 @@ int what; ...@@ -654,7 +657,7 @@ int what;
#define COUNT_BITS 8 #define COUNT_BITS 8
ChangeGCVal gcval[7]; ChangeGCVal gcval[7];
ChangeGCVal newValues [COUNT_BITS]; ChangeGCVal newValues [COUNT_BITS] = {{ 0 }};
BITS32 gcmask, index, mask; BITS32 gcmask, index, mask;
RegionRec prgnWin; RegionRec prgnWin;
...@@ -881,7 +884,7 @@ int what; ...@@ -881,7 +884,7 @@ int what;
FreeScratchGC(pGC); FreeScratchGC(pGC);
} }
} }
#endif
/* MICLEARDRAWABLE -- sets the entire drawable to the background color of /* MICLEARDRAWABLE -- sets the entire drawable to the background color of
* the GC. Useful when we have a scratch drawable and need to initialize * the GC. Useful when we have a scratch drawable and need to initialize
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment