diff options
Diffstat (limited to 'afb')
-rw-r--r-- | afb/Makefile.am | 4 | ||||
-rw-r--r-- | afb/afb.h | 34 | ||||
-rw-r--r-- | afb/afbbitblt.c | 4 | ||||
-rw-r--r-- | afb/afbblt.c | 26 | ||||
-rw-r--r-- | afb/afbbstore.c | 154 | ||||
-rw-r--r-- | afb/afbfillrct.c | 4 | ||||
-rw-r--r-- | afb/afbfillsp.c | 84 | ||||
-rw-r--r-- | afb/afbimage.c | 3 | ||||
-rw-r--r-- | afb/afbimggblt.c | 4 | ||||
-rw-r--r-- | afb/afbpixmap.c | 13 | ||||
-rw-r--r-- | afb/afbplygblt.c | 4 | ||||
-rw-r--r-- | afb/afbpntwin.c | 126 | ||||
-rw-r--r-- | afb/afbscrinit.c | 18 | ||||
-rw-r--r-- | afb/afbwindow.c | 167 |
14 files changed, 84 insertions, 561 deletions
diff --git a/afb/Makefile.am b/afb/Makefile.am index d83b67417..9fc22ca54 100644 --- a/afb/Makefile.am +++ b/afb/Makefile.am @@ -6,11 +6,11 @@ libafb_gen_sources = afbbltC.c afbbltX.c afbbltCI.c afbbltO.c afbbltG.c afbtileC DISTCLEANFILES = $(libafb_gen_sources) -libafb_la_SOURCES = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpntwin.c afbpixmap.c \ +libafb_la_SOURCES = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpixmap.c \ afbimage.c afbline.c afbbres.c afbhrzvert.c afbbresd.c afbpushpxl.c afbply1rct.c \ afbzerarc.c afbfillarc.c afbfillsp.c afbsetsp.c afbscrinit.c afbplygblt.c \ afbclip.c afbgetsp.c afbpolypnt.c afbbitblt.c afbcmap.c afbimggblt.c afbpntarea.c \ - afbmisc.c afbbstore.c afbtegblt.c $(libafb_gen_sources) + afbmisc.c afbtegblt.c $(libafb_gen_sources) INCLUDES = -I$(top_srcdir)/mfb -I$(top_srcdir)/hw/xfree86/os-support @@ -182,23 +182,7 @@ extern void afbBresD( unsigned char * /*rrops*/, unsigned char * /*bgrrops*/ ); -/* afbbstore.c */ -extern void afbSaveAreas( - PixmapPtr /*pPixmap*/, - RegionPtr /*prgnSave*/, - int /*xorg*/, - int /*yorg*/, - WindowPtr /*pWin*/ -); - -extern void afbRestoreAreas( - PixmapPtr /*pPixmap*/, - RegionPtr /*prgnRestore*/, - int /*xorg*/, - int /*yorg*/, - WindowPtr /*pWin*/ -); /* afbclip.c */ extern RegionPtr afbPixmapToRegion( @@ -499,7 +483,8 @@ extern PixmapPtr afbCreatePixmap( ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, - int /*depth*/ + int /*depth*/, + unsigned /*usage_hint*/ ); extern Bool afbDestroyPixmap( @@ -522,11 +507,6 @@ extern void afbCopyRotatePixmap( int /*xrot*/, int /*yrot*/ ); -extern void afbPaintWindow( - WindowPtr /*pWin*/, - RegionPtr /*pRegion*/, - int /*what*/ -); /* afbpolypnt.c */ extern void afbPolyPoint( @@ -760,16 +740,6 @@ extern int frameWindowPrivateIndex; /* index into Window private array */ #define afbGetGCPrivate(pGC) \ ((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr)) -/* private field of window */ -typedef struct { - unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */ - unsigned char fastBackground; - unsigned short unused; /* pad for alignment with Sun compiler */ - DDXPointRec oldRotate; - PixmapPtr pRotatedBackground; - PixmapPtr pRotatedBorder; -} afbPrivWin; - /* Common macros for extracting drawing information */ #define afbGetTypedWidth(pDrawable,wtype)( \ diff --git a/afb/afbbitblt.c b/afb/afbbitblt.c index 2e416e356..d8b2ccda5 100644 --- a/afb/afbbitblt.c +++ b/afb/afbbitblt.c @@ -279,7 +279,7 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, /* Do bit blitting */ numRects = REGION_NUM_RECTS(&rgnDst); if (numRects && width && height) { - if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * + if(!(pptSrc = (DDXPointPtr)xalloc(numRects * sizeof(DDXPointRec)))) { REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) @@ -296,7 +296,7 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, (*doBitBlt)(pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, planemask); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); } prgnExposed = NULL; diff --git a/afb/afbblt.c b/afb/afbblt.c index 9eb4e4732..4e1a49e9d 100644 --- a/afb/afbblt.c +++ b/afb/afbblt.c @@ -132,12 +132,12 @@ MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); + pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox); if(!pboxNew1) return; - pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox); if(!pptNew1) { - DEALLOCATE_LOCAL(pboxNew1); + xfree(pboxNew1); return; } pboxBase = pboxNext = pbox+nbox-1; @@ -169,16 +169,16 @@ MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) if (nbox > 1) { /* reverse order of rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); - pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); + pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); + pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); if(!pboxNew2 || !pptNew2) { if (pptNew2) - DEALLOCATE_LOCAL(pptNew2); + xfree(pptNew2); if (pboxNew2) - DEALLOCATE_LOCAL(pboxNew2); + xfree(pboxNew2); if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); + xfree(pptNew1); + xfree(pboxNew1); } return; } @@ -553,11 +553,11 @@ bits1 = *--psrc; --pdst; \ pptSrc++; } if (pboxNew2) { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); + xfree(pptNew2); + xfree(pboxNew2); } if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); + xfree(pptNew1); + xfree(pboxNew1); } } diff --git a/afb/afbbstore.c b/afb/afbbstore.c deleted file mode 100644 index 32d64ec47..000000000 --- a/afb/afbbstore.c +++ /dev/null @@ -1,154 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/* - -Copyright (c) 1987 X Consortium - -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 X CONSORTIUM 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 X Consortium 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 X Consortium. - -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "afb.h" -#include <X11/X.h> -#include "mibstore.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" - -/*- - *----------------------------------------------------------------------- - * afbSaveAreas -- - * Function called by miSaveAreas to actually fetch the areas to be - * saved into the backing pixmap. This is very simple to do, since - * afbDoBitblt is designed for this very thing. The region to save is - * already destination-relative and we're given the offset to the - * window origin, so we have only to create an array of points of the - * u.l. corners of the boxes in the region translated to the screen - * coordinate system and fetch the screen pixmap out of its devPrivate - * field.... - * - * Results: - * None. - * - * Side Effects: - * Data are copied from the screen into the pixmap. - * - *----------------------------------------------------------------------- - */ -void -afbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin) - PixmapPtr pPixmap; /* Backing pixmap */ - RegionPtr prgnSave; /* Region to save (pixmap-relative) */ - int xorg; /* X origin of region */ - int yorg; /* Y origin of region */ - WindowPtr pWin; -{ - register DDXPointPtr pPt; - DDXPointPtr pPtsInit; - register BoxPtr pBox; - register int numRects; - - numRects = REGION_NUM_RECTS(prgnSave); - pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec)); - if (!pPtsInit) - return; - - pBox = REGION_RECTS(prgnSave); - pPt = pPtsInit; - while (numRects--) { - pPt->x = pBox->x1 + xorg; - pPt->y = pBox->y1 + yorg; - pPt++; - pBox++; - } - - afbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr, - (DrawablePtr)pPixmap, - GXcopy, - prgnSave, - pPtsInit, wBackingBitPlanes (pWin)); - - DEALLOCATE_LOCAL(pPtsInit); -} - -/*- - *----------------------------------------------------------------------- - * afbRestoreAreas -- - * Function called by miRestoreAreas to actually fetch the areas to be - * restored from the backing pixmap. This is very simple to do, since - * afbDoBitblt is designed for this very thing. The region to restore is - * already destination-relative and we're given the offset to the - * window origin, so we have only to create an array of points of the - * u.l. corners of the boxes in the region translated to the pixmap - * coordinate system and fetch the screen pixmap out of its devPrivate - * field.... - * - * Results: - * None. - * - * Side Effects: - * Data are copied from the pixmap into the screen. - * - *----------------------------------------------------------------------- - */ -void -afbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin) - PixmapPtr pPixmap; /* Backing pixmap */ - RegionPtr prgnRestore; /* Region to restore (screen-relative)*/ - int xorg; /* X origin of window */ - int yorg; /* Y origin of window */ - WindowPtr pWin; -{ - register DDXPointPtr pPt; - DDXPointPtr pPtsInit; - register BoxPtr pBox; - register int numRects; - - numRects = REGION_NUM_RECTS(prgnRestore); - pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec)); - if (!pPtsInit) - return; - - pBox = REGION_RECTS(prgnRestore); - pPt = pPtsInit; - while (numRects--) { - pPt->x = pBox->x1 - xorg; - pPt->y = pBox->y1 - yorg; - pPt++; - pBox++; - } - - afbDoBitblt((DrawablePtr)pPixmap, - (DrawablePtr)pPixmap->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr, - GXcopy, - prgnRestore, - pPtsInit, wBackingBitPlanes (pWin)); - - DEALLOCATE_LOCAL(pPtsInit); -} diff --git a/afb/afbfillrct.c b/afb/afbfillrct.c index 06fb37365..1600deab3 100644 --- a/afb/afbfillrct.c +++ b/afb/afbfillrct.c @@ -111,7 +111,7 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; if (numRects > NUM_STACK_RECTS) { - pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec)); if (!pboxClippedBase) return; } @@ -287,5 +287,5 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre } } if (pboxClippedBase != stackRects) - DEALLOCATE_LOCAL(pboxClippedBase); + xfree(pboxClippedBase); } diff --git a/afb/afbfillsp.c b/afb/afbfillsp.c index 539c3457c..b00185922 100644 --- a/afb/afbfillsp.c +++ b/afb/afbfillsp.c @@ -109,11 +109,11 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) unsigned char *rrops; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -183,8 +183,8 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) pwidth++; ppt++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } void @@ -219,11 +219,11 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) unsigned char *rrops; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -297,8 +297,8 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) pwidth++; ppt++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } void @@ -333,11 +333,11 @@ afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int d; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -428,8 +428,8 @@ afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) break; } } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } void @@ -465,11 +465,11 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int d; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -587,8 +587,8 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) break; } } /* switch (rop) */ - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } /* Fill spans with tiles that aren't PPW bits wide */ @@ -626,11 +626,11 @@ afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) register int d; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -732,8 +732,8 @@ afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt++; pwidth++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } /* Fill spans with stipples that aren't PPW bits wide */ @@ -772,11 +772,11 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int depthDst; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -877,8 +877,8 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt++; pwidth++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } /* Fill spans with OpaqueStipples that aren't PPW bits wide */ @@ -918,11 +918,11 @@ afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int depthDst; n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); + pwidthFree = (int *)xalloc(n * sizeof(int)); + pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + if (pptFree) xfree(pptFree); + if (pwidthFree) xfree(pwidthFree); return; } pwidth = pwidthFree; @@ -1124,6 +1124,6 @@ afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt++; pwidth++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } diff --git a/afb/afbimage.c b/afb/afbimage.c index 81f49730a..890429fe6 100644 --- a/afb/afbimage.c +++ b/afb/afbimage.c @@ -72,7 +72,8 @@ afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage) int depthDst; /* Create a tmp pixmap */ - pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth); + pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; diff --git a/afb/afbimggblt.c b/afb/afbimggblt.c index de02aa46a..ca49ee3ba 100644 --- a/afb/afbimggblt.c +++ b/afb/afbimggblt.c @@ -298,7 +298,7 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) int getWidth; /* bits to get from glyph */ #endif - if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS)))) + if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS)))) return; pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst); @@ -462,7 +462,7 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) } /* depth */ } /* for each glyph */ } /* while nbox-- */ - DEALLOCATE_LOCAL(ppos); + xfree(ppos); break; } diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c index 77ba53513..d15d86114 100644 --- a/afb/afbpixmap.c +++ b/afb/afbpixmap.c @@ -70,11 +70,12 @@ SOFTWARE. #include "mfb.h" PixmapPtr -afbCreatePixmap(pScreen, width, height, depth) +afbCreatePixmap(pScreen, width, height, depth, usage_hint) ScreenPtr pScreen; int width; int height; int depth; + unsigned usage_hint; { PixmapPtr pPixmap; size_t datasize; @@ -127,8 +128,10 @@ afbCopyPixmap(PixmapPtr pSrc) size = pSrc->drawable.height * pSrc->devKind * pSrc->drawable.depth; pScreen = pSrc->drawable.pScreen; - pDst = (*pScreen->CreatePixmap)(pScreen, pSrc->drawable.width, - pSrc->drawable.height, pSrc->drawable.depth); + 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); @@ -248,7 +251,7 @@ afbYRotatePixmap(pPix, rh) nbyDown = rh * pPix->devKind; nbyUp = (pPix->devKind * height) - nbyDown; - if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp))) + if(!(ptmp = (char *)xalloc(nbyUp))) return; for (d = 0; d < pPix->drawable.depth; d++) { @@ -258,7 +261,7 @@ afbYRotatePixmap(pPix, rh) memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */ } - DEALLOCATE_LOCAL(ptmp); + xfree(ptmp); } void diff --git a/afb/afbplygblt.c b/afb/afbplygblt.c index 289d50e1b..bcb08c7a6 100644 --- a/afb/afbplygblt.c +++ b/afb/afbplygblt.c @@ -278,7 +278,7 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) int getWidth; /* bits to get from glyph */ #endif - if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS)))) + if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS)))) return; pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst); @@ -453,7 +453,7 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) } /* depth */ } /* for each glyph */ } /* while nbox-- */ - DEALLOCATE_LOCAL(ppos); + xfree(ppos); break; } diff --git a/afb/afbpntwin.c b/afb/afbpntwin.c deleted file mode 100644 index 6082f7caa..000000000 --- a/afb/afbpntwin.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -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 -X CONSORTIUM 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 X Consortium 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 X Consortium. - - -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 "windowstr.h" -#include "regionstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "afb.h" -#include "maskbits.h" -#include "mi.h" - -void -afbPaintWindow(pWin, pRegion, what) - WindowPtr pWin; - RegionPtr pRegion; - int what; -{ - register afbPrivWin *pPrivWin; - unsigned char rrops[AFB_MAX_DEPTH]; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - - switch (what) { - case PW_BACKGROUND: - switch (pWin->backgroundState) { - case None: - return; - case ParentRelative: - do { - pWin = pWin->parent; - } while (pWin->backgroundState == ParentRelative); - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, - what); - return; - case BackgroundPixmap: - if (pPrivWin->fastBackground) { - afbTileAreaPPWCopy((DrawablePtr)pWin, - REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), GXcopy, - pPrivWin->pRotatedBackground, ~0); - return; - } else { - afbTileAreaCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), GXcopy, - pWin->background.pixmap, 0, 0, ~0); - return; - } - break; - case BackgroundPixel: - afbReduceRop(GXcopy, pWin->background.pixel, ~0, - pWin->drawable.depth, rrops); - afbSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), rrops); - return; - } - break; - case PW_BORDER: - if (pWin->borderIsPixel) { - afbReduceRop(GXcopy, pWin->border.pixel, ~0, pWin->drawable.depth, - rrops); - afbSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), rrops); - return; - } else if (pPrivWin->fastBorder) { - afbTileAreaPPWCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), GXcopy, - pPrivWin->pRotatedBorder, ~0); - return; - } - break; - } - miPaintWindow(pWin, pRegion, what); -} diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c index 7cb742345..f3a054268 100644 --- a/afb/afbscrinit.c +++ b/afb/afbscrinit.c @@ -71,20 +71,11 @@ SOFTWARE. #ifdef PIXMAP_PER_WINDOW int frameWindowPrivateIndex; #endif -int afbWindowPrivateIndex; int afbGCPrivateIndex; int afbScreenPrivateIndex; static unsigned long afbGeneration = 0; -static BSFuncRec afbBSFuncRec = { - afbSaveAreas, - afbRestoreAreas, - (BackingStoreSetClipmaskRgnProcPtr) 0, - (BackingStoreGetImagePixmapProcPtr) 0, - (BackingStoreGetSpansPixmapProcPtr) 0, -}; - static Bool afbCloseScreen(int index, ScreenPtr pScreen) { @@ -148,20 +139,16 @@ afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex) #ifdef PIXMAP_PER_WINDOW frameWindowPrivateIndex = AllocateWindowPrivateIndex(); #endif - afbWindowPrivateIndex = AllocateWindowPrivateIndex(); afbGCPrivateIndex = AllocateGCPrivateIndex(); afbGeneration = serverGeneration; } - if (pWinIndex) - *pWinIndex = afbWindowPrivateIndex; if (pGCIndex) *pGCIndex = afbGCPrivateIndex; afbScreenPrivateIndex = AllocateScreenPrivateIndex(); pScreen->GetWindowPixmap = afbGetWindowPixmap; pScreen->SetWindowPixmap = afbSetWindowPixmap; - return(AllocateWindowPrivate(pScreen, afbWindowPrivateIndex, sizeof(afbPrivWin)) && - AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC))); + return(AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC))); } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ @@ -206,8 +193,6 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i pScreen->ChangeWindowAttributes = afbChangeWindowAttributes; pScreen->RealizeWindow = afbMapWindow; pScreen->UnrealizeWindow = afbUnmapWindow; - pScreen->PaintWindowBackground = afbPaintWindow; - pScreen->PaintWindowBorder = afbPaintWindow; pScreen->CopyWindow = afbCopyWindow; pScreen->CreatePixmap = afbCreatePixmap; pScreen->DestroyPixmap = afbDestroyPixmap; @@ -231,7 +216,6 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i pScreen->CloseScreen = afbCloseScreen; pScreen->CreateScreenResources = afbCreateScreenResources; - pScreen->BackingStoreFuncs = afbBSFuncRec; pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate; pScreen->devPrivate = oldDevPrivate; diff --git a/afb/afbwindow.c b/afb/afbwindow.c index a4a1602bc..61641ee31 100644 --- a/afb/afbwindow.c +++ b/afb/afbwindow.c @@ -62,39 +62,16 @@ SOFTWARE. #include "maskbits.h" Bool -afbCreateWindow(pWin) - register WindowPtr pWin; +afbCreateWindow(WindowPtr pWin) { - register afbPrivWin *pPrivWin; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - pPrivWin->pRotatedBorder = NullPixmap; - pPrivWin->pRotatedBackground = NullPixmap; - pPrivWin->fastBackground = FALSE; - pPrivWin->fastBorder = FALSE; -#ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = - pWin->pDrawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; -#endif - return (TRUE); } /* This always returns true, because Xfree can't fail. It might be possible * on some devices for Destroy to fail */ Bool -afbDestroyWindow(pWin) - WindowPtr pWin; +afbDestroyWindow(WindowPtr pWin) { - register afbPrivWin *pPrivWin; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - - if (pPrivWin->pRotatedBorder) - (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder); - if (pPrivWin->pRotatedBackground) - (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground); - return (TRUE); } @@ -106,46 +83,10 @@ afbMapWindow(pWindow) return (TRUE); } -/* (x, y) is the upper left corner of the window on the screen - do we really need to pass this? (is it a;ready in pWin->absCorner?) - we only do the rotation for pixmaps that are 32 bits wide (padded -or otherwise.) - afbChangeWindowAttributes() has already put a copy of the pixmap -in pPrivWin->pRotated* -*/ - /*ARGSUSED*/ Bool -afbPositionWindow(pWin, x, y) - WindowPtr pWin; - int x, y; +afbPositionWindow(WindowPtr pWin, int x, int y) { - register afbPrivWin *pPrivWin; - int reset = 0; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) { - afbXRotatePixmap(pPrivWin->pRotatedBackground, - pWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBackground, - pWin->drawable.y - pPrivWin->oldRotate.y); - reset = 1; - } - - if (!pWin->borderIsPixel && pPrivWin->fastBorder) { - while (pWin->backgroundState == ParentRelative) - pWin = pWin->parent; - afbXRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.y - pPrivWin->oldRotate.y); - reset = 1; - } - if (reset) { - pPrivWin->oldRotate.x = pWin->drawable.x; - pPrivWin->oldRotate.y = pWin->drawable.y; - } - /* This is the "wrong" fix to the right problem, but it doesn't really * cost very much. When the window is moved, we need to invalidate any * RotatedPixmap that exists in any GC currently validated against this @@ -200,7 +141,7 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc) pbox = REGION_RECTS(prgnDst); nbox = REGION_NUM_RECTS(prgnDst); - if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) + if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) return; ppt = pptSrc; @@ -211,108 +152,12 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc) afbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, prgnDst, pptSrc, ~0); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); REGION_DESTROY(pWin->drawable.pScreen, prgnDst); } - - -/* swap in correct PaintWindow* routine. If we can use a fast output -routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy -of it in devPrivate. -*/ Bool -afbChangeWindowAttributes(pWin, mask) - register WindowPtr pWin; - register unsigned long mask; +afbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { - register unsigned long index; - register afbPrivWin *pPrivWin; - WindowPtr pBgWin; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - /* - * When background state changes from ParentRelative and - * we had previously rotated the fast border pixmap to match - * the parent relative origin, rerotate to match window - */ - if (mask & (CWBackPixmap | CWBackPixel) && - pWin->backgroundState != ParentRelative && pPrivWin->fastBorder && - (pPrivWin->oldRotate.x != pWin->drawable.x || - pPrivWin->oldRotate.y != pWin->drawable.y)) { - afbXRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.y - pPrivWin->oldRotate.y); - pPrivWin->oldRotate.x = pWin->drawable.x; - pPrivWin->oldRotate.y = pWin->drawable.y; - } - while(mask) { - index = lowbit (mask); - mask &= ~index; - switch(index) { - case CWBackPixmap: - if (pWin->backgroundState == None) - pPrivWin->fastBackground = FALSE; - else if (pWin->backgroundState == ParentRelative) { - pPrivWin->fastBackground = FALSE; - /* Rotate border to match parent origin */ - if (pPrivWin->pRotatedBorder) { - for (pBgWin = pWin->parent; - pBgWin->backgroundState == ParentRelative; - pBgWin = pBgWin->parent); - afbXRotatePixmap(pPrivWin->pRotatedBorder, - pBgWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBorder, - pBgWin->drawable.y - pPrivWin->oldRotate.y); - pPrivWin->oldRotate.x = pBgWin->drawable.x; - pPrivWin->oldRotate.y = pBgWin->drawable.y; - } - } else if ((pWin->background.pixmap->drawable.width <= PPW) && - !(pWin->background.pixmap->drawable.width & - (pWin->background.pixmap->drawable.width - 1))) { - afbCopyRotatePixmap(pWin->background.pixmap, - &pPrivWin->pRotatedBackground, - pWin->drawable.x, pWin->drawable.y); - if (pPrivWin->pRotatedBackground) { - pPrivWin->fastBackground = TRUE; - pPrivWin->oldRotate.x = pWin->drawable.x; - pPrivWin->oldRotate.y = pWin->drawable.y; - } else - pPrivWin->fastBackground = FALSE; - } else - pPrivWin->fastBackground = FALSE; - break; - - case CWBackPixel: - pPrivWin->fastBackground = FALSE; - break; - - case CWBorderPixmap: - if ((pWin->border.pixmap->drawable.width <= PPW) && - !(pWin->border.pixmap->drawable.width & - (pWin->border.pixmap->drawable.width - 1))) { - for (pBgWin = pWin; - pBgWin->backgroundState == ParentRelative; - pBgWin = pBgWin->parent); - afbCopyRotatePixmap(pWin->border.pixmap, - &pPrivWin->pRotatedBorder, - pBgWin->drawable.x, pBgWin->drawable.y); - if (pPrivWin->pRotatedBorder) { - pPrivWin->fastBorder = TRUE; - pPrivWin->oldRotate.x = pBgWin->drawable.x; - pPrivWin->oldRotate.y = pBgWin->drawable.y; - } else - pPrivWin->fastBorder = FALSE; - } else - pPrivWin->fastBorder = FALSE; - break; - case CWBorderPixel: - pPrivWin->fastBorder = FALSE; - break; - } - } - /* Again, we have no failure modes indicated by any of the routines - * we've called, so we have to assume it worked */ return (TRUE); } |