diff options
Diffstat (limited to 'hw/xprint/pcl')
-rw-r--r-- | hw/xprint/pcl/Pcl.h | 8 | ||||
-rw-r--r-- | hw/xprint/pcl/PclArc.c | 2 | ||||
-rw-r--r-- | hw/xprint/pcl/PclColor.c | 28 | ||||
-rw-r--r-- | hw/xprint/pcl/PclGC.c | 15 | ||||
-rw-r--r-- | hw/xprint/pcl/PclInit.c | 62 | ||||
-rw-r--r-- | hw/xprint/pcl/PclLine.c | 4 | ||||
-rw-r--r-- | hw/xprint/pcl/PclPixel.c | 8 | ||||
-rw-r--r-- | hw/xprint/pcl/PclPolygon.c | 6 | ||||
-rw-r--r-- | hw/xprint/pcl/PclPrint.c | 20 | ||||
-rw-r--r-- | hw/xprint/pcl/PclText.c | 4 | ||||
-rw-r--r-- | hw/xprint/pcl/PclWindow.c | 7 | ||||
-rw-r--r-- | hw/xprint/pcl/Pclmap.h | 10 |
12 files changed, 82 insertions, 92 deletions
diff --git a/hw/xprint/pcl/Pcl.h b/hw/xprint/pcl/Pcl.h index 0c50ed241..d46a03401 100644 --- a/hw/xprint/pcl/Pcl.h +++ b/hw/xprint/pcl/Pcl.h @@ -83,10 +83,10 @@ typedef char *XPointer; /****** * externally visible variables from PclInit.c ******/ -extern int PclScreenPrivateIndex, PclWindowPrivateIndex; -extern int PclContextPrivateIndex; -extern int PclPixmapPrivateIndex; -extern int PclGCPrivateIndex; +extern DevPrivateKey PclScreenPrivateKey, PclWindowPrivateKey; +extern DevPrivateKey PclContextPrivateKey; +extern DevPrivateKey PclPixmapPrivateKey; +extern DevPrivateKey PclGCPrivateKey; /****** * externally visible variables from PclAttVal.c diff --git a/hw/xprint/pcl/PclArc.c b/hw/xprint/pcl/PclArc.c index 0d8289e33..20d3f723d 100644 --- a/hw/xprint/pcl/PclArc.c +++ b/hw/xprint/pcl/PclArc.c @@ -85,7 +85,7 @@ PclDoArc( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); XpGetReproductionArea( pCon, &repro ); /* diff --git a/hw/xprint/pcl/PclColor.c b/hw/xprint/pcl/PclColor.c index 8b05da056..5e8ffa63c 100644 --- a/hw/xprint/pcl/PclColor.c +++ b/hw/xprint/pcl/PclColor.c @@ -129,8 +129,8 @@ PclCreateColormap(ColormapPtr pColor) PclCmapToContexts *new; PclScreenPrivPtr sPriv; - sPriv = (PclScreenPrivPtr)pColor->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); /* * Use existing code to initialize the values in the colormap @@ -175,8 +175,8 @@ PclDestroyColormap(ColormapPtr pColor) /* * Find the colormap <-> contexts mapping */ - sPriv = (PclScreenPrivPtr)pColor->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); pCmap = sPriv->colormaps; while( pCmap ) { @@ -195,8 +195,8 @@ PclDestroyColormap(ColormapPtr pColor) con = pCmap->contexts; while( con ) { - cPriv = con->context->devPrivates[PclContextPrivateIndex].ptr; - + cPriv = dixLookupPrivate(&con->context->devPrivates, + PclContextPrivateKey); pPal = cPriv->palettes; while( pPal ) { @@ -259,8 +259,8 @@ PclStoreColors(ColormapPtr pColor, char t[80]; int i; - sPriv = (PclScreenPrivPtr)pColor->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); p = sPriv->colormaps; while( p ) { @@ -278,8 +278,8 @@ PclStoreColors(ColormapPtr pColor, * For each context, get the palette ID and update the * appropriate palette. */ - cPriv = con->context - ->devPrivates[PclContextPrivateIndex].ptr; + cPriv = dixLookupPrivate(&con->context->devPrivates, + PclContextPrivateKey); pMap = PclFindPaletteMap( cPriv, pColor, NULL ); /* @@ -407,7 +407,8 @@ PclUpdateColormap(DrawablePtr pDrawable, unsigned short r, g, b, rr, gg, bb; int i; - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); c = wColormap( win ); cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP ); @@ -436,8 +437,9 @@ PclUpdateColormap(DrawablePtr pDrawable, /* * Add the colormap to the screen-level colormap<->context mapping. */ - sPriv = (PclScreenPrivPtr)cmap->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&cmap->pScreen->devPrivates, + PclScreenPrivateKey); pCmap = sPriv->colormaps; while( pCmap && ( pCmap->colormapId != cmap->mid ) ) pCmap = pCmap->next; diff --git a/hw/xprint/pcl/PclGC.c b/hw/xprint/pcl/PclGC.c index b47f2833a..fbadf5d5d 100644 --- a/hw/xprint/pcl/PclGC.c +++ b/hw/xprint/pcl/PclGC.c @@ -144,7 +144,8 @@ PclGetDrawablePrivateStuff( return FALSE; else { - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); *gc = cPriv->lastGC; *valid = cPriv->validGC; *file = cPriv->pPageFile; @@ -171,7 +172,8 @@ PclSetDrawablePrivateGC( { case DRAWABLE_PIXMAP: pix = (PixmapPtr)pDrawable; - pixPriv = pix->devPrivates[PclPixmapPrivateIndex].ptr; + pixPriv = (PclPixmapPrivPtr) + dixLookupPrivate(&pix->devPrivates, PclPixmapPrivateKey); pixPriv->lastGC = gc; pixPriv->validGC = 1; @@ -179,8 +181,8 @@ PclSetDrawablePrivateGC( case DRAWABLE_WINDOW: pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - pPriv = ((PclContextPrivPtr) - (pCon->devPrivates[PclContextPrivateIndex].ptr)); + pPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pPriv->validGC = 1; pPriv->lastGC = gc; @@ -316,13 +318,14 @@ PclUpdateDrawableGC( XpContextPtr pCon; PclContextPrivPtr cPriv; PclGCPrivPtr gcPriv = (PclGCPrivPtr) - (pGC->devPrivates[PclGCPrivateIndex].ptr); + dixLookupPrivate(&pGC->devPrivates, PclGCPrivateKey); if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) ) return FALSE; pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Here's where we update the colormap. Since there can be diff --git a/hw/xprint/pcl/PclInit.c b/hw/xprint/pcl/PclInit.c index 574b481d2..e738e3e54 100644 --- a/hw/xprint/pcl/PclInit.c +++ b/hw/xprint/pcl/PclInit.c @@ -67,11 +67,11 @@ static void AllocatePclPrivates(ScreenPtr pScreen); static int PclInitContext(XpContextPtr pCon); static Bool PclDestroyContext(XpContextPtr pCon); -int PclScreenPrivateIndex; -int PclContextPrivateIndex; -int PclPixmapPrivateIndex; -int PclWindowPrivateIndex; -int PclGCPrivateIndex; +DevPrivateKey PclScreenPrivateKey = &PclScreenPrivateKey; +DevPrivateKey PclContextPrivateKey = &PclContextPrivateKey; +DevPrivateKey PclPixmapPrivateKey = &PclPixmapPrivateKey; +DevPrivateKey PclWindowPrivateKey = &PclWindowPrivateKey; +DevPrivateKey PclGCPrivateKey = &PclGCPrivateKey; #ifdef XP_PCL_COLOR /* @@ -119,7 +119,8 @@ Bool PclCloseScreen(int index, ScreenPtr pScreen) { - PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr; + PclScreenPrivPtr pPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); pScreen->CloseScreen = pPriv->CloseScreen; xfree( pPriv ); @@ -157,8 +158,8 @@ InitializePclDriver( */ AllocatePclPrivates(pScreen); - pPriv = - (PclScreenPrivPtr)pScreen->devPrivates[PclScreenPrivateIndex].ptr; + pPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); maxDim = MAX( pScreen->height, pScreen->width ); xRes = pScreen->width / ( pScreen->mmWidth / 25.4 ); @@ -258,33 +259,13 @@ InitializePclDriver( static void AllocatePclPrivates(ScreenPtr pScreen) { - static unsigned long PclGeneration = 0; + dixRequestPrivate(PclWindowPrivateKey, sizeof( PclWindowPrivRec ) ); + dixRequestPrivate(PclContextPrivateKey, sizeof( PclContextPrivRec ) ); + dixRequestPrivate(PclGCPrivateKey, sizeof( PclGCPrivRec ) ); + dixRequestPrivate(PclPixmapPrivateKey, sizeof( PclPixmapPrivRec ) ); - if((unsigned long) PclGeneration != serverGeneration) - { - PclScreenPrivateIndex = AllocateScreenPrivateIndex(); - - PclWindowPrivateIndex = AllocateWindowPrivateIndex(); - AllocateWindowPrivate( pScreen, PclWindowPrivateIndex, - sizeof( PclWindowPrivRec ) ); - - PclContextPrivateIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate( PclContextPrivateIndex, - sizeof( PclContextPrivRec ) ); - - PclGCPrivateIndex = AllocateGCPrivateIndex(); - AllocateGCPrivate( pScreen, PclGCPrivateIndex, - sizeof( PclGCPrivRec ) ); - - PclPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex, - sizeof( PclPixmapPrivRec ) ); - - PclGeneration = serverGeneration; - } - - pScreen->devPrivates[PclScreenPrivateIndex].ptr = (pointer)xalloc( - sizeof(PclScreenPrivRec)); + dixSetPrivate(&pScreen->devPrivates, PclScreenPrivateKey, + xalloc(sizeof(PclScreenPrivRec))); } /* @@ -347,8 +328,8 @@ PclInitContext(XpContextPtr pCon) /* * Set up the context privates */ - pConPriv = - (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr; + pConPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pConPriv->jobFileName = (char *)NULL; pConPriv->pageFileName = (char *)NULL; @@ -481,7 +462,7 @@ static Bool PclDestroyContext(XpContextPtr pCon) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); PclPaletteMapPtr p, t; PclCmapToContexts *pCmap; ScreenPtr screen; @@ -539,7 +520,8 @@ PclDestroyContext(XpContextPtr pCon) * Remove the context from the screen-level colormap<->contexts mappings */ screen = screenInfo.screens[pCon->screenNum]; - sPriv = (PclScreenPrivPtr)screen->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&screen->devPrivates, PclScreenPrivateKey); pCmap = sPriv->colormaps; while( pCmap ) { @@ -581,8 +563,8 @@ PclGetContextFromWindow(WindowPtr win) while( win ) { - pPriv = - (PclWindowPrivPtr)win->devPrivates[PclWindowPrivateIndex].ptr; + pPriv = (PclWindowPrivPtr) + dixLookupPrivate(&win->devPrivates, PclWindowPrivateKey); if( pPriv->validContext ) return pPriv->context; diff --git a/hw/xprint/pcl/PclLine.c b/hw/xprint/pcl/PclLine.c index 52a586d17..68d55a525 100644 --- a/hw/xprint/pcl/PclLine.c +++ b/hw/xprint/pcl/PclLine.c @@ -107,7 +107,7 @@ PclPolyLine( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage required to deal with the clipping @@ -223,7 +223,7 @@ PclPolySegment( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage for the temporary regions. diff --git a/hw/xprint/pcl/PclPixel.c b/hw/xprint/pcl/PclPixel.c index f41af272f..d219838f0 100644 --- a/hw/xprint/pcl/PclPixel.c +++ b/hw/xprint/pcl/PclPixel.c @@ -125,13 +125,15 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints ) if( pDrawable->type == DRAWABLE_WINDOW ) { pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); cPriv->changeMask = GCLineWidth | GCLineStyle; } else { - pPriv = - ((PixmapPtr)pDrawable)->devPrivates[PclPixmapPrivateIndex].ptr; + pPriv = (PclPixmapPrivPtr) + dixLookupPrivate(&((PixmapPtr)pDrawable)->devPrivates, + PclPixmapPrivateKey); pPriv->changeMask = GCLineWidth | GCLineStyle; } #endif diff --git a/hw/xprint/pcl/PclPolygon.c b/hw/xprint/pcl/PclPolygon.c index 9867758bb..7d95d6484 100644 --- a/hw/xprint/pcl/PclPolygon.c +++ b/hw/xprint/pcl/PclPolygon.c @@ -76,7 +76,7 @@ PclPolyRectangle( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage required to deal with the clipping @@ -170,7 +170,7 @@ PclFillPolygon( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Generate the PCL code to draw the filled polygon, by defining @@ -283,7 +283,7 @@ PclPolyFillRect( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage required to deal with the clipping diff --git a/hw/xprint/pcl/PclPrint.c b/hw/xprint/pcl/PclPrint.c index 176a0025a..ac8ea1537 100644 --- a/hw/xprint/pcl/PclPrint.c +++ b/hw/xprint/pcl/PclPrint.c @@ -72,8 +72,8 @@ PclStartJob( Bool sendClientData, ClientPtr client) { - PclContextPrivPtr pConPriv = - (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr; + PclContextPrivPtr pConPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); PclPaletteMap *pal; /* @@ -130,7 +130,7 @@ PclEndJob( Bool cancel) { PclContextPrivPtr priv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); #ifdef CCP_DEBUG FILE *xpoutput; @@ -250,9 +250,9 @@ PclStartPage( WindowPtr pWin) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; - PclWindowPrivPtr pWinPriv = - (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); + PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); xRectangle repro; char t[80]; XpOid orient, plex, tray, medium; @@ -488,7 +488,7 @@ PclEndPage( WindowPtr pWin) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); struct stat statBuf; @@ -532,7 +532,7 @@ PclStartDoc(XpContextPtr pCon, XPDocumentType type) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); #ifndef XP_PCL_LJ3 /* @@ -592,7 +592,7 @@ PclDocumentData( { int type = 0; PclContextPrivPtr pPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); XpOidDocFmtList *formats; XpOidDocFmt *f; char t[80]; @@ -700,7 +700,7 @@ PclGetDocumentData( int maxBufferSize) { PclContextPrivPtr pPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pPriv->getDocClient = client; pPriv->getDocBufSize = maxBufferSize; diff --git a/hw/xprint/pcl/PclText.c b/hw/xprint/pcl/PclText.c index 246c0195b..324de3014 100644 --- a/hw/xprint/pcl/PclText.c +++ b/hw/xprint/pcl/PclText.c @@ -123,7 +123,7 @@ char font_type; pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pSoftFontInfo = pConPriv->pSoftFontInfo; font_type = isInternal(pGC->font); if ( font_type == DOWNLOAD_FONT ) { @@ -293,7 +293,7 @@ char font_type; pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pSoftFontInfo = pConPriv->pSoftFontInfo; font_type = isInternal(pGC->font); diff --git a/hw/xprint/pcl/PclWindow.c b/hw/xprint/pcl/PclWindow.c index f34ad7feb..a87dc0e7a 100644 --- a/hw/xprint/pcl/PclWindow.c +++ b/hw/xprint/pcl/PclWindow.c @@ -97,9 +97,9 @@ PclCreateWindow( Bool status = Success; ScreenPtr pScreen = pWin->drawable.pScreen; PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr) - pScreen->devPrivates[PclScreenPrivateIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr) - pWin->devPrivates[PclWindowPrivateIndex].ptr; + dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); /* * Initialize this window's private struct. @@ -142,7 +142,8 @@ PclCreateWindow( /* * Invalidate the window's private print context. */ - pPriv = (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr; + pPriv = (PclWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); pPriv->validContext = 0; return TRUE; diff --git a/hw/xprint/pcl/Pclmap.h b/hw/xprint/pcl/Pclmap.h index 3990ab294..18ac31d90 100644 --- a/hw/xprint/pcl/Pclmap.h +++ b/hw/xprint/pcl/Pclmap.h @@ -82,11 +82,11 @@ copyright holders. #define InitializePclDriver CATNAME(Initialize, PclDriver) #define PclCloseScreen PCLNAME(CloseScreen) #define PclGetContextFromWindow PCLNAME(GetContextFromWindow) -#define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex) -#define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex) -#define PclContextPrivateIndex PCLNAME(ContextPrivateIndex) -#define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex) -#define PclGCPrivateIndex PCLNAME(GCPrivateIndex) +#define PclScreenPrivateKey PCLNAME(ScreenPrivateKey) +#define PclWindowPrivateKey PCLNAME(WindowPrivateKey) +#define PclContextPrivateKey PCLNAME(ContextPrivateKey) +#define PclPixmapPrivateKey PCLNAME(PixmapPrivateKey) +#define PclGCPrivateKey PCLNAME(GCPrivateKey) /* PclPrint.c */ #define PclStartJob PCLNAME(StartJob) |