diff options
Diffstat (limited to 'mfb')
-rw-r--r-- | mfb/mfb.h | 10 | ||||
-rw-r--r-- | mfb/mfbbitblt.c | 18 | ||||
-rw-r--r-- | mfb/mfbfillarc.c | 3 | ||||
-rw-r--r-- | mfb/mfbfillrct.c | 3 | ||||
-rw-r--r-- | mfb/mfbfillsp.c | 9 | ||||
-rw-r--r-- | mfb/mfbgc.c | 10 | ||||
-rw-r--r-- | mfb/mfbimggblt.c | 3 | ||||
-rw-r--r-- | mfb/mfbline.c | 6 | ||||
-rw-r--r-- | mfb/mfbpixmap.c | 2 | ||||
-rw-r--r-- | mfb/mfbpolypnt.c | 3 | ||||
-rw-r--r-- | mfb/mfbscrinit.c | 25 | ||||
-rw-r--r-- | mfb/mfbwindow.c | 1 | ||||
-rw-r--r-- | mfb/mfbzerarc.c | 3 |
13 files changed, 48 insertions, 48 deletions
@@ -58,6 +58,7 @@ SOFTWARE. #include "region.h" #include "gc.h" #include "colormap.h" +#include "privates.h" #include "miscstruct.h" #include "mibstore.h" @@ -698,7 +699,7 @@ extern Bool mfbCloseScreen( extern Bool mfbAllocatePrivates( ScreenPtr /*pScreen*/, - int * /*pGCIndex*/ + DevPrivateKey * /*pGCKey*/ ); extern Bool mfbScreenInit( @@ -883,12 +884,9 @@ typedef struct { typedef mfbPrivGC *mfbPrivGCPtr; #endif -/* XXX these should be static, but it breaks the ABI */ -extern int mfbGCPrivateIndex; /* index into GC private array */ -extern int mfbGetGCPrivateIndex(void); +extern DevPrivateKey mfbGetGCPrivateKey(void); #ifdef PIXMAP_PER_WINDOW -extern int frameWindowPrivateIndex; /* index into Window private array */ -extern int frameGetWindowPrivateIndex(void); +extern DevPrivateKey frameGetWindowPrivateKey(void); #endif #ifndef MFB_PROTOTYPES_ONLY diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c index 153cf6ac6..344c655ee 100644 --- a/mfb/mfbbitblt.c +++ b/mfb/mfbbitblt.c @@ -397,8 +397,7 @@ int dstx, dsty; * must register a function for n-to-1 copy operations */ -static unsigned long copyPlaneGeneration; -static int copyPlaneScreenIndex = -1; +static DevPrivateKey copyPlaneScreenKey = ©PlaneScreenKey; Bool mfbRegisterCopyPlaneProc (pScreen, proc) @@ -415,14 +414,7 @@ mfbRegisterCopyPlaneProc (pScreen, proc) int /* dsty */, unsigned long /* bitPlane */); { - if (copyPlaneGeneration != serverGeneration) - { - copyPlaneScreenIndex = AllocateScreenPrivateIndex(); - if (copyPlaneScreenIndex < 0) - return FALSE; - copyPlaneGeneration = serverGeneration; - } - pScreen->devPrivates[copyPlaneScreenIndex].fptr = proc; + dixSetPrivate(&pScreen->devPrivates, copyPlaneScreenKey, proc); return TRUE; } @@ -467,10 +459,8 @@ unsigned long plane; if (pSrcDrawable->depth != 1) { - if (copyPlaneScreenIndex >= 0 && - (copyPlane = - pSrcDrawable->pScreen->devPrivates[copyPlaneScreenIndex].fptr) - ) + if ((copyPlane = dixLookupPrivate(&pSrcDrawable->pScreen->devPrivates, + copyPlaneScreenKey))) { return (*copyPlane) (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); diff --git a/mfb/mfbfillarc.c b/mfb/mfbfillarc.c index 30ec00dc3..cbf47a0eb 100644 --- a/mfb/mfbfillarc.c +++ b/mfb/mfbfillarc.c @@ -289,7 +289,8 @@ mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs) RegionPtr cclip; int rop; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); rop = priv->rop; if ((rop == RROP_NOP) || !(pGC->planemask & 1)) return; diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c index 594c7f01b..a0b3d6716 100644 --- a/mfb/mfbfillrct.c +++ b/mfb/mfbfillrct.c @@ -96,7 +96,8 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) if (!(pGC->planemask & 1)) return; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); alu = priv->ropFillArea; pfn = priv->FillArea; ppix = pGC->pRotatedPixmap; diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c index f83ca6a54..c073535df 100644 --- a/mfb/mfbfillsp.c +++ b/mfb/mfbfillsp.c @@ -624,7 +624,8 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) if (pGC->fillStyle == FillTiled) rop = pGC->alu; else - rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; + rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->ropOpStip; flip = 0; switch(rop) @@ -769,7 +770,8 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) { pTile = pGC->stipple; tlwidth = pTile->devKind / PGSZB; - rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; + rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->ropOpStip; } xSrc = pDrawable->x; @@ -926,7 +928,8 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt, pwidth, fSorted); pTile = pGC->stipple; - rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; + rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop; tlwidth = pTile->devKind / PGSZB; xSrc = pDrawable->x; ySrc = pDrawable->y; diff --git a/mfb/mfbgc.c b/mfb/mfbgc.c index c60e97676..7492d7c04 100644 --- a/mfb/mfbgc.c +++ b/mfb/mfbgc.c @@ -381,7 +381,8 @@ matchCommon ( FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || FONTMINBOUNDS(pGC->font,characterWidth) < 0) return 0; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); for (i = 0; i < numberCommonOps; i++) { cop = &mfbCommonOps[i]; if ((pGC->fgPixel & 1) != cop->fg) @@ -420,7 +421,8 @@ mfbCreateGC(pGC) /* mfb wants to translate before scan convesion */ pGC->miTranslate = 1; - pPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr); + pPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel); pGC->fExpose = TRUE; pGC->pRotatedPixmap = NullPixmap; @@ -508,8 +510,8 @@ mfbValidateGC(pGC, changes, pDrawable) new_rotate = (oldOrg.x != pGC->lastWinOrg.x) || (oldOrg.y != pGC->lastWinOrg.y); - devPriv = ((mfbPrivGCPtr) (pGC->devPrivates[mfbGCPrivateIndex].ptr)); - + devPriv = (mfbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); /* if the client clip is different or moved OR the subwindowMode has changed OR diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c index c21e82608..cb532cf3b 100644 --- a/mfb/mfbimggblt.c +++ b/mfb/mfbimggblt.c @@ -184,7 +184,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) but that is usually not a cheap thing to do. */ - pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr; + pPrivGC = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); oldFillArea = pPrivGC->FillArea; if (pGC->bgPixel & 1) diff --git a/mfb/mfbline.c b/mfb/mfbline.c index 863a6187b..65baa5efd 100644 --- a/mfb/mfbline.c +++ b/mfb/mfbline.c @@ -146,7 +146,8 @@ mfbLineSS (pDrawable, pGC, mode, npt, pptInit) return; cclip = pGC->pCompositeClip; - alu = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; + alu = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); @@ -525,7 +526,8 @@ mfbLineSD( pDrawable, pGC, mode, npt, pptInit) return; cclip = pGC->pCompositeClip; - fgrop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; + fgrop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c index 438e9ab57..34bb33d89 100644 --- a/mfb/mfbpixmap.c +++ b/mfb/mfbpixmap.c @@ -104,6 +104,7 @@ mfbCreatePixmap (pScreen, width, height, depth, usage_hint) pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = datasize ? (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL; + pPixmap->usage_hint = usage_hint; return pPixmap; } @@ -114,6 +115,7 @@ mfbDestroyPixmap(pPixmap) { if(--pPixmap->refcnt) return TRUE; + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/mfb/mfbpolypnt.c b/mfb/mfbpolypnt.c index 1c4045126..146cfdce0 100644 --- a/mfb/mfbpolypnt.c +++ b/mfb/mfbpolypnt.c @@ -88,7 +88,8 @@ mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) if (!(pGC->planemask & 1)) return; - pGCPriv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + pGCPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); rop = pGCPriv->rop; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); diff --git a/mfb/mfbscrinit.c b/mfb/mfbscrinit.c index 6d364b76c..8873a1ba1 100644 --- a/mfb/mfbscrinit.c +++ b/mfb/mfbscrinit.c @@ -68,11 +68,11 @@ SOFTWARE. #include "servermd.h" #ifdef PIXMAP_PER_WINDOW -int frameWindowPrivateIndex; -int frameGetWindowPrivateIndex(void) { return frameWindowPrivateIndex; } +static DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey; +DevPrivateKey frameGetWindowPrivateKey(void) { return frameWindowPrivateKey; } #endif -int mfbGCPrivateIndex; -int mfbGetGCPrivateIndex(void) { return mfbGCPrivateIndex; } +static DevPrivateKey mfbGCPrivateKey = &mfbGCPrivateKey; +DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; } static unsigned long mfbGeneration = 0; static VisualRec visual = { @@ -88,23 +88,19 @@ static DepthRec depth = { }; Bool -mfbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) +mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) { if (mfbGeneration != serverGeneration) { -#ifdef PIXMAP_PER_WINDOW - frameWindowPrivateIndex = AllocateWindowPrivateIndex(); -#endif - mfbGCPrivateIndex = miAllocateGCPrivateIndex(); visual.vid = FakeClientID(0); VID = visual.vid; mfbGeneration = serverGeneration; } - if (pGCIndex) - *pGCIndex = mfbGCPrivateIndex; + if (pGCKey) + *pGCKey = mfbGCPrivateKey; pScreen->GetWindowPixmap = mfbGetWindowPixmap; pScreen->SetWindowPixmap = mfbSetWindowPixmap; - return AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC)); + return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC)); } @@ -154,7 +150,8 @@ mfbGetWindowPixmap(pWin) WindowPtr pWin; { #ifdef PIXMAP_PER_WINDOW - return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); + return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates, + frameWindowPrivateKey); #else ScreenPtr pScreen = pWin->drawable.pScreen; @@ -168,7 +165,7 @@ mfbSetWindowPixmap(pWin, pPix) PixmapPtr pPix; { #ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; + dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix); #else (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); #endif diff --git a/mfb/mfbwindow.c b/mfb/mfbwindow.c index 30b8857b1..37125da45 100644 --- a/mfb/mfbwindow.c +++ b/mfb/mfbwindow.c @@ -55,6 +55,7 @@ SOFTWARE. #include <X11/X.h> #include "scrnintstr.h" #include "windowstr.h" +#include "privates.h" #include "mfb.h" #include "mistruct.h" #include "regionstr.h" diff --git a/mfb/mfbzerarc.c b/mfb/mfbzerarc.c index 964e2f100..624e45fee 100644 --- a/mfb/mfbzerarc.c +++ b/mfb/mfbzerarc.c @@ -92,7 +92,8 @@ mfbZeroArcSS( PixelType pmask; register PixelType *paddr; - if (((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop == + if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop == RROP_BLACK) pixel = 0; else |