Static and dead code cleanup over afb/
This commit is contained in:
parent
f36bf1a3e4
commit
70e493d223
124
afb/afb.h
124
afb/afb.h
|
@ -78,27 +78,6 @@ extern void afbDoBitblt(
|
||||||
unsigned long /*planemask*/
|
unsigned long /*planemask*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern RegionPtr afbBitBlt(
|
|
||||||
DrawablePtr /*pSrc*/,
|
|
||||||
DrawablePtr /*pDst*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*srcx*/,
|
|
||||||
int /*srcy*/,
|
|
||||||
int /*width*/,
|
|
||||||
int /*height*/,
|
|
||||||
int /*dstx*/,
|
|
||||||
int /*dsty*/,
|
|
||||||
void (*doBitBlt)(
|
|
||||||
DrawablePtr /*pSrc*/,
|
|
||||||
DrawablePtr /*pDst*/,
|
|
||||||
int /*alu*/,
|
|
||||||
RegionPtr /*prgnDst*/,
|
|
||||||
DDXPointPtr /*pptSrc*/,
|
|
||||||
unsigned long /*planemask*/
|
|
||||||
),
|
|
||||||
unsigned long /*planemask*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern RegionPtr afbCopyArea(
|
extern RegionPtr afbCopyArea(
|
||||||
DrawablePtr /*pSrcDrawable*/,
|
DrawablePtr /*pSrcDrawable*/,
|
||||||
DrawablePtr /*pDstDrawable*/,
|
DrawablePtr /*pDstDrawable*/,
|
||||||
|
@ -111,27 +90,6 @@ extern RegionPtr afbCopyArea(
|
||||||
int /*dsty*/
|
int /*dsty*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern RegionPtr afbCopyPlane(
|
|
||||||
DrawablePtr /*pSrcDrawable*/,
|
|
||||||
DrawablePtr /*pDstDrawable*/,
|
|
||||||
GCPtr/*pGC*/,
|
|
||||||
int /*srcx*/,
|
|
||||||
int /*srcy*/,
|
|
||||||
int /*width*/,
|
|
||||||
int /*height*/,
|
|
||||||
int /*dstx*/,
|
|
||||||
int /*dsty*/,
|
|
||||||
unsigned long /*plane*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbCopy1ToN(
|
|
||||||
DrawablePtr /*pSrc*/,
|
|
||||||
DrawablePtr /*pDst*/,
|
|
||||||
int /*alu*/,
|
|
||||||
RegionPtr /*prgnDst*/,
|
|
||||||
DDXPointPtr /*pptSrc*/,
|
|
||||||
unsigned long /*planemask*/
|
|
||||||
);
|
|
||||||
/* afbbltC.c */
|
/* afbbltC.c */
|
||||||
|
|
||||||
extern void afbDoBitbltCopy(
|
extern void afbDoBitbltCopy(
|
||||||
|
@ -273,23 +231,6 @@ extern Bool afbInitializeColormap(
|
||||||
ColormapPtr /*pmap*/
|
ColormapPtr /*pmap*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern int afbExpandDirectColors(
|
|
||||||
ColormapPtr /*pmap*/,
|
|
||||||
int /*ndefs*/,
|
|
||||||
xColorItem * /*indefs*/,
|
|
||||||
xColorItem * /*outdefs*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool afbCreateDefColormap(
|
|
||||||
ScreenPtr /*pScreen*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool afbSetVisualTypes(
|
|
||||||
int /*depth*/,
|
|
||||||
int /*visuals*/,
|
|
||||||
int /*bitsPerRGB*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool afbInitVisuals(
|
extern Bool afbInitVisuals(
|
||||||
VisualPtr * /*visualp*/,
|
VisualPtr * /*visualp*/,
|
||||||
DepthPtr * /*depthp*/,
|
DepthPtr * /*depthp*/,
|
||||||
|
@ -410,16 +351,6 @@ extern Bool afbCreateGC(
|
||||||
GCPtr /*pGC*/
|
GCPtr /*pGC*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern void afbValidateGC(
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
unsigned long /*changes*/,
|
|
||||||
DrawablePtr /*pDrawable*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbDestroyGC(
|
|
||||||
GCPtr /*pGC*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbReduceRop(
|
extern void afbReduceRop(
|
||||||
int /*alu*/,
|
int /*alu*/,
|
||||||
Pixel /*src*/,
|
Pixel /*src*/,
|
||||||
|
@ -428,19 +359,6 @@ extern void afbReduceRop(
|
||||||
unsigned char * /*rrops*/
|
unsigned char * /*rrops*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern void afbReduceOpaqueStipple (
|
|
||||||
Pixel /*fg*/,
|
|
||||||
Pixel /*bg*/,
|
|
||||||
unsigned long /*planemask*/,
|
|
||||||
int /*depth*/,
|
|
||||||
unsigned char * /*rrops*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbComputeCompositeClip(
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
DrawablePtr /*pDrawable*/
|
|
||||||
);
|
|
||||||
|
|
||||||
/* afbgetsp.c */
|
/* afbgetsp.c */
|
||||||
|
|
||||||
extern void afbGetSpans(
|
extern void afbGetSpans(
|
||||||
|
@ -588,14 +506,6 @@ extern Bool afbDestroyPixmap(
|
||||||
PixmapPtr /*pPixmap*/
|
PixmapPtr /*pPixmap*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern PixmapPtr afbCopyPixmap(
|
|
||||||
PixmapPtr /*pSrc*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbPadPixmap(
|
|
||||||
PixmapPtr /*pPixmap*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbXRotatePixmap(
|
extern void afbXRotatePixmap(
|
||||||
PixmapPtr /*pPix*/,
|
PixmapPtr /*pPix*/,
|
||||||
int /*rw*/
|
int /*rw*/
|
||||||
|
@ -637,20 +547,9 @@ extern void afbPushPixels(
|
||||||
int /*xOrg*/,
|
int /*xOrg*/,
|
||||||
int /*yOrg*/
|
int /*yOrg*/
|
||||||
);
|
);
|
||||||
/* afbscrclse.c */
|
|
||||||
|
|
||||||
extern Bool afbCloseScreen(
|
|
||||||
int /*index*/,
|
|
||||||
ScreenPtr /*pScreen*/
|
|
||||||
);
|
|
||||||
/* afbscrinit.c */
|
/* afbscrinit.c */
|
||||||
|
|
||||||
extern Bool afbAllocatePrivates(
|
|
||||||
ScreenPtr /*pScreen*/,
|
|
||||||
int * /*pWinIndex*/,
|
|
||||||
int * /*pGCIndex*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool afbScreenInit(
|
extern Bool afbScreenInit(
|
||||||
ScreenPtr /*pScreen*/,
|
ScreenPtr /*pScreen*/,
|
||||||
pointer /*pbits*/,
|
pointer /*pbits*/,
|
||||||
|
@ -661,15 +560,6 @@ extern Bool afbScreenInit(
|
||||||
int /*width*/
|
int /*width*/
|
||||||
);
|
);
|
||||||
|
|
||||||
extern PixmapPtr afbGetWindowPixmap(
|
|
||||||
WindowPtr /*pWin*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbSetWindowPixmap(
|
|
||||||
WindowPtr /*pWin*/,
|
|
||||||
PixmapPtr /*pPix*/
|
|
||||||
);
|
|
||||||
|
|
||||||
/* afbseg.c */
|
/* afbseg.c */
|
||||||
|
|
||||||
extern void afbSegmentSS(
|
extern void afbSegmentSS(
|
||||||
|
@ -687,20 +577,6 @@ extern void afbSegmentSD(
|
||||||
);
|
);
|
||||||
/* afbsetsp.c */
|
/* afbsetsp.c */
|
||||||
|
|
||||||
extern void afbSetScanline(
|
|
||||||
int /*y*/,
|
|
||||||
int /*xOrigin*/,
|
|
||||||
int /*xStart*/,
|
|
||||||
int /*xEnd*/,
|
|
||||||
PixelType * /*psrc*/,
|
|
||||||
int /*alu*/,
|
|
||||||
PixelType * /*pdstBase*/,
|
|
||||||
int /*widthDst*/,
|
|
||||||
int /*sizeDst*/,
|
|
||||||
int /*depthDst*/,
|
|
||||||
int /*sizeSrc*/
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void afbSetSpans(
|
extern void afbSetSpans(
|
||||||
DrawablePtr /*pDrawable*/,
|
DrawablePtr /*pDrawable*/,
|
||||||
GCPtr /*pGC*/,
|
GCPtr /*pGC*/,
|
||||||
|
|
148
afb/afbbitblt.c
148
afb/afbbitblt.c
|
@ -67,9 +67,6 @@ SOFTWARE.
|
||||||
#include "afb.h"
|
#include "afb.h"
|
||||||
#include "maskbits.h"
|
#include "maskbits.h"
|
||||||
|
|
||||||
|
|
||||||
static unsigned char afbRropsOS[AFB_MAX_DEPTH];
|
|
||||||
|
|
||||||
/* CopyArea and CopyPlane for a monchrome frame buffer
|
/* CopyArea and CopyPlane for a monchrome frame buffer
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,34 +123,7 @@ afbDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXP
|
||||||
typedef void (*afb_blit_func)
|
typedef void (*afb_blit_func)
|
||||||
(DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long);
|
(DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long);
|
||||||
|
|
||||||
RegionPtr
|
static RegionPtr
|
||||||
afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty)
|
|
||||||
{
|
|
||||||
afb_blit_func doBitBlt;
|
|
||||||
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXcopy:
|
|
||||||
doBitBlt = afbDoBitbltCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
doBitBlt = afbDoBitbltXor;
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
doBitBlt = afbDoBitbltCopyInverted;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
doBitBlt = afbDoBitbltOr;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
doBitBlt = afbDoBitbltGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
|
|
||||||
width, height, dstx, dsty, doBitBlt, pGC->planemask));
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, afb_blit_func doBitBlt, long unsigned int planemask)
|
afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, afb_blit_func doBitBlt, long unsigned int planemask)
|
||||||
{
|
{
|
||||||
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
|
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
|
||||||
|
@ -346,102 +316,28 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable,
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionPtr
|
RegionPtr
|
||||||
afbCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, long unsigned int plane)
|
afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty)
|
||||||
{
|
{
|
||||||
int alu;
|
afb_blit_func doBitBlt;
|
||||||
RegionPtr prgnExposed = NULL;
|
|
||||||
unsigned long old_planemask;
|
|
||||||
|
|
||||||
if (pDstDrawable->depth == 1) {
|
switch (pGC->alu) {
|
||||||
old_planemask = pGC->planemask;
|
case GXcopy:
|
||||||
pGC->planemask = plane;
|
doBitBlt = afbDoBitbltCopy;
|
||||||
if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) {
|
break;
|
||||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
|
case GXxor:
|
||||||
pGC, srcx, srcy, width, height, dstx, dsty);
|
doBitBlt = afbDoBitbltXor;
|
||||||
} else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) {
|
break;
|
||||||
unsigned char rop;
|
case GXcopyInverted:
|
||||||
|
doBitBlt = afbDoBitbltCopyInverted;
|
||||||
afbReduceRop(pGC->alu, pGC->fgPixel, 1, 1, &rop);
|
break;
|
||||||
alu = pGC->alu;
|
case GXor:
|
||||||
pGC->alu = rop;
|
doBitBlt = afbDoBitbltOr;
|
||||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
|
break;
|
||||||
srcx, srcy, width, height, dstx,
|
default:
|
||||||
dsty);
|
doBitBlt = afbDoBitbltGeneral;
|
||||||
pGC->alu = alu;
|
break;
|
||||||
} else { /* need to invert the src */
|
|
||||||
alu = pGC->alu;
|
|
||||||
pGC->alu = afbInverseAlu[alu];
|
|
||||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
|
|
||||||
srcx, srcy, width, height, dstx,
|
|
||||||
dsty);
|
|
||||||
pGC->alu = alu;
|
|
||||||
}
|
|
||||||
pGC->planemask = old_planemask;
|
|
||||||
} else {
|
|
||||||
int free_pixmap = FALSE;
|
|
||||||
PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable;
|
|
||||||
ScreenPtr pScreen = pSrcDrawable->pScreen;
|
|
||||||
GCPtr pGC1 = NULL;
|
|
||||||
|
|
||||||
if (pSrcDrawable == pDstDrawable ||
|
|
||||||
pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) {
|
|
||||||
/* Copy a plane from source drawable to a tmp 1-bit deep pixmap */
|
|
||||||
/* XXX: Range check width and height */
|
|
||||||
pBitmap = (*pScreen->CreatePixmap)(pScreen, width, height, 1);
|
|
||||||
|
|
||||||
if (!pBitmap)
|
|
||||||
return(NULL);
|
|
||||||
pGC1 = GetScratchGC(1, pScreen);
|
|
||||||
if (!pGC1) {
|
|
||||||
(*pScreen->DestroyPixmap)(pBitmap);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
ValidateGC((DrawablePtr)pBitmap, pGC1);
|
|
||||||
(void)afbBitBlt(pSrcDrawable, (DrawablePtr)pBitmap, pGC1, srcx, srcy,
|
|
||||||
width, height, 0, 0, afbDoBitbltCopy, plane);
|
|
||||||
free_pixmap = TRUE;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
else {
|
|
||||||
/* XXX: could cope with N-deep pixmap source case without using tmp
|
|
||||||
* src bitmap by setting up a scratch pixmap header and fiddle
|
|
||||||
* around with the pbits pointer.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
|
||||||
pGC->depth, afbRropsOS);
|
|
||||||
(void)afbBitBlt((DrawablePtr)pBitmap, pDstDrawable, pGC, 0, 0, width,
|
|
||||||
height, dstx, dsty, afbCopy1ToN, pGC->planemask);
|
|
||||||
if (free_pixmap) {
|
|
||||||
(*pScreen->DestroyPixmap)(pBitmap);
|
|
||||||
FreeScratchGC(pGC1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pGC->fExpose)
|
|
||||||
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx,
|
|
||||||
srcy, width, height, dstx, dsty,
|
|
||||||
plane);
|
|
||||||
}
|
|
||||||
return prgnExposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
afbCopy1ToN(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, long unsigned int planemask)
|
|
||||||
{
|
|
||||||
int numRects = REGION_NUM_RECTS(prgnDst);
|
|
||||||
BoxPtr pbox = REGION_RECTS(prgnDst);
|
|
||||||
int r;
|
|
||||||
|
|
||||||
for (r = 0; r < numRects; r++, pbox++, pptSrc++) {
|
|
||||||
int dx = pptSrc->x;
|
|
||||||
int dy = pptSrc->y;
|
|
||||||
|
|
||||||
if (alu == GXcopy)
|
|
||||||
afbOpaqueStippleAreaCopy(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, dy,
|
|
||||||
afbRropsOS, planemask);
|
|
||||||
else
|
|
||||||
afbOpaqueStippleAreaGeneral(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx,
|
|
||||||
dy, afbRropsOS, planemask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
|
||||||
|
width, height, dstx, dsty, doBitBlt, pGC->planemask));
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,24 +70,6 @@ afbInitializeColormap(register ColormapPtr pmap)
|
||||||
return miInitializeColormap(pmap);
|
return miInitializeColormap(pmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
afbExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs)
|
|
||||||
{
|
|
||||||
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
afbCreateDefColormap(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
return miCreateDefColormap(pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
afbSetVisualTypes(int depth, int visuals, int bitsPerRGB)
|
|
||||||
{
|
|
||||||
return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given a list of formats for a screen, create a list
|
* Given a list of formats for a screen, create a list
|
||||||
* of visuals and depths for the screen which correspond to
|
* of visuals and depths for the screen which correspond to
|
||||||
|
|
266
afb/afbgc.c
266
afb/afbgc.c
|
@ -69,6 +69,9 @@ SOFTWARE.
|
||||||
|
|
||||||
#include "maskbits.h"
|
#include "maskbits.h"
|
||||||
|
|
||||||
|
static void afbDestroyGC(GCPtr);
|
||||||
|
static void afbValidateGC(GCPtr, unsigned long, DrawablePtr);
|
||||||
|
|
||||||
static GCFuncs afbFuncs = {
|
static GCFuncs afbFuncs = {
|
||||||
afbValidateGC,
|
afbValidateGC,
|
||||||
miChangeGC,
|
miChangeGC,
|
||||||
|
@ -102,6 +105,33 @@ static GCOps afbGCOps = {
|
||||||
afbPushPixels
|
afbPushPixels
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
afbReduceOpaqueStipple(PixelType fg, PixelType bg, unsigned long planemask,
|
||||||
|
int depth, unsigned char *rop)
|
||||||
|
{
|
||||||
|
register int d;
|
||||||
|
register Pixel mask = 1;
|
||||||
|
|
||||||
|
bg ^= fg;
|
||||||
|
|
||||||
|
for (d = 0; d < depth; d++, mask <<= 1) {
|
||||||
|
if (!(planemask & mask))
|
||||||
|
rop[d] = RROP_NOP;
|
||||||
|
else if (!(bg & mask)) {
|
||||||
|
/* Both fg and bg have a 0 or 1 in this plane */
|
||||||
|
if (fg & mask)
|
||||||
|
rop[d] = RROP_WHITE;
|
||||||
|
else
|
||||||
|
rop[d] = RROP_BLACK;
|
||||||
|
} else {
|
||||||
|
/* Both fg and bg have different bits on this plane */
|
||||||
|
if (fg & mask)
|
||||||
|
rop[d] = RROP_COPY;
|
||||||
|
else
|
||||||
|
rop[d] = RROP_INVERT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
afbCreateGC(pGC)
|
afbCreateGC(pGC)
|
||||||
|
@ -136,6 +166,95 @@ afbCreateGC(pGC)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
afbComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable)
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||||
|
WindowPtr pWin = (WindowPtr) pDrawable;
|
||||||
|
RegionPtr pregWin;
|
||||||
|
Bool freeTmpClip, freeCompClip;
|
||||||
|
|
||||||
|
if (pGC->subWindowMode == IncludeInferiors) {
|
||||||
|
pregWin = NotClippedByChildren(pWin);
|
||||||
|
freeTmpClip = TRUE;
|
||||||
|
} else {
|
||||||
|
pregWin = &pWin->clipList;
|
||||||
|
freeTmpClip = FALSE;
|
||||||
|
}
|
||||||
|
freeCompClip = pGC->freeCompClip;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if there is no client clip, we can get by with just keeping the
|
||||||
|
* pointer we got, and remembering whether or not should destroy (or
|
||||||
|
* maybe re-use) it later. this way, we avoid unnecessary copying of
|
||||||
|
* regions. (this wins especially if many clients clip by children
|
||||||
|
* and have no client clip.)
|
||||||
|
*/
|
||||||
|
if (pGC->clientClipType == CT_NONE) {
|
||||||
|
if (freeCompClip)
|
||||||
|
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
||||||
|
pGC->pCompositeClip = pregWin;
|
||||||
|
pGC->freeCompClip = freeTmpClip;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* we need one 'real' region to put into the composite clip. if
|
||||||
|
* pregWin the current composite clip are real, we can get rid of
|
||||||
|
* one. if pregWin is real and the current composite clip isn't,
|
||||||
|
* use pregWin for the composite clip. if the current composite
|
||||||
|
* clip is real and pregWin isn't, use the current composite
|
||||||
|
* clip. if neither is real, create a new region.
|
||||||
|
*/
|
||||||
|
|
||||||
|
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
||||||
|
pDrawable->x + pGC->clipOrg.x,
|
||||||
|
pDrawable->y + pGC->clipOrg.y);
|
||||||
|
|
||||||
|
if (freeCompClip) {
|
||||||
|
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
|
||||||
|
pGC->clientClip);
|
||||||
|
if (freeTmpClip)
|
||||||
|
REGION_DESTROY(pGC->pScreen, pregWin);
|
||||||
|
} else if (freeTmpClip) {
|
||||||
|
REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip);
|
||||||
|
pGC->pCompositeClip = pregWin;
|
||||||
|
} else {
|
||||||
|
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
|
||||||
|
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||||
|
pregWin, pGC->clientClip);
|
||||||
|
}
|
||||||
|
pGC->freeCompClip = TRUE;
|
||||||
|
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
||||||
|
-(pDrawable->x + pGC->clipOrg.x),
|
||||||
|
-(pDrawable->y + pGC->clipOrg.y));
|
||||||
|
}
|
||||||
|
} /* end of composite clip for a window */
|
||||||
|
else {
|
||||||
|
BoxRec pixbounds;
|
||||||
|
|
||||||
|
/* XXX should we translate by drawable.x/y here ? */
|
||||||
|
pixbounds.x1 = 0;
|
||||||
|
pixbounds.y1 = 0;
|
||||||
|
pixbounds.x2 = pDrawable->width;
|
||||||
|
pixbounds.y2 = pDrawable->height;
|
||||||
|
|
||||||
|
if (pGC->freeCompClip) {
|
||||||
|
REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
|
||||||
|
} else {
|
||||||
|
pGC->freeCompClip = TRUE;
|
||||||
|
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pGC->clientClipType == CT_REGION) {
|
||||||
|
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
|
||||||
|
-pGC->clipOrg.y);
|
||||||
|
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
||||||
|
pGC->pCompositeClip, pGC->clientClip);
|
||||||
|
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
|
||||||
|
pGC->clipOrg.y);
|
||||||
|
}
|
||||||
|
} /* end of composite clip for pixmap */
|
||||||
|
} /* end afbComputeCompositeClip */
|
||||||
|
|
||||||
/* Clipping conventions
|
/* Clipping conventions
|
||||||
if the drawable is a window
|
if the drawable is a window
|
||||||
CT_REGION ==> pCompositeClip really is the composite
|
CT_REGION ==> pCompositeClip really is the composite
|
||||||
|
@ -147,7 +266,7 @@ afbCreateGC(pGC)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
static void
|
||||||
afbValidateGC(pGC, changes, pDrawable)
|
afbValidateGC(pGC, changes, pDrawable)
|
||||||
register GCPtr pGC;
|
register GCPtr pGC;
|
||||||
unsigned long changes;
|
unsigned long changes;
|
||||||
|
@ -434,7 +553,7 @@ afbValidateGC(pGC, changes, pDrawable)
|
||||||
} /* end of new_fill */
|
} /* end of new_fill */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
afbDestroyGC(pGC)
|
afbDestroyGC(pGC)
|
||||||
GCPtr pGC;
|
GCPtr pGC;
|
||||||
{
|
{
|
||||||
|
@ -445,58 +564,6 @@ afbDestroyGC(pGC)
|
||||||
miDestroyGCOps(pGC->ops);
|
miDestroyGCOps(pGC->ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* table to map alu(src, dst) to alu(~src, dst) */
|
|
||||||
int afbInverseAlu[16] = {
|
|
||||||
GXclear,
|
|
||||||
GXandInverted,
|
|
||||||
GXnor,
|
|
||||||
GXcopyInverted,
|
|
||||||
GXand,
|
|
||||||
GXnoop,
|
|
||||||
GXequiv,
|
|
||||||
GXorInverted,
|
|
||||||
GXandReverse,
|
|
||||||
GXxor,
|
|
||||||
GXinvert,
|
|
||||||
GXnand,
|
|
||||||
GXcopy,
|
|
||||||
GXor,
|
|
||||||
GXorReverse,
|
|
||||||
GXset
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
afbReduceOpaqueStipple(fg, bg, planemask, depth, rop)
|
|
||||||
register PixelType fg;
|
|
||||||
register PixelType bg;
|
|
||||||
register unsigned long planemask;
|
|
||||||
int depth;
|
|
||||||
register unsigned char *rop;
|
|
||||||
{
|
|
||||||
register int d;
|
|
||||||
register Pixel mask = 1;
|
|
||||||
|
|
||||||
bg ^= fg;
|
|
||||||
|
|
||||||
for (d = 0; d < depth; d++, mask <<= 1) {
|
|
||||||
if (!(planemask & mask))
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
else if (!(bg & mask)) {
|
|
||||||
/* Both fg and bg have a 0 or 1 in this plane */
|
|
||||||
if (fg & mask)
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
else
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
} else {
|
|
||||||
/* Both fg and bg have different bits on this plane */
|
|
||||||
if (fg & mask)
|
|
||||||
rop[d] = RROP_COPY;
|
|
||||||
else
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
afbReduceRop(alu, src, planemask, depth, rop)
|
afbReduceRop(alu, src, planemask, depth, rop)
|
||||||
register int alu;
|
register int alu;
|
||||||
|
@ -615,94 +682,3 @@ afbReduceRop(alu, src, planemask, depth, rop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
afbComputeCompositeClip(pGC, pDrawable)
|
|
||||||
GCPtr pGC;
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
{
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
|
||||||
WindowPtr pWin = (WindowPtr) pDrawable;
|
|
||||||
RegionPtr pregWin;
|
|
||||||
Bool freeTmpClip, freeCompClip;
|
|
||||||
|
|
||||||
if (pGC->subWindowMode == IncludeInferiors) {
|
|
||||||
pregWin = NotClippedByChildren(pWin);
|
|
||||||
freeTmpClip = TRUE;
|
|
||||||
} else {
|
|
||||||
pregWin = &pWin->clipList;
|
|
||||||
freeTmpClip = FALSE;
|
|
||||||
}
|
|
||||||
freeCompClip = pGC->freeCompClip;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if there is no client clip, we can get by with just keeping the
|
|
||||||
* pointer we got, and remembering whether or not should destroy (or
|
|
||||||
* maybe re-use) it later. this way, we avoid unnecessary copying of
|
|
||||||
* regions. (this wins especially if many clients clip by children
|
|
||||||
* and have no client clip.)
|
|
||||||
*/
|
|
||||||
if (pGC->clientClipType == CT_NONE) {
|
|
||||||
if (freeCompClip)
|
|
||||||
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
|
||||||
pGC->pCompositeClip = pregWin;
|
|
||||||
pGC->freeCompClip = freeTmpClip;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* we need one 'real' region to put into the composite clip. if
|
|
||||||
* pregWin the current composite clip are real, we can get rid of
|
|
||||||
* one. if pregWin is real and the current composite clip isn't,
|
|
||||||
* use pregWin for the composite clip. if the current composite
|
|
||||||
* clip is real and pregWin isn't, use the current composite
|
|
||||||
* clip. if neither is real, create a new region.
|
|
||||||
*/
|
|
||||||
|
|
||||||
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
|
||||||
pDrawable->x + pGC->clipOrg.x,
|
|
||||||
pDrawable->y + pGC->clipOrg.y);
|
|
||||||
|
|
||||||
if (freeCompClip) {
|
|
||||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
|
|
||||||
pGC->clientClip);
|
|
||||||
if (freeTmpClip)
|
|
||||||
REGION_DESTROY(pGC->pScreen, pregWin);
|
|
||||||
} else if (freeTmpClip) {
|
|
||||||
REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip);
|
|
||||||
pGC->pCompositeClip = pregWin;
|
|
||||||
} else {
|
|
||||||
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
|
|
||||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
|
||||||
pregWin, pGC->clientClip);
|
|
||||||
}
|
|
||||||
pGC->freeCompClip = TRUE;
|
|
||||||
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
|
|
||||||
-(pDrawable->x + pGC->clipOrg.x),
|
|
||||||
-(pDrawable->y + pGC->clipOrg.y));
|
|
||||||
}
|
|
||||||
} /* end of composite clip for a window */
|
|
||||||
else {
|
|
||||||
BoxRec pixbounds;
|
|
||||||
|
|
||||||
/* XXX should we translate by drawable.x/y here ? */
|
|
||||||
pixbounds.x1 = 0;
|
|
||||||
pixbounds.y1 = 0;
|
|
||||||
pixbounds.x2 = pDrawable->width;
|
|
||||||
pixbounds.y2 = pDrawable->height;
|
|
||||||
|
|
||||||
if (pGC->freeCompClip) {
|
|
||||||
REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
|
|
||||||
} else {
|
|
||||||
pGC->freeCompClip = TRUE;
|
|
||||||
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pGC->clientClipType == CT_REGION) {
|
|
||||||
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
|
|
||||||
-pGC->clipOrg.y);
|
|
||||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
|
|
||||||
pGC->pCompositeClip, pGC->clientClip);
|
|
||||||
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
|
|
||||||
pGC->clipOrg.y);
|
|
||||||
}
|
|
||||||
} /* end of composite clip for pixmap */
|
|
||||||
} /* end afbComputeCompositeClip */
|
|
||||||
|
|
|
@ -42,39 +42,8 @@ afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage)
|
||||||
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
||||||
0, width, height, x, y, 1);
|
0, width, height, x, y, 1);
|
||||||
else {
|
else {
|
||||||
#if 0
|
|
||||||
/* XXX: bit plane order wronge ! */
|
|
||||||
pPixmap->drawable.depth = 1;
|
|
||||||
pPixmap->drawable.bitsPerPixel = 1;
|
|
||||||
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXcopy:
|
|
||||||
doBitBlt = afbDoBitbltCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
doBitBlt = afbDoBitbltXor;
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
doBitBlt = afbDoBitbltCopyInverted;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
doBitBlt = afbDoBitbltOr;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
doBitBlt = afbDoBitbltGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (plane = (1L << (pPixmap->drawable.depth - 1)); plane;
|
|
||||||
plane >>= 1) {
|
|
||||||
(void)afbBitBlt((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
|
|
||||||
width, height, x, y, doBitBlt, plane);
|
|
||||||
/* pDraw->devKind += sizeDst; */
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
||||||
0, width, height, x, y);
|
0, width, height, x, y);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pGC->fExpose = TRUE;
|
pGC->fExpose = TRUE;
|
||||||
|
|
|
@ -118,9 +118,8 @@ afbDestroyPixmap(pPixmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PixmapPtr
|
static PixmapPtr
|
||||||
afbCopyPixmap(pSrc)
|
afbCopyPixmap(PixmapPtr pSrc)
|
||||||
register PixmapPtr pSrc;
|
|
||||||
{
|
{
|
||||||
register PixmapPtr pDst;
|
register PixmapPtr pDst;
|
||||||
int size;
|
int size;
|
||||||
|
@ -148,9 +147,8 @@ afbCopyPixmap(pSrc)
|
||||||
zero out area to be filled with replicate
|
zero out area to be filled with replicate
|
||||||
left shift and or in original as many times as needed
|
left shift and or in original as many times as needed
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
afbPadPixmap(pPixmap)
|
afbPadPixmap(PixmapPtr pPixmap)
|
||||||
PixmapPtr pPixmap;
|
|
||||||
{
|
{
|
||||||
register int width = pPixmap->drawable.width;
|
register int width = pPixmap->drawable.width;
|
||||||
register int h;
|
register int h;
|
||||||
|
|
|
@ -77,7 +77,7 @@ int afbScreenPrivateIndex;
|
||||||
|
|
||||||
static unsigned long afbGeneration = 0;
|
static unsigned long afbGeneration = 0;
|
||||||
|
|
||||||
BSFuncRec afbBSFuncRec = {
|
static BSFuncRec afbBSFuncRec = {
|
||||||
afbSaveAreas,
|
afbSaveAreas,
|
||||||
afbRestoreAreas,
|
afbRestoreAreas,
|
||||||
(BackingStoreSetClipmaskRgnProcPtr) 0,
|
(BackingStoreSetClipmaskRgnProcPtr) 0,
|
||||||
|
@ -85,7 +85,7 @@ BSFuncRec afbBSFuncRec = {
|
||||||
(BackingStoreGetSpansPixmapProcPtr) 0,
|
(BackingStoreGetSpansPixmapProcPtr) 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
Bool
|
static Bool
|
||||||
afbCloseScreen(int index, ScreenPtr pScreen)
|
afbCloseScreen(int index, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
int d;
|
int d;
|
||||||
|
@ -119,7 +119,29 @@ afbCreateScreenResources(ScreenPtr pScreen)
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
static PixmapPtr
|
||||||
|
afbGetWindowPixmap(WindowPtr pWin)
|
||||||
|
{
|
||||||
|
#ifdef PIXMAP_PER_WINDOW
|
||||||
|
return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
|
||||||
|
#else
|
||||||
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
|
|
||||||
|
return (* pScreen->GetScreenPixmap)(pScreen);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
|
||||||
|
{
|
||||||
|
#ifdef PIXMAP_PER_WINDOW
|
||||||
|
pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
|
||||||
|
#else
|
||||||
|
(* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex)
|
afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex)
|
||||||
{
|
{
|
||||||
if (afbGeneration != serverGeneration) {
|
if (afbGeneration != serverGeneration) {
|
||||||
|
@ -216,25 +238,3 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
afbGetWindowPixmap(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
|
|
||||||
#else
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
return (* pScreen->GetScreenPixmap)(pScreen);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
|
|
||||||
{
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
|
|
||||||
#else
|
|
||||||
(* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -73,20 +73,10 @@ SOFTWARE.
|
||||||
* boxes, we may not want to start grabbing bits at psrc but at some offset
|
* boxes, we may not want to start grabbing bits at psrc but at some offset
|
||||||
* further on.)
|
* further on.)
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
afbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst,
|
afbSetScanline(int y, int xOrigin, int xStart, int xEnd, PixelType *psrc,
|
||||||
sizeDst, depthDst, sizeSrc)
|
int alu, PixelType *pdstBase, int widthDst, int sizeDst,
|
||||||
int y;
|
int depthDst, int sizeSrc)
|
||||||
int xOrigin; /* where this scanline starts */
|
|
||||||
int xStart; /* first bit to use from scanline */
|
|
||||||
int xEnd; /* last bit to use from scanline + 1 */
|
|
||||||
register PixelType *psrc;
|
|
||||||
register int alu; /* raster op */
|
|
||||||
PixelType *pdstBase; /* start of the drawable */
|
|
||||||
int widthDst; /* width of drawable in words */
|
|
||||||
int sizeDst;
|
|
||||||
int depthDst;
|
|
||||||
int sizeSrc;
|
|
||||||
{
|
{
|
||||||
int w; /* width of scanline in bits */
|
int w; /* width of scanline in bits */
|
||||||
register PixelType *pdst; /* where to put the bits */
|
register PixelType *pdst; /* where to put the bits */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user