diff options
Diffstat (limited to 'Xprint/pcl')
-rw-r--r-- | Xprint/pcl/Pcl.h | 115 | ||||
-rw-r--r-- | Xprint/pcl/PclArc.c | 56 | ||||
-rw-r--r-- | Xprint/pcl/PclArea.c | 129 | ||||
-rw-r--r-- | Xprint/pcl/PclColor.c | 36 | ||||
-rw-r--r-- | Xprint/pcl/PclCursor.c | 53 | ||||
-rw-r--r-- | Xprint/pcl/PclGC.c | 146 | ||||
-rw-r--r-- | Xprint/pcl/PclInit.c | 111 | ||||
-rw-r--r-- | Xprint/pcl/PclLine.c | 96 | ||||
-rw-r--r-- | Xprint/pcl/PclMisc.c | 11 | ||||
-rw-r--r-- | Xprint/pcl/PclPixel.c | 7 | ||||
-rw-r--r-- | Xprint/pcl/PclPixmap.c | 11 | ||||
-rw-r--r-- | Xprint/pcl/PclPolygon.c | 141 | ||||
-rw-r--r-- | Xprint/pcl/PclPrint.c | 80 | ||||
-rw-r--r-- | Xprint/pcl/PclSFonts.c | 12 | ||||
-rw-r--r-- | Xprint/pcl/PclSpans.c | 61 | ||||
-rw-r--r-- | Xprint/pcl/PclText.c | 134 | ||||
-rw-r--r-- | Xprint/pcl/PclWindow.c | 14 | ||||
-rw-r--r-- | Xprint/pcl/Pclmap.h | 214 |
18 files changed, 703 insertions, 724 deletions
diff --git a/Xprint/pcl/Pcl.h b/Xprint/pcl/Pcl.h index 0f744eafe..0532e1fcc 100644 --- a/Xprint/pcl/Pcl.h +++ b/Xprint/pcl/Pcl.h @@ -11,7 +11,7 @@ ** * Created: 1/30/95 ** * ** ********************************************************* -** +** ********************************************************************/ /* (c) Copyright 1996 Hewlett-Packard Company @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pcl.h,v 1.12 2001/12/21 21:02:05 dawes Exp $ */ #ifndef _PCL_H_ #define _PCL_H_ @@ -51,25 +52,12 @@ copyright holders. #include <stdio.h> #include "scrnintstr.h" -/* -#include "X.h" -#include "Xproto.h" -#include "Xatom.h" -#include "misc.h" -#include "screenint.h" -#include "colormapst.h" -#include "windowstr.h" -#include "propertyst.h" -#include "servermd.h" */ /* needed for IMAGE_BUFSIZE */ - #include "PclDef.h" #include "Pclmap.h" #include "PclSFonts.h" -#define _XP_PRINT_SERVER_ -#include "Print.h" -#include "extensions/Printstr.h" -#undef _XP_PRINT_SERVER_ +#include <X11/extensions/Print.h> +#include <X11/extensions/Printstr.h> #include "miscstruct.h" #include "fontstruct.h" @@ -79,13 +67,16 @@ copyright holders. /* * Some sleazes to force the XrmDB stuff into the server */ +#ifndef HAVE_XPointer typedef char *XPointer; +#endif #define Status int #define True 1 #define False 0 #include "misc.h" -#include <Xfuncproto.h> -#include "../Xresource.h" +#include <X11/Xfuncproto.h> +#include <X11/Xresource.h> +#include "attributes.h" /****** * externally visible variables from PclInit.c @@ -95,6 +86,11 @@ extern int PclContextPrivateIndex; extern int PclPixmapPrivateIndex; extern int PclGCPrivateIndex; +/****** + * externally visible variables from PclAttVal.c + ******/ +extern XpValidatePoolsRec PclValidatePoolsRec; + /* * This structure defines a mapping from an X colormap ID to a list of * print contexts which use the colormap. @@ -159,8 +155,6 @@ typedef struct { } PclWindowPrivRec, *PclWindowPrivPtr; typedef struct { - unsigned freeCompClip; - RegionPtr pCompositeClip; unsigned long stippleFg, stippleBg; } PclGCPrivRec, *PclGCPrivPtr; @@ -191,7 +185,9 @@ typedef struct { #endif /* XP_PCL_LJ3 */ #define MIN(a,b) (((a)<(b))?(a):(b)) +#ifndef MAX #define MAX(a,b) (((a)>(b))?(a):(b)) +#endif /****** * Functions in PclArc.c @@ -247,18 +243,18 @@ RegionPtr PclCopyPlane( /****** * Functions in PclAttr.c ******/ -extern char *PclGetAttributes( +extern char *PclGetAttributes( XpContextPtr pCon, XPAttributes pool ); extern char *PclGetOneAttribute( XpContextPtr pCon, XPAttributes pool, char *attr ); -extern int PclAugmentAttributes( +extern int PclAugmentAttributes( XpContextPtr pCon, XPAttributes pool, char *attrs ); -extern int PclSetAttributes( +extern int PclSetAttributes( XpContextPtr pCon, XPAttributes pool, char *attrs ); @@ -284,6 +280,16 @@ extern int PclUpdateColormap(DrawablePtr pDrawable, XpContextPtr pCon, GCPtr gc, FILE *outFile); +extern void PclLookUp(ColormapPtr cmap, + PclContextPrivPtr cPriv, + unsigned short *r, + unsigned short *g, + unsigned short *b); +extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv, + ColormapPtr cmap, + GCPtr gc); +extern unsigned char *PclReadMap(char *, int *); + /****** * Functions in PclCursor.c @@ -316,6 +322,27 @@ extern Bool PclSetCursorPosition( Bool generateEvent); /****** + * Functions in PclSFonts.c + ******/ +extern void +PclDownloadSoftFont8( + FILE *fp, + PclSoftFontInfoPtr pSoftFontInfo, + PclFontHead8Ptr pfh, + PclCharDataPtr pcd, + unsigned char *code); +extern void PclDownloadSoftFont16( + FILE *fp, + PclSoftFontInfoPtr pSoftFontInfo, + PclFontHead16Ptr pfh, + PclCharDataPtr pcd, + unsigned char row, + unsigned char col); +extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void); +extern void PclDestroySoftFontInfo( + PclSoftFontInfoPtr pSoftFontInfo ); + +/****** * Functions in PclGC.c ******/ extern Bool PclCreateGC(GCPtr pGC); @@ -326,7 +353,7 @@ extern int PclUpdateDrawableGC( FILE **outFile); extern void PclValidateGC( GCPtr pGC, - Mask changes, + unsigned long changes, DrawablePtr pDrawable); extern void PclSetDrawablePrivateStuff( DrawablePtr pDrawable, @@ -336,16 +363,34 @@ extern int PclGetDrawablePrivateStuff( GC *gc, unsigned long *valid, FILE **file ); - +extern void PclSetDrawablePrivateGC( + DrawablePtr pDrawable, + GC gc); +extern void PclComputeCompositeClip( + GCPtr pGC, + DrawablePtr pDrawable); + /****** * Functions in PclInit.c ******/ -extern Bool InitializePclDriver( +extern Bool PclCloseScreen( + int index, + ScreenPtr pScreen); +extern Bool InitializeColorPclDriver( + int ndx, + ScreenPtr pScreen, + int argc, + char **argv); +extern Bool InitializeMonoPclDriver( + int ndx, + ScreenPtr pScreen, + int argc, + char **argv); +extern Bool InitializeLj3PclDriver( int ndx, ScreenPtr pScreen, int argc, char **argv); -static Bool PclDestroyContext( XpContextPtr pCon ); extern XpContextPtr PclGetContextFromWindow( WindowPtr win ); /****** @@ -380,6 +425,12 @@ extern int PclGetMediumDimensions( extern int PclGetReproducibleArea( XpContextPtr pCon, xRectangle *pRect); +extern void PclSendData( + FILE *outFile, + PclContextPrivPtr pConPriv, + BoxPtr pbox, + int nbox, + double ratio); /****** * Functions in PclPixel.c @@ -508,7 +559,6 @@ extern Bool PclPositionWindow( int x, int y); extern Bool PclUnmapWindow(WindowPtr pWindow); -extern Bool PclUnmapWindow(WindowPtr pWindow); extern void PclCopyWindow( WindowPtr pWin, DDXPointRec ptOldOrg, @@ -569,12 +619,3 @@ extern int PclGetDocumentData( #endif /* _PCL_H_ */ - - - - - - - - - diff --git a/Xprint/pcl/PclArc.c b/Xprint/pcl/PclArc.c index ffdf32907..ca13b3a84 100644 --- a/Xprint/pcl/PclArc.c +++ b/Xprint/pcl/PclArc.c @@ -45,6 +45,8 @@ dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArc.c,v 1.5 2001/01/17 22:36:30 dawes Exp $ */ + #include <stdio.h> #include <math.h> #include <errno.h> @@ -52,14 +54,15 @@ copyright holders. #include "Pcl.h" #include "gcstruct.h" #include "windowstr.h" +#include "attributes.h" static void -PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt ) - DrawablePtr pDrawable; - GCPtr pGC; - int nArcs; - xArc *pArcs; - void (*DoIt)(); +PclDoArc( + DrawablePtr pDrawable, + GCPtr pGC, + int nArcs, + xArc *pArcs, + void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc)) { char t[80]; FILE *outFile; @@ -140,7 +143,7 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt ) r.y1 = -Arc.height / 2 - fudge; r.x2 = Arc.width / 2 + fudge; r.y2 = Arc.height / 2 + fudge; - drawRegion = miRegionCreate( &r, 0 ); + drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 ); SAVE_PCL( outFile, pConPriv, "\033%0A" ); MACRO_END( outFile ); @@ -148,14 +151,13 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt ) /* * Intersect the bounding box with the clip region. */ - region = miRegionCreate( NULL, 0 ); - transClip = miRegionCreate( NULL, 0 ); - miRegionCopy( transClip, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); - miTranslateRegion( transClip, -(xoffset + Arc.x + Arc.width / 2), + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); + transClip = REGION_CREATE( pGC->pScreen, NULL, 0 ); + REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip ); + REGION_TRANSLATE( pGC->pScreen, transClip, + -(xoffset + Arc.x + Arc.width / 2), -(yoffset + Arc.y + Arc.height / 2) ); - miIntersect( region, drawRegion, transClip ); + REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip ); /* * For each rectangle in the clip region, set the HP-GL/2 "input @@ -177,9 +179,9 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt ) /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); - miRegionDestroy( transClip ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); + REGION_DESTROY( pGC->pScreen, transClip ); } } @@ -202,11 +204,11 @@ DrawArc(FILE *outFile, } void -PclPolyArc( pDrawable, pGC, nArcs, pArcs ) - DrawablePtr pDrawable; - GCPtr pGC; - int nArcs; - xArc *pArcs; +PclPolyArc( + DrawablePtr pDrawable, + GCPtr pGC, + int nArcs, + xArc *pArcs) { PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc ); } @@ -246,11 +248,11 @@ DoChord(FILE *outFile, void -PclPolyFillArc( pDrawable, pGC, nArcs, pArcs ) - DrawablePtr pDrawable; - GCPtr pGC; - int nArcs; - xArc *pArcs; +PclPolyFillArc( + DrawablePtr pDrawable, + GCPtr pGC, + int nArcs, + xArc *pArcs) { switch( pGC->arcMode ) { diff --git a/Xprint/pcl/PclArea.c b/Xprint/pcl/PclArea.c index da3107d5a..971506da6 100644 --- a/Xprint/pcl/PclArea.c +++ b/Xprint/pcl/PclArea.c @@ -11,7 +11,7 @@ ** * Created: 10/23/95 ** * ** ********************************************************* -** +** ********************************************************************/ /* (c) Copyright 1996 Hewlett-Packard Company @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArea.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */ #include <stdio.h> #include <sys/types.h> @@ -53,6 +54,9 @@ copyright holders. #include "region.h" #include "cfb.h" +#if 1 +#include "cfb32.h" +#endif void PclPutImage(DrawablePtr pDrawable, @@ -72,10 +76,10 @@ PclPutImage(DrawablePtr pDrawable, unsigned long oldPlanemask; unsigned long i; long bytesPer; - + if( ( w == 0 ) || ( h == 0 ) ) return; - + if( format != XYPixmap ) { pPixmap = GetScratchPixmapHeader( pDrawable->pScreen, @@ -85,7 +89,7 @@ PclPutImage(DrawablePtr pDrawable, depth ), (pointer)pImage ); if( !pPixmap ) return; - + if( format == ZPixmap ) (void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC, leftPad, 0, w, h, x, y ); @@ -104,7 +108,7 @@ PclPutImage(DrawablePtr pDrawable, if( !pPixmap ) return; - + depth = pGC->depth; oldPlanemask = pGC->planemask; oldFg = pGC->fgPixel; @@ -113,12 +117,11 @@ PclPutImage(DrawablePtr pDrawable, gcv[1] = 0; DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 ); bytesPer = (long)h * BitmapBytePad( w + leftPad ); - + for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer ) { if( i & oldPlanemask ) { - extern void cfbPutImage(), cfb32PutImage(); gcv[0] = i; DoChangeGC( pGC, GCPlaneMask, gcv, 0 ); ValidateGC( pDrawable, pGC ); @@ -160,16 +163,16 @@ PclMonoPixmapFragment(FILE *outFile, { char *bits, t[80], *row; int h, w, i; - + /* * Create a storage area large enough to hold the entire pixmap, - * then use mfbGetImage to get the appropriate bits. + * then use mfbGetImage to get the appropriate bits. */ h = y2 - y1; w = BitmapBytePad( x2 - x1 ); - + bits = (char *)xalloc( h * w ); - mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, + mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, XYPixmap, ~0, bits ); /* @@ -179,7 +182,7 @@ PclMonoPixmapFragment(FILE *outFile, */ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty ); SEND_PCL( outFile, t ); - + /* * Now, wrap the raster in the appropriate PCL code. Right now, * it's going to go down the wire without any compression. That @@ -188,14 +191,14 @@ PclMonoPixmapFragment(FILE *outFile, sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M", h, x2 - x1 ); SEND_PCL( outFile, t ); - + sprintf( t, "\033*b%dW", w ); for( row = bits, i = 0; i <= h; i++, row += w ) { SEND_PCL( outFile, t ); SEND_PCL_COUNT( outFile, row, w ); } - + SEND_PCL( outFile, "\033*rC" ); /* @@ -216,21 +219,20 @@ PclColorPixmapFragment(FILE *outFile, { char *bits, t[80], *row; int h, w, i; - extern void cfbGetImage(), cfb32GetImage(); - + /* * Create a storage area large enough to hold the entire pixmap, - * then use cfbGetImage to get the appropriate bits. + * then use cfbGetImage to get the appropriate bits. */ h = y2 - y1; w = PixmapBytePad( x2 - x1, pix->drawable.depth ); - + bits = (char *)xalloc( h * w ); if (pix->drawable.depth <= 8) - cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, + cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, ZPixmap, ~0, bits ); else if (pix->drawable.depth <= 32) - cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, + cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, ZPixmap, ~0, bits ); /* @@ -249,16 +251,16 @@ PclColorPixmapFragment(FILE *outFile, sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M", h, x2 - x1 ); SEND_PCL( outFile, t ); - + sprintf( t, "\033*b%dW", w ); for( row = bits, i = 0; i < h; i++, row += w ) { SEND_PCL( outFile, t ); SEND_PCL_COUNT( outFile, row, w ); } - + SEND_PCL( outFile, "\033*rC" ); - + /* * Clean things up a bit */ @@ -277,22 +279,20 @@ PclCopyArea(DrawablePtr pSrc, int dsty) { PixmapPtr pixSrc = (PixmapPtr)pSrc; - char t[80]; - FILE *srcFile, *dstFile; - GC srcGC, dstGC; +/* + FILE *srcFile; + GC srcGC; +*/ + FILE *dstFile; + GC dstGC; unsigned long valid; - struct stat statBuf; - XpContextPtr pCon; - xRectangle repro; - PclPixmapPrivPtr pPriv; RegionPtr drawRegion, region, whole, ret; BoxRec box; BoxPtr prect; int nrect; void (*doFragment)(FILE *, PixmapPtr, short, short, short, short, short, short ); - extern RegionPtr mfbCopyArea(), cfbCopyArea(), cfb32CopyArea(); - + /* * Since we don't store any information on a per-window basis, we * can't copy from a window. @@ -321,7 +321,7 @@ PclCopyArea(DrawablePtr pSrc, PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile ); */ PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile ); - + /* * If we're copying to a window, we have to do some actual * drawing, instead of just handing it off to mfb or cfb. Start @@ -331,14 +331,11 @@ PclCopyArea(DrawablePtr pSrc, box.y1 = srcy; box.x2 = srcx + width; box.y2 = srcy + height; - drawRegion = miRegionCreate( &box, 0 ); - miTranslateRegion( drawRegion, dstx, dsty ); - - region = miRegionCreate( NULL, 0 ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr) - (pGC->devPrivates[PclGCPrivateIndex].ptr)) - ->pCompositeClip ); + drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 ); + REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty ); + + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); + REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); /* * Now select the operation to be performed on each box in the @@ -348,7 +345,7 @@ PclCopyArea(DrawablePtr pSrc, doFragment = PclMonoPixmapFragment; else doFragment = PclColorPixmapFragment; - + /* * Actually draw each section of the bitmap. */ @@ -360,18 +357,18 @@ PclCopyArea(DrawablePtr pSrc, (*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx, prect->y1 - dsty, prect->x2 - dstx, prect->y2 - dsty, prect->x1, prect->y1 ); - + nrect--; prect++; } - + /* * Update the destination's GC to the source's GC. */ /* PclSetDrawablePrivateGC( pDst, srcGC ); */ - + /* * Determine the region that needs to be returned. This is the * region of the source that falls outside the boundary of the @@ -381,24 +378,24 @@ PclCopyArea(DrawablePtr pSrc, box.y1 = 0; box.x2 = pixSrc->drawable.width; box.y2 = pixSrc->drawable.height; - whole = miRegionCreate( &box, 0 ); - ret = miRegionCreate( NULL, 0 ); - - miTranslateRegion( drawRegion, -dstx, -dsty ); - miSubtract( ret, drawRegion, whole ); - + whole = REGION_CREATE( pGC->pScreen, &box, 0 ); + ret = REGION_CREATE( pGC->pScreen, NULL, 0 ); + + REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty ); + REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole ); + /* * Clean up the regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); - miRegionDestroy( whole ); - - if( miRegionNotEmpty( ret ) ) + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); + REGION_DESTROY( pGC->pScreen, whole ); + + if( REGION_NOTEMPTY( pGC->pScreen, ret ) ) return ret; else { - miRegionDestroy( ret ); + REGION_DESTROY( pGC->pScreen, ret ); return NULL; } } @@ -418,20 +415,19 @@ PclCopyPlane(DrawablePtr pSrc, RegionPtr reg; GCPtr scratchGC; PixmapPtr scratchPix; - extern RegionPtr mfbCopyPlane(), cfbCopyPlane(), cfb32CopyPlane(); - + /* * Since we don't store PCL on a per-window basis, there's no good * way to copy from a window. */ if( pSrc->type == DRAWABLE_WINDOW ) return NULL; - + /* * Copying from a pixmap to a pixmap is already implemented by * mfb/cfb. */ - if( pSrc->type == DRAWABLE_PIXMAP && + if( pSrc->type == DRAWABLE_PIXMAP && pDst->type == DRAWABLE_PIXMAP ) { if( pDst->depth == 1 ) @@ -452,7 +448,7 @@ PclCopyPlane(DrawablePtr pSrc, */ scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width, height, pDst->depth ); - + scratchGC = GetScratchGC( pDst->depth, pDst->pScreen ); CopyGC( pGC, scratchGC, ~0L ); @@ -474,14 +470,13 @@ PclCopyPlane(DrawablePtr pSrc, cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, srcx, srcy, width, height, 0, 0, plane ); } - + reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width, height, dstx, dsty ); - + FreeScratchGC( scratchGC ); - + (*pDst->pScreen->DestroyPixmap)( scratchPix ); - + return reg; } - diff --git a/Xprint/pcl/PclColor.c b/Xprint/pcl/PclColor.c index cd3d2cc12..807e711de 100644 --- a/Xprint/pcl/PclColor.c +++ b/Xprint/pcl/PclColor.c @@ -45,10 +45,12 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclColor.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <math.h> @@ -58,18 +60,7 @@ copyright holders. #include "resource.h" #include "Pcl.h" - -PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv, - ColormapPtr cmap, - GCPtr gc); - -unsigned char *PclReadMap(char *, int *); - -void PclLookUp( ColormapPtr cmap, - PclContextPrivPtr cPriv, - unsigned short *r, - unsigned short *g, - unsigned short *b); +#include "cfb.h" static void lookup(unsigned char *src, unsigned char *dst, @@ -166,7 +157,7 @@ void PclDestroyColormap(ColormapPtr pColor) { PclScreenPrivPtr sPriv; - PclCmapToContexts *pCmap, *tCmap; + PclCmapToContexts *pCmap, *tCmap = 0; PclContextListPtr con, tCon; PclContextPrivPtr cPriv; PclPaletteMapPtr pPal; @@ -263,7 +254,7 @@ PclStoreColors(ColormapPtr pColor, PclContextListPtr con; PclContextPrivPtr cPriv; PclPaletteMapPtr pMap; - char t[80], t2[30]; + char t[80]; int i; sPriv = (PclScreenPrivPtr)pColor->pScreen @@ -425,7 +416,7 @@ PclUpdateColormap(DrawablePtr pDrawable, * If the requested colormap is already active, nothing needs to * be done. */ - return; + return FALSE; /* * Now we activate the palette in the printer @@ -478,10 +469,10 @@ PclUpdateColormap(DrawablePtr pDrawable, SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); /* Now program the two colors */ - sprintf( t, "\033*v0a0b0c%dI", cmap->pScreen->blackPixel ); + sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel ); SEND_PCL( cPriv->pPageFile, t ); - sprintf( t, "\033*v32767a32767b32767c%dI", - cmap->pScreen->whitePixel ); + sprintf( t, "\033*v32767a32767b32767c%ldI", + (long) cmap->pScreen->whitePixel ); SEND_PCL( cPriv->pPageFile, t ); #endif /* XP_PCL_COLOR */ } @@ -637,6 +628,7 @@ PclUpdateColormap(DrawablePtr pDrawable, } pMap->downloaded = 1; } + return TRUE; } @@ -725,7 +717,7 @@ unsigned char *PclReadMap(char *name, int *dim) fseek(fp, 0, SEEK_SET); - if (fread(data, sizeof(char), size, fp) != size) { + if (fread(data, sizeof(char), size, fp) != (unsigned) size) { fclose(fp); free(data); return(NULL); @@ -746,11 +738,11 @@ unsigned char *PclReadMap(char *name, int *dim) static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim) { int i; - unsigned char *p1, *p2, *p3; - int shift, offset; #define _INTERPOLATE #ifndef _INTERPOLATE + unsigned char *p1, *p2, *p3; + for (i=0; i<num; i++) { p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3; *dst++ = *p1++; @@ -794,7 +786,7 @@ static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, in d000, d001, d010, d011, d100, d101, d110, d111, dx00, dx01, dx10, dx11, - dxy0, dxy1, dxyz; + dxy0, dxy1; float scale; scale = 255.0 / (dim-1); diff --git a/Xprint/pcl/PclCursor.c b/Xprint/pcl/PclCursor.c index 88a76f6bf..7e463d498 100644 --- a/Xprint/pcl/PclCursor.c +++ b/Xprint/pcl/PclCursor.c @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclCursor.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */ #include <stdio.h> @@ -52,59 +53,59 @@ copyright holders. #include "windowstr.h" void -PclConstrainCursor( pScreen, pBox ) - ScreenPtr pScreen; - BoxPtr pBox; +PclConstrainCursor( + ScreenPtr pScreen, + BoxPtr pBox) { } void -PclCursorLimits( pScreen, pCursor, pHotBox, pTopLeftBox ) - ScreenPtr pScreen; - CursorPtr pCursor; - BoxPtr pHotBox; - BoxPtr pTopLeftBox; +PclCursorLimits( + ScreenPtr pScreen, + CursorPtr pCursor, + BoxPtr pHotBox, + BoxPtr pTopLeftBox) { } Bool -PclDisplayCursor( pScreen, pCursor ) - ScreenPtr pScreen; - CursorPtr pCursor; +PclDisplayCursor( + ScreenPtr pScreen, + CursorPtr pCursor) { return True; } Bool -PclRealizeCursor( pScreen, pCursor ) - ScreenPtr pScreen; - CursorPtr pCursor; +PclRealizeCursor( + ScreenPtr pScreen, + CursorPtr pCursor) { return True; } Bool -PclUnrealizeCursor( pScreen, pCursor ) - ScreenPtr pScreen; - CursorPtr pCursor; +PclUnrealizeCursor( + ScreenPtr pScreen, + CursorPtr pCursor) { return True; } void -PclRecolorCursor( pScreen, pCursor, displayed ) - ScreenPtr pScreen; - CursorPtr pCursor; - Bool displayed; +PclRecolorCursor( + ScreenPtr pScreen, + CursorPtr pCursor, + Bool displayed) { } Bool -PclSetCursorPosition( pScreen, x, y, generateEvent ) - ScreenPtr pScreen; - int x; - int y; - Bool generateEvent; +PclSetCursorPosition( + ScreenPtr pScreen, + int x, + int y, + Bool generateEvent) { return True; } diff --git a/Xprint/pcl/PclGC.c b/Xprint/pcl/PclGC.c index 7f0039e1f..e1fe772bd 100644 --- a/Xprint/pcl/PclGC.c +++ b/Xprint/pcl/PclGC.c @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclGC.c,v 1.10 2001/10/28 03:32:54 tsi Exp $ */ #include "gcstruct.h" @@ -51,6 +52,8 @@ copyright holders. #include "pixmapstr.h" #include "colormapst.h" #include "windowstr.h" +#include "cfb.h" +#include "cfb32.h" #include "migc.h" #include "scrnintstr.h" #include "resource.h" @@ -97,11 +100,8 @@ static GCFuncs PclGCFuncs = ; Bool -PclCreateGC( pGC ) - GCPtr pGC; +PclCreateGC(GCPtr pGC) { - PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr; - if( pGC->depth == 1 ) { if( mfbCreateGC( pGC ) == FALSE ) @@ -125,36 +125,25 @@ PclCreateGC( pGC ) pGC->ops = &PclGCOps; pGC->funcs = &PclGCFuncs; - pPriv->pCompositeClip = NULL; - pPriv->freeCompClip = FALSE; - return TRUE; } void PclDestroyGC(GCPtr pGC) { - PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr; - extern int mfbGCPrivateIndex; - /* Handle the mfb and cfb, which share a GC private struct */ - miRegisterGCPrivateIndex( mfbGCPrivateIndex ); miDestroyGC( pGC ); - - if( pPriv->freeCompClip == TRUE ) - REGION_DESTROY( pGC->pScreen, pPriv->pCompositeClip ); } int -PclGetDrawablePrivateStuff( pDrawable, gc, valid, file ) - DrawablePtr pDrawable; - GC *gc; - unsigned long *valid; - FILE **file; +PclGetDrawablePrivateStuff( + DrawablePtr pDrawable, + GC *gc, + unsigned long *valid, + FILE **file) { XpContextPtr pCon; - PclPixmapPrivPtr pPriv; PclContextPrivPtr cPriv; switch( pDrawable->type ) @@ -185,9 +174,9 @@ PclGetDrawablePrivateStuff( pDrawable, gc, valid, file ) } void -PclSetDrawablePrivateGC( pDrawable, gc ) - DrawablePtr pDrawable; - GC gc; +PclSetDrawablePrivateGC( + DrawablePtr pDrawable, + GC gc) { PixmapPtr pix; XpContextPtr pCon; @@ -332,19 +321,17 @@ PclSendPattern(char *bits, } int -PclUpdateDrawableGC( pGC, pDrawable, outFile ) - GCPtr pGC; - DrawablePtr pDrawable; - FILE **outFile; +PclUpdateDrawableGC( + GCPtr pGC, + DrawablePtr pDrawable, + FILE **outFile) { - Mask drawableMask, changeMask = 0; + Mask changeMask = 0; GC dGC; unsigned long valid; int i; XpContextPtr pCon; PclContextPrivPtr cPriv; - Colormap c; - ColormapPtr cmap; PclGCPrivPtr gcPriv = (PclGCPrivPtr) (pGC->devPrivates[PclGCPrivateIndex].ptr); @@ -403,12 +390,14 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) changeMask |= GCTileStipYOrigin; if( dGC.numInDashList == pGC->numInDashList ) + { for( i = 0; i < dGC.numInDashList; i++ ) if( cPriv->dash[i] != pGC->dash[i] ) { changeMask |= GCDashList; break; } + } else changeMask |= GCDashList; } @@ -513,9 +502,11 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) if( changeMask & GCForeground ) { +#ifdef XP_PCL_COLOR + ColormapPtr cmap; + Colormap c; char t[40]; -#ifdef XP_PCL_COLOR c = wColormap( ((WindowPtr)pDrawable) ); cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP ); @@ -538,7 +529,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) } else /* PseudoColor or StaticGray */ { - sprintf( t, "SP%d;", pGC->fgPixel ); + sprintf( t, "SP%ld;", (long) pGC->fgPixel ); SEND_PCL( *outFile, t ); } #else @@ -654,9 +645,8 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) if( changeMask & GCTile && !pGC->tileIsPixel ) { - char t[80], *bits, *row, *mod; - int h, w, w2, sz; - int i, j; + char *bits; + int h, w, sz; h = pGC->tile.pixmap->drawable.height; w = pGC->tile.pixmap->drawable.width; @@ -666,7 +656,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) sz = h * BitmapBytePad( w ); bits = (char *)xalloc( sz ); - mfbGetImage(pGC->tile.pixmap, 0, 0, w, h, XYPixmap, ~0, bits); + mfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, bits); PclSendPattern( bits, sz, 1, h, w, 100, *outFile ); xfree( bits ); } @@ -674,7 +664,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) { sz = h * PixmapBytePad( w, 8 ); bits = (char *)xalloc( sz ); - cfbGetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits); + cfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits); PclSendPattern( bits, sz, 8, h, w, 100, *outFile ); xfree( bits ); } @@ -684,7 +674,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) sz = h * PixmapBytePad( w, 24 ); bits = (char *)xalloc( sz ); - cfb32GetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits); + cfb32GetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits); PclSendPattern( bits, sz, 24, h, w, 100, *outFile ); xfree( bits ); } @@ -723,7 +713,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) sz = h * BitmapBytePad( w ); bits = (char *)xalloc( sz ); - mfbGetImage( pGC->stipple, 0, 0, w, h, XYPixmap, ~0, bits ); + mfbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits ); w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 ); /* @@ -766,10 +756,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) { mfbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); - mfbCopyPlane( pGC->stipple, + mfbCopyPlane( &(pGC->stipple->drawable), (DrawablePtr)scratchPix, scratchGC, 0, 0, w, h, 0, 0, 1 ); - mfbGetImage( scratchPix, 0, 0, w, h, XYPixmap, ~0, + mfbGetImage( &(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0, bits ); } else if( pGC->depth <= 32 ) @@ -777,10 +767,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) #if PSZ == 8 cfbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); - cfbCopyPlane( pGC->stipple, + cfbCopyPlane( &(pGC->stipple->drawable), (DrawablePtr)scratchPix, scratchGC, 0, 0, w, h, 0, 0, 1 ); - cfbGetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0, + cfbGetImage( &(scratchPix->drawable), 0, 0, w, h, ZPixmap, ~0, bits ); #else cfb32ValidateGC( scratchGC, ~0L, @@ -868,14 +858,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile ) void -PclComputeCompositeClip(pGC, pDrawable) - GCPtr pGC; - DrawablePtr pDrawable; +PclComputeCompositeClip( + GCPtr pGC, + DrawablePtr pDrawable) { - ScreenPtr pScreen = pGC->pScreen; - PclGCPrivPtr devPriv = (PclGCPrivPtr) - (pGC->devPrivates[PclGCPrivateIndex].ptr); - if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDrawable; @@ -892,7 +878,7 @@ PclComputeCompositeClip(pGC, pDrawable) pregWin = &pWin->clipList; freeTmpClip = FALSE; } - freeCompClip = devPriv->freeCompClip; + freeCompClip = pGC->freeCompClip; /* * if there is no client clip, we can get by with just keeping the @@ -904,9 +890,9 @@ PclComputeCompositeClip(pGC, pDrawable) if (pGC->clientClipType == CT_NONE) { if (freeCompClip) - REGION_DESTROY(pScreen, devPriv->pCompositeClip); - devPriv->pCompositeClip = pregWin; - devPriv->freeCompClip = freeTmpClip; + REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); + pGC->pCompositeClip = pregWin; + pGC->freeCompClip = freeTmpClip; } else { @@ -919,30 +905,31 @@ PclComputeCompositeClip(pGC, pDrawable) * clip. if neither is real, create a new region. */ - REGION_TRANSLATE(pScreen, pGC->clientClip, + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); if (freeCompClip) { - REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip, + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) - REGION_DESTROY(pScreen, pregWin); + REGION_DESTROY(pGC->pScreen, pregWin); } else if (freeTmpClip) { - REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip); - devPriv->pCompositeClip = pregWin; + REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, + pGC->clientClip); + pGC->pCompositeClip = pregWin; } else { - devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0); - REGION_INTERSECT(pScreen, devPriv->pCompositeClip, + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, pGC->clientClip); } - devPriv->freeCompClip = TRUE; - REGION_TRANSLATE(pScreen, pGC->clientClip, + pGC->freeCompClip = TRUE; + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); } @@ -957,23 +944,23 @@ PclComputeCompositeClip(pGC, pDrawable) pixbounds.x2 = pDrawable->width; pixbounds.y2 = pDrawable->height; - if (devPriv->freeCompClip) + if (pGC->freeCompClip) { - REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds); + REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); } else { - devPriv->freeCompClip = TRUE; - devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1); + pGC->freeCompClip = TRUE; + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); } if (pGC->clientClipType == CT_REGION) { - REGION_TRANSLATE(pScreen, devPriv->pCompositeClip, + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); - REGION_INTERSECT(pScreen, devPriv->pCompositeClip, - devPriv->pCompositeClip, pGC->clientClip); - REGION_TRANSLATE(pScreen, devPriv->pCompositeClip, + 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 */ @@ -992,16 +979,11 @@ PclComputeCompositeClip(pGC, pDrawable) /*ARGSUSED*/ void -PclValidateGC( pGC, changes, pDrawable ) - GCPtr pGC; - Mask changes; - DrawablePtr pDrawable; +PclValidateGC( + GCPtr pGC, + unsigned long changes, + DrawablePtr pDrawable) { - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - extern int mfbGCPrivateIndex; - extern int cfbGCPrivateIndex; - /* * Pixmaps should be handled by their respective validation * functions. @@ -1010,16 +992,13 @@ PclValidateGC( pGC, changes, pDrawable ) { if( pDrawable->depth == 1 ) { - miRegisterGCPrivateIndex( mfbGCPrivateIndex ); mfbValidateGC( pGC, ~0, pDrawable ); } else if( pDrawable->depth <= 32 ) { #if PSZ == 8 - miRegisterGCPrivateIndex( cfbGCPrivateIndex ); cfbValidateGC( pGC, ~0, pDrawable ); #else - miRegisterGCPrivateIndex( cfbGCPrivateIndex ); cfb32ValidateGC( pGC, ~0, pDrawable ); #endif } @@ -1061,4 +1040,3 @@ PclValidateGC( pGC, changes, pDrawable ) PclSetDrawablePrivateGC( pDrawable, *pGC, changes ); */ } - diff --git a/Xprint/pcl/PclInit.c b/Xprint/pcl/PclInit.c index 791a33dfe..5ee49631e 100644 --- a/Xprint/pcl/PclInit.c +++ b/Xprint/pcl/PclInit.c @@ -76,30 +76,26 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclInit.c,v 1.12 2002/10/16 21:13:32 dawes Exp $ */ #include <stdio.h> #include <string.h> +#include <sys/types.h> #include <sys/wait.h> #include "Pcl.h" -#include "AttrValid.h" #include "cfb.h" +#include "Xos.h" /* for unlink() */ #include "attributes.h" -#include "windowstr.h" +#include "DiPrint.h" #define MODELDIRNAME "/models" -extern char *XpGetConfigDir(); -static void AllocatePclPrivates( - ScreenPtr pScreen); +static void AllocatePclPrivates(ScreenPtr pScreen); static int PclInitContext(XpContextPtr pCon); - -extern Bool _XpBoolNoop(); -extern void _XpVoidNoop(); - -extern unsigned char *PclReadMap(char *, int *); +static Bool PclDestroyContext(XpContextPtr pCon); int PclScreenPrivateIndex; int PclContextPrivateIndex; @@ -153,46 +149,24 @@ Bool PclCloseScreen(int index, ScreenPtr pScreen) { - Bool status = Success; PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr; -/* - if( pPriv->CloseScreen != (Bool (*)())NULL ) - { - pScreen->CloseScreen = pPriv->CloseScreen; - status = pScreen->CloseScreen( index, pScreen ); - pScreen->CloseScreen = PclCloseScreen; - } -*/ - - /* - * Finish cleaning up cfb (code taken from cfbCloseScreen) - */ -#ifdef XP_PCL_COLOR -#ifdef CFB_NEED_SCREEN_PRIVATE - xfree( pScreen->devPrivates[cfbScreenPrivateIndex].ptr ); -#else - xfree( pScreen->devPrivate ); -#endif -#endif - + pScreen->CloseScreen = pPriv->CloseScreen; xfree( pPriv ); - return status; + return (*pScreen->CloseScreen)(index, pScreen); } Bool -InitializePclDriver(ndx, pScreen, argc, argv) - int ndx; - ScreenPtr pScreen; - int argc; - char **argv; +InitializePclDriver( + int ndx, + ScreenPtr pScreen, + int argc, + char **argv) { - int maxRes, xRes, yRes, maxWidth, maxHeight, maxDim, numBytes; - int i; + int maxRes, xRes, yRes, maxDim; + unsigned i; PclScreenPrivPtr pPriv; - char **printerNames; - int numPrinters; /* * Register this driver's InitContext function with the print @@ -227,7 +201,7 @@ InitializePclDriver(ndx, pScreen, argc, argv) /* * Clean up the fields that we stomp (code taken from cfbCloseScreen) */ - for( i = 0; i < pScreen->numDepths; i++ ) + for( i = 0; (int) i < pScreen->numDepths; i++ ) xfree( pScreen->allowedDepths[i].vids ); xfree( pScreen->allowedDepths ); xfree( pScreen->visuals ); @@ -236,19 +210,19 @@ InitializePclDriver(ndx, pScreen, argc, argv) maxRes ); #endif /* XP_PCL_COLOR */ + miInitializeBackingStore ( pScreen ); + pScreen->defColormap = FakeClientID(0); pScreen->blackPixel = 1; pScreen->whitePixel = 0; -/* pPriv->CloseScreen = pScreen->CloseScreen; -*/ pScreen->CloseScreen = PclCloseScreen; pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize; - pScreen->SaveScreen = _XpBoolNoop; - pScreen->GetImage = _XpVoidNoop; - pScreen->GetSpans = _XpVoidNoop; + pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop; + pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop; + pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop; pScreen->CreateWindow = PclCreateWindow; pScreen->DestroyWindow = PclDestroyWindow; /* @@ -316,30 +290,29 @@ InitializePclDriver(ndx, pScreen, argc, argv) } static void -AllocatePclPrivates( - ScreenPtr pScreen) +AllocatePclPrivates(ScreenPtr pScreen) { - static int PclGeneration = -1; + static unsigned long PclGeneration = 0; - if(PclGeneration != serverGeneration) + if((unsigned long) PclGeneration != serverGeneration) { PclScreenPrivateIndex = AllocateScreenPrivateIndex(); PclWindowPrivateIndex = AllocateWindowPrivateIndex(); - AllocateWindowPrivate( pScreen, PclWindowPrivateIndex, - sizeof( PclWindowPrivRec ) ); + AllocateWindowPrivate( pScreen, PclWindowPrivateIndex, + sizeof( PclWindowPrivRec ) ); PclContextPrivateIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate( PclContextPrivateIndex, - sizeof( PclContextPrivRec ) ); + XpAllocateContextPrivate( PclContextPrivateIndex, + sizeof( PclContextPrivRec ) ); PclGCPrivateIndex = AllocateGCPrivateIndex(); - AllocateGCPrivate( pScreen, PclGCPrivateIndex, - sizeof( PclGCPrivRec ) ); + AllocateGCPrivate( pScreen, PclGCPrivateIndex, + sizeof( PclGCPrivRec ) ); PclPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex, - sizeof( PclPixmapPrivRec ) ); + AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex, + sizeof( PclPixmapPrivRec ) ); PclGeneration = serverGeneration; } @@ -364,8 +337,7 @@ static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \ default-input-tray default-medium plex"; static int -PclInitContext( pCon ) - XpContextPtr pCon; +PclInitContext(XpContextPtr pCon) { XpDriverFuncsPtr pFuncs; PclContextPrivPtr pConPriv; @@ -373,7 +345,6 @@ PclInitContext( pCon ) char *modelID; char *configDir; char *pathName; - extern XpValidatePoolsRec PclValidatePoolsRec; int i, j; float width, height; XpOidMediumDiscreteSizeList* ds_list; @@ -392,16 +363,16 @@ PclInitContext( pCon ) pFuncs = &( pCon->funcs ); pFuncs->StartJob = PclStartJob; pFuncs->EndJob = PclEndJob; - pFuncs->StartDoc = (int (*)())PclStartDoc; + pFuncs->StartDoc = PclStartDoc; pFuncs->EndDoc = PclEndDoc; pFuncs->StartPage = PclStartPage; pFuncs->EndPage = PclEndPage; pFuncs->PutDocumentData = PclDocumentData; pFuncs->GetDocumentData = PclGetDocumentData; - pFuncs->GetAttributes = (char *(*)())PclGetAttributes; - pFuncs->SetAttributes = (int (*)())PclSetAttributes; - pFuncs->AugmentAttributes = (int (*)())PclAugmentAttributes; - pFuncs->GetOneAttribute = (char *(*)())PclGetOneAttribute; + pFuncs->GetAttributes = PclGetAttributes; + pFuncs->SetAttributes = PclSetAttributes; + pFuncs->AugmentAttributes = PclAugmentAttributes; + pFuncs->GetOneAttribute = PclGetOneAttribute; pFuncs->DestroyContext = PclDestroyContext; pFuncs->GetMediumDimensions = PclGetMediumDimensions; pFuncs->GetReproducibleArea = PclGetReproducibleArea; @@ -541,8 +512,7 @@ PclInitContext( pCon ) } static Bool -PclDestroyContext( pCon ) - XpContextPtr pCon; +PclDestroyContext(XpContextPtr pCon) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; @@ -639,8 +609,7 @@ PclDestroyContext( pCon ) } XpContextPtr -PclGetContextFromWindow( win ) - WindowPtr win; +PclGetContextFromWindow(WindowPtr win) { PclWindowPrivPtr pPriv; diff --git a/Xprint/pcl/PclLine.c b/Xprint/pcl/PclLine.c index 271bdfb16..3c10f97ca 100644 --- a/Xprint/pcl/PclLine.c +++ b/Xprint/pcl/PclLine.c @@ -11,7 +11,7 @@ ** * Created: 10/11/95 ** * ** ********************************************************* -** +** ********************************************************************/ /* (c) Copyright 1996 Hewlett-Packard Company @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclLine.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */ #include "Pcl.h" #include "gcstruct.h" @@ -80,16 +81,16 @@ copyright holders. */ void -PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; - int nPoints; - xPoint *pPoints; +PclPolyLine( + DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int nPoints, + xPoint *pPoints) { - char t[80], window[80]; + char t[80]; FILE *outFile; - int xoffset, yoffset; + int xoffset = 0, yoffset = 0; int nbox; BoxPtr pbox; xRectangle *drawRects, *r; @@ -98,7 +99,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) int i; XpContextPtr pCon; PclContextPrivPtr pConPriv; - + if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) return; @@ -110,7 +111,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) * Allocate the storage required to deal with the clipping * regions. */ - region = miRegionCreate( NULL, 0 ); + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); drawRects = (xRectangle *) xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) ); @@ -120,7 +121,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) * XXX I need to think of a way to test this. */ fudge = 3 * pGC->lineWidth + 1; - + /* * Generate the PCL code to draw the polyline, by defining it as a * macro which uses the HP-GL/2 line drawing function. @@ -132,20 +133,20 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x, pPoints[0].y + pDrawable->y ); SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */ - + switch( mode ) { case CoordModeOrigin: xoffset = pDrawable->x; yoffset = pDrawable->y; - SAVE_PCL( outFile, pConPriv, "PA" ); + SAVE_PCL( outFile, pConPriv, "PA" ); break; case CoordModePrevious: xoffset = yoffset = 0; - SAVE_PCL( outFile, pConPriv, "PR" ); + SAVE_PCL( outFile, pConPriv, "PR" ); break; } - + /* * Build the "drawing region" as we build the PCL to draw the * line. @@ -154,13 +155,13 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) { if( i != 1 ) SAVE_PCL( outFile, pConPriv, "," ); - + sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y + yoffset ); SAVE_PCL( outFile, pConPriv, t ); r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge; - r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge; + r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge; r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge; r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge; } @@ -171,36 +172,35 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints ) * Convert the collection of rectangles into a proper region, then * intersect it with the clip region. */ - drawRegion = miRectsToRegion( nPoints - 1, drawRects, CT_UNSORTED ); + drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1, + drawRects, CT_UNSORTED ); if( mode == CoordModePrevious ) - miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); - + REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y ); + REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); + /* * For each rectangle in the clip region, set the HP-GL/2 "input * window" and render the entire polyline to it. */ pbox = REGION_RECTS( region ); nbox = REGION_NUM_RECTS( region ); - + PclSendData(outFile, pConPriv, pbox, nbox, 1.0); /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); xfree( drawRects ); } void -PclPolySegment( pDrawable, pGC, nSegments, pSegments ) - DrawablePtr pDrawable; - GCPtr pGC; - int nSegments; - xSegment *pSegments; +PclPolySegment( + DrawablePtr pDrawable, + GCPtr pGC, + int nSegments, + xSegment *pSegments) { FILE *outFile, *dummy; char t[80]; @@ -214,8 +214,8 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments ) XpContextPtr pCon; PclContextPrivPtr pConPriv; GC cacheGC; - - + + if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) return; @@ -226,7 +226,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments ) /* * Allocate the storage for the temporary regions. */ - region = miRegionCreate( NULL, 0 ); + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); drawRects = (xRectangle *) xalloc( nSegments * sizeof( xRectangle ) ); @@ -234,12 +234,12 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments ) * Calculate the fudge factor, based on the line width */ fudge = pGC->lineWidth * 3 + 1; - + /* * Turn off line joining. */ SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" ); - + /* * Generate the PCL code to draw the segments, by defining them as * a macro which uses the HP-GL/2 line drawing function. @@ -254,7 +254,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments ) xoffset = pDrawable->x; yoffset = pDrawable->y; - + for( i = 0, r = drawRects; i < nSegments; i++, r++ ) { r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset; @@ -279,18 +279,17 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments ) * Convert the collection of rectangles into a proper region, then * intersect it with the clip region. */ - drawRegion = miRectsToRegion( nSegments, drawRects, CT_UNSORTED ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); - + drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments, + drawRects, CT_UNSORTED ); + REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); + /* * For each rectangle in the clip region, set the HP-GL/2 "input * window" and render the entire set of segments to it. */ pbox = REGION_RECTS( region ); nbox = REGION_NUM_RECTS( region ); - + PclSendData(outFile, pConPriv, pbox, nbox, 1.0); /* @@ -303,12 +302,11 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments ) cacheGC.joinStyle = !cacheGC.joinStyle; PclSetDrawablePrivateGC( pDrawable, cacheGC ); PclUpdateDrawableGC( pGC, pDrawable, &outFile ); - + /* - * Clean up + * Clean up */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); xfree( drawRects ); } - diff --git a/Xprint/pcl/PclMisc.c b/Xprint/pcl/PclMisc.c index 867393a46..f5d36a263 100644 --- a/Xprint/pcl/PclMisc.c +++ b/Xprint/pcl/PclMisc.c @@ -44,9 +44,13 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclMisc.c,v 1.10 2001/12/02 13:35:28 herrb Exp $ */ +#include <stdlib.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/wait.h> #include "Xos.h" /* for SIGCLD on pre-POSIX systems */ -#include <stdio.h> #include "Pcl.h" #include "cursor.h" @@ -54,6 +58,7 @@ copyright holders. #include "windowstr.h" #include "propertyst.h" +#include "attributes.h" /*ARGSUSED*/ @@ -142,12 +147,14 @@ GetPropString( } #include <signal.h> +#include <errno.h> /* ARGSUSED */ static void SigchldHndlr ( int dummy) { int status, w; + int olderrno = errno; struct sigaction act; sigfillset(&act.sa_mask); act.sa_flags = 0; @@ -159,6 +166,7 @@ static void SigchldHndlr ( * Is this really necessary? */ sigaction(SIGCHLD, &act, (struct sigaction *)NULL); + errno = olderrno; } /* @@ -248,6 +256,7 @@ char *ptr; * in the clipped area. * For XP-PCL-LJ3, it draws the spooled figures in the clipped area. */ +void PclSendData( FILE *outFile, PclContextPrivPtr pConPriv, diff --git a/Xprint/pcl/PclPixel.c b/Xprint/pcl/PclPixel.c index 23ec464e5..b9685fd1b 100644 --- a/Xprint/pcl/PclPixel.c +++ b/Xprint/pcl/PclPixel.c @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixel.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */ #include <stdio.h> @@ -60,7 +61,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints ) int nPoints; xPoint *pPoints; { - char t[80], *command; + char t[80]; FILE *outFile; int xoffset, yoffset; BoxRec box; @@ -84,7 +85,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints ) xloc = pPoints[0].x + pDrawable->x; yloc = pPoints[0].y + pDrawable->y; - sprintf( t, "\27%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc ); + sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc ); SEND_PCL( outFile, t ); /* @@ -94,7 +95,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints ) for( i = 0; i < nPoints; i++ ) { - if( miPointInRegion( pGC->clientClip, xloc, yloc, &box ) ) + if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) ) { sprintf( t, ",%d,%d", xloc, yloc ); SEND_PCL( outFile, t ); diff --git a/Xprint/pcl/PclPixmap.c b/Xprint/pcl/PclPixmap.c index fe8d169b1..ba91fc9ec 100644 --- a/Xprint/pcl/PclPixmap.c +++ b/Xprint/pcl/PclPixmap.c @@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixmap.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */ #include "Pcl.h" -/*#include "cfb.h"*/ -/* #include "mfb.h" */ +#include "cfb.h" +#include "cfb32.h" +#include "mfb.h" #include "pixmapstr.h" PixmapPtr @@ -56,25 +58,24 @@ PclCreatePixmap(ScreenPtr pScreen, int height, int depth) { -extern PixmapPtr mfbCreatePixmap(), cfbCreatePixmap(), cfb32CreatePixmap(); - if( depth == 1 ) return mfbCreatePixmap( pScreen, width, height, depth ); else if( depth <= 8 ) return cfbCreatePixmap( pScreen, width, height, depth ); else if( depth <= 32 ) return cfb32CreatePixmap( pScreen, width, height, depth ); + return 0; } Bool PclDestroyPixmap(PixmapPtr pPixmap) { -extern Bool mfbDestroyPixmap(), cfbDestroyPixmap(), cfb32DestroyPixmap(); if( pPixmap->drawable.depth == 1 ) return mfbDestroyPixmap( pPixmap ); else if( pPixmap->drawable.depth <= 8 ) return cfbDestroyPixmap( pPixmap ); else if( pPixmap->drawable.depth <= 32 ) return cfb32DestroyPixmap( pPixmap ); + return 0; } diff --git a/Xprint/pcl/PclPolygon.c b/Xprint/pcl/PclPolygon.c index badbdf18a..a5de77399 100644 --- a/Xprint/pcl/PclPolygon.c +++ b/Xprint/pcl/PclPolygon.c @@ -11,7 +11,7 @@ ** * Created: 10/23/95 ** * ** ********************************************************* -** +** ********************************************************************/ /* (c) Copyright 1996 Hewlett-Packard Company @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPolygon.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */ #include "Pcl.h" @@ -51,11 +52,11 @@ copyright holders. #include "windowstr.h" void -PclPolyRectangle( pDrawable, pGC, nRects, pRects ) - DrawablePtr pDrawable; - GCPtr pGC; - int nRects; - xRectangle *pRects; +PclPolyRectangle( + DrawablePtr pDrawable, + GCPtr pGC, + int nRects, + xRectangle *pRects) { char t[80]; FILE *outFile; @@ -67,23 +68,23 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects ) int xoffset, yoffset; XpContextPtr pCon; PclContextPrivPtr pConPriv; - + if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) return; pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; - + /* * Allocate the storage required to deal with the clipping - * regions. + * regions. */ - region = miRegionCreate( NULL, 0 ); + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) ); - + fudge = 3 * pGC->lineWidth + 1; - + /* * Generate the PCL code to draw the rectangles, by defining them * as a macro which uses the HP-GL/2 rectangle drawing function. @@ -93,13 +94,13 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects ) xoffset = pDrawable->x; yoffset = pDrawable->y; - + for( i = 0, r = drawRects; i < nRects; i++, r++ ) { xRectangle rect = pRects[i]; - + /* Draw the rectangle */ - sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset, + sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset, rect.y + yoffset, rect.width, rect.height ); SAVE_PCL( outFile, pConPriv, t ); @@ -113,49 +114,47 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects ) } SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ MACRO_END( outFile ); - + /* * Convert the collection of rectangles to a proper region, then * intersect it with the clip region. */ - drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED ); + drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects, + drawRects, CT_UNSORTED ); + + REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); - /* * For each rectangle in the clip region, set the HP-GL/2 "input * window" and render the set of rectangles to it. */ pbox = REGION_RECTS( region ); nbox = REGION_NUM_RECTS( region ); - + PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - + /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); xfree( drawRects ); } void -PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) - DrawablePtr pDrawable; - GCPtr pGC; - int shape; - int mode; - int nPoints; - DDXPointPtr pPoints; +PclFillPolygon( + DrawablePtr pDrawable, + GCPtr pGC, + int shape, + int mode, + int nPoints, + DDXPointPtr pPoints) { char t[80]; FILE *outFile; int nbox, i; BoxPtr pbox; BoxRec box; - xRectangle *drawRects, *r; RegionPtr drawRegion, region; int xoffset, yoffset; int xtop, xbottom, yleft, yright; @@ -163,14 +162,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) XpContextPtr pCon; PclContextPrivPtr pConPriv; char *command; - + if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) return; pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; - + /* * Generate the PCL code to draw the filled polygon, by defining * it as a macro which uses the HP-GL/2 polygon drawing function. @@ -189,7 +188,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) xoffset = yoffset = 0; command = "PR"; } - + /* Begin the polygon */ sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y + yoffset, command ); @@ -198,13 +197,13 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) /* Seed the bounding box */ xtop = xbottom = pPoints[0].x + xoffset; yleft = yright = pPoints[0].y + yoffset; - + /* Add the rest of the points to the polygon */ for( i = 1; i < nPoints; i++ ) { if( i != 1 ) SAVE_PCL( outFile, pConPriv, "," ); - + sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y + yoffset ); SAVE_PCL( outFile, pConPriv, t ); @@ -222,7 +221,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) fillRule = 0; else fillRule = 1; - + sprintf( t, ";PM2;FP%d;\033%%0A", fillRule ); SAVE_PCL( outFile, pConPriv, t ); MACRO_END ( outFile ); @@ -234,16 +233,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) box.y1 = yleft; box.x2 = xbottom; box.y2 = yright; - drawRegion = miRegionCreate( &box, 0 ); + drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 ); if( mode == CoordModePrevious ) - miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y ); - - region = miRegionCreate( NULL, 0 ); + REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); + + REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); /* * For each rectangle in the clip region, set the HP-GL/2 "input @@ -251,22 +248,22 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints ) */ pbox = REGION_RECTS( region ); nbox = REGION_NUM_RECTS( region ); - + PclSendData(outFile, pConPriv, pbox, nbox, 1.0); /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); } void -PclPolyFillRect( pDrawable, pGC, nRects, pRects ) - DrawablePtr pDrawable; - GCPtr pGC; - int nRects; - xRectangle *pRects; +PclPolyFillRect( + DrawablePtr pDrawable, + GCPtr pGC, + int nRects, + xRectangle *pRects) { char t[80]; FILE *outFile; @@ -278,24 +275,24 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects ) short fudge; XpContextPtr pCon; PclContextPrivPtr pConPriv; - + if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) return; pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; - + /* * Allocate the storage required to deal with the clipping * regions. */ - region = miRegionCreate( NULL, 0 ); + region = REGION_CREATE( pGC->pScreen, NULL, 0 ); drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) ); fudge = 3 * pGC->lineWidth + 1; - + /* * Generate the PCL code to draw the filled rectangles, by * defining them as a macro which uses the HP-GL/2 rectangle @@ -303,19 +300,19 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects ) */ MACRO_START( outFile, pConPriv ); SAVE_PCL( outFile, pConPriv, "\033%0B" ); - + xoffset = pDrawable->x; yoffset = pDrawable->y; - + for( i = 0, r = drawRects; i < nRects; i++, r++ ) { xRectangle rect = pRects[i]; - + /* Draw the rectangle */ sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y + yoffset, rect.width, rect.height ); SAVE_PCL( outFile, pConPriv, t ); - + /* Build the bounding box */ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge; r->y = MIN( rect.y, rect.y + rect.height ) + yoffset - @@ -325,30 +322,28 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects ) } SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ MACRO_END( outFile ); - + /* * Convert the collection of rectangles to a proper region, then * intersect it with the clip region. */ - drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); - + drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects, + drawRects, CT_UNSORTED ); + REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); + /* * For each rectangle in the clip region, set the HP-GL/2 "input * window" and render the set of rectangles to it. */ pbox = REGION_RECTS( region ); nbox = REGION_NUM_RECTS( region ); - + PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - + /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); xfree( drawRects ); } - diff --git a/Xprint/pcl/PclPrint.c b/Xprint/pcl/PclPrint.c index 2bfd92d15..f21d6c22a 100644 --- a/Xprint/pcl/PclPrint.c +++ b/Xprint/pcl/PclPrint.c @@ -43,6 +43,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPrint.c,v 1.7 2001/10/28 03:32:55 tsi Exp $ */ #include <stdio.h> #include <string.h> @@ -63,20 +64,14 @@ copyright holders. #include "AttrValid.h" #include "Oid.h" -extern PclSoftFontInfoPtr PclCreateSoftFontInfo(); -extern void PclDestroySoftFontInfo(PclSoftFontInfoPtr); - int -PclStartJob( pCon, sendClientData, client ) - XpContextPtr pCon; - Bool sendClientData; - ClientPtr client; - +PclStartJob( + XpContextPtr pCon, + Bool sendClientData, + ClientPtr client) { PclContextPrivPtr pConPriv = (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr; - char *jobHeader; - char s[40]; PclPaletteMap *pal; /* @@ -128,9 +123,9 @@ PclStartJob( pCon, sendClientData, client ) } int -PclEndJob( pCon, cancel ) - XpContextPtr pCon; - Bool cancel; +PclEndJob( + XpContextPtr pCon, + Bool cancel) { PclContextPrivPtr priv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; @@ -143,7 +138,7 @@ PclEndJob( pCon, cancel ) char *fileName, *trailer; struct stat statBuf; int n; - PclPaletteMapPtr p, t; + PclPaletteMapPtr p; trailer = "\033%-12345X@PJL RESET\n"; @@ -152,7 +147,7 @@ PclEndJob( pCon, cancel ) if( priv->getDocClient != (ClientPtr)NULL ) { XpFinishDocData( priv->getDocClient ); - priv->getDocClient == NULL; + priv->getDocClient = NULL; priv->getDocBufSize = 0; } @@ -183,7 +178,7 @@ PclEndJob( pCon, cancel ) if( priv->getDocClient != (ClientPtr)NULL ) { XpFinishDocData( priv->getDocClient ); - priv->getDocClient == NULL; + priv->getDocClient = NULL; priv->getDocBufSize = 0; } @@ -249,11 +244,10 @@ PclEndJob( pCon, cancel ) * ClearArea the window and all descendant windows */ int -PclStartPage( pCon, pWin ) - XpContextPtr pCon; - WindowPtr pWin; +PclStartPage( + XpContextPtr pCon, + WindowPtr pWin) { - register WindowPtr pChild; PclContextPrivPtr pConPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; PclWindowPrivPtr pWinPriv = @@ -261,9 +255,7 @@ PclStartPage( pCon, pWin ) xRectangle repro; char t[80]; XpOid orient, plex, tray, medium; - unsigned short wid, ht; int dir, plexNum, num; - xEvent event; /* * Put a pointer to the context in the window private structure @@ -490,14 +482,12 @@ SendDocData( PclContextPrivPtr pPriv ) * Write page file to job file */ int -PclEndPage( pCon, pWin ) - XpContextPtr pCon; - WindowPtr pWin; +PclEndPage( + XpContextPtr pCon, + WindowPtr pWin) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; - PclWindowPrivPtr pWinPriv = - (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr; struct stat statBuf; @@ -566,9 +556,9 @@ PclStartDoc(XpContextPtr pCon, } int -PclEndDoc( pCon, cancel ) - XpContextPtr pCon; - Bool cancel; +PclEndDoc( + XpContextPtr pCon, + Bool cancel) { /* * XXX What should I do if I get cancel == TRUE? @@ -588,18 +578,18 @@ PclEndDoc( pCon, cancel ) #define DOC_HPGL 2 int -PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, client) - XpContextPtr pCon; - DrawablePtr pDraw; - char *pData; - int len_data; - char *pFmt; - int len_fmt; - char *pOpt; - int len_opt; - ClientPtr client; +PclDocumentData( + XpContextPtr pCon, + DrawablePtr pDraw, + char *pData, + int len_data, + char *pFmt, + int len_fmt, + char *pOpt, + int len_opt, + ClientPtr client) { - int type; + int type = 0; PclContextPrivPtr pPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; XpOidDocFmtList *formats; @@ -703,10 +693,10 @@ PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, cli */ int -PclGetDocumentData( pCon, client, maxBufferSize ) - XpContextPtr pCon; - ClientPtr client; - int maxBufferSize; +PclGetDocumentData( + XpContextPtr pCon, + ClientPtr client, + int maxBufferSize) { PclContextPrivPtr pPriv = (PclContextPrivPtr) pCon->devPrivates[PclContextPrivateIndex].ptr; diff --git a/Xprint/pcl/PclSFonts.c b/Xprint/pcl/PclSFonts.c index 9f19a2387..2f33ab857 100644 --- a/Xprint/pcl/PclSFonts.c +++ b/Xprint/pcl/PclSFonts.c @@ -45,6 +45,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSFonts.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */ #include <stdio.h> @@ -75,8 +76,7 @@ PclDownloadSoftFont8( PclSoftFontInfoPtr pSoftFontInfo, PclFontHead8Ptr pfh, PclCharDataPtr pcd, - unsigned char *code, - int flag + unsigned char *code ) { /* @@ -103,8 +103,7 @@ PclDownloadSoftFont16( PclFontHead16Ptr pfh, PclCharDataPtr pcd, unsigned char row, - unsigned char col, - int flag + unsigned char col ) { /* @@ -129,8 +128,7 @@ PclDownloadSoftFont16( * of the downloaded soft font. * **************************************************************************/ PclSoftFontInfoPtr -PclCreateSoftFontInfo( -) +PclCreateSoftFontInfo(void) { PclSoftFontInfoPtr pSoftFontInfo; @@ -154,7 +152,7 @@ PclFontHead8Ptr pfh8, pfh8_next; PclFontHead16Ptr pfh16, pfh16_next; PclInternalFontPtr pin, pin_next; unsigned char nindex_row, nindex_col; -int i, j; +int i; if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL ) return; diff --git a/Xprint/pcl/PclSpans.c b/Xprint/pcl/PclSpans.c index 38d1b7b01..98c17dcf9 100644 --- a/Xprint/pcl/PclSpans.c +++ b/Xprint/pcl/PclSpans.c @@ -11,7 +11,7 @@ ** * Created: 10/23/95 ** * ** ********************************************************* -** +** ********************************************************************/ /* (c) Copyright 1996 Hewlett-Packard Company @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSpans.c,v 1.6 2001/01/17 22:36:30 dawes Exp $ */ #include "Pcl.h" @@ -51,33 +52,33 @@ copyright holders. #include "windowstr.h" void -PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted ) - DrawablePtr pDrawable; - GCPtr pGC; - int nSpans; - DDXPointPtr pPoints; - int *pWidths; - int fSorted; +PclFillSpans( + DrawablePtr pDrawable, + GCPtr pGC, + int nSpans, + DDXPointPtr pPoints, + int *pWidths, + int fSorted) { char t[80]; FILE *outFile; int xoffset, yoffset; xRectangle *rects, *r; - RegionPtr fillRegion, region; + RegionPtr fillRegion, region = 0; int i; int nbox; BoxPtr pbox; - + if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) return; - + /* * Build a region out of the spans */ rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) ); xoffset = pDrawable->x; yoffset = pDrawable->y; - + for( i = 0, r = rects; i < nSpans; i++, r++ ) { r->x = pPoints[i].x + xoffset; @@ -85,15 +86,15 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted ) r->width = pWidths[i]; r->height = 1; } - fillRegion = miRectsToRegion( nSpans, rects, ( fSorted ) ? + fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ? CT_YSORTED : CT_UNSORTED ); - + /* * Intersect this region with the clip region. Whatever's left, * should be filled. */ - miIntersect( region, fillRegion, pGC->clientClip ); - + REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip ); + pbox = REGION_RECTS( region ); nbox = REGION_NUM_RECTS( region ); @@ -102,35 +103,33 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted ) while( nbox ) { - sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, + sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, pbox->x2, pbox->y2 ); SEND_PCL( outFile, t ); - + nbox--; pbox++; } /* Go back to PCL */ SEND_PCL( outFile, "\27%0A" ); - + /* * Clean up the temporary regions */ - miRegionDestroy( fillRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, fillRegion ); + REGION_DESTROY( pGC->pScreen, region ); xfree( rects ); } void -PclSetSpans( pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted ) - DrawablePtr pDrawable; - GCPtr pGC; - char *pSrc; - DDXPointPtr pPoints; - int *pWidths; - int nSpans; - int fSorted; +PclSetSpans( + DrawablePtr pDrawable, + GCPtr pGC, + char *pSrc, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + int fSorted) { } - - diff --git a/Xprint/pcl/PclText.c b/Xprint/pcl/PclText.c index d01baabfa..ae5446a85 100644 --- a/Xprint/pcl/PclText.c +++ b/Xprint/pcl/PclText.c @@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclText.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */ #ifdef DO_TWO_BYTE_PCL #include "iconv.h" @@ -81,13 +82,13 @@ static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *); #define INTERNAL_FONT 1 int -PclPolyText8( pDrawable, pGC, x, y, count, string ) - DrawablePtr pDrawable; - GCPtr pGC; - int x; - int y; - int count; - char *string; +PclPolyText8( + DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + int count, + char *string) { XpContextPtr pCon; PclContextPrivPtr pConPriv; @@ -181,8 +182,6 @@ char font_type; MACRO_END( outFile ); } else { - char *internalFont; - int pixel_size; int fid = 0; pin = makeInternalFont(pGC->font, pSoftFontInfo); @@ -231,9 +230,7 @@ char font_type; drawRegion = miRegionCreate( &box, 0 ); region = miRegionCreate( NULL, 0 ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); + miIntersect( region, drawRegion, pGC->pCompositeClip ); /* * For each rectangle in the clip region, set the HP-GL/2 "input @@ -247,20 +244,20 @@ char font_type; /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); return x+w; } int -PclPolyText16( pDrawable, pGC, x, y, count, string ) - DrawablePtr pDrawable; - GCPtr pGC; - int x; - int y; - int count; - unsigned short *string; +PclPolyText16( + DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + int count, + unsigned short *string) { XpContextPtr pCon; PclContextPrivPtr pConPriv; @@ -271,7 +268,6 @@ CharInfoPtr charinfo[255], *chinfo; FILE *outFile; PclSoftFontInfoPtr pSoftFontInfo; PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL; -PclInternalFontPtr pin = (PclInternalFontPtr)NULL; PclCharDataRec cd; FontInfoPtr pfi; unsigned char row, col; @@ -321,8 +317,8 @@ char font_type; col = col - pfi->firstCol; } else { def = pfi->defaultCh; - row = (def>>8)&0xff - pfi->firstRow; - col = def&0xff - pfi->firstCol; + row = ((def>>8)&0xff) - pfi->firstRow; + col = (def&0xff) - pfi->firstCol; } if ( !pfh16->index[row][col].fid ) { fillCharDescData(&cd, *chinfo); @@ -356,8 +352,8 @@ char font_type; col = col - pfi->firstCol; } else { def = pfi->defaultCh; - row = (def>>8)&0xff - pfi->firstRow; - col = def&0xff - pfi->firstCol; + row = ((def>>8)&0xff) - pfi->firstRow; + col = (def&0xff) - pfi->firstCol; } if ( last_fid != pfh16->index[row][col].fid ) { sprintf(t, "%cFI%d;SS;LB", @@ -380,8 +376,7 @@ char font_type; } else { #ifdef DO_TWO_BYTE_PCL - char *internalFont; - int pixel_size; + PclInternalFontPtr pin; int fid = 0; pin = makeInternalFont(pGC->font, pSoftFontInfo); @@ -432,9 +427,7 @@ char font_type; drawRegion = miRegionCreate( &box, 0 ); region = miRegionCreate( NULL, 0 ); - miIntersect( region, drawRegion, - ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr) - ->pCompositeClip ); + miIntersect( region, drawRegion, pGC->pCompositeClip ); /* * For each rectangle in the clip region, set the HP-GL/2 "input @@ -448,52 +441,52 @@ char font_type; /* * Clean up the temporary regions */ - miRegionDestroy( drawRegion ); - miRegionDestroy( region ); + REGION_DESTROY( pGC->pScreen, drawRegion ); + REGION_DESTROY( pGC->pScreen, region ); return x+w; } void -PclImageText8( pDrawable, pGC, x, y, count, string ) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - int count; - char *string; +PclImageText8( + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + int count, + char *string) { } void -PclImageText16( pDrawable, pGC, x, y, count, string ) - DrawablePtr pDrawable; - GCPtr pGC; - int x; - int y; - int count; - unsigned short *string; +PclImageText16( + DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + int count, + unsigned short *string) { } void -PclImageGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase ) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nGlyphs; - CharInfoPtr *pCharInfo; - pointer pGlyphBase; +PclImageGlyphBlt( + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nGlyphs, + CharInfoPtr *pCharInfo, + pointer pGlyphBase) { } void -PclPolyGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase ) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nGlyphs; - CharInfoPtr *pCharInfo; - pointer pGlyphBase; +PclPolyGlyphBlt( + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nGlyphs, + CharInfoPtr *pCharInfo, + pointer pGlyphBase) { } @@ -509,7 +502,7 @@ PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL; FontInfoPtr pfi; char *fontname; unsigned char nindex; -int i, j; +int i; unsigned long n; CharInfoPtr charinfo[1]; unsigned int space_width; @@ -680,7 +673,7 @@ FontPropPtr props; FontInfoPtr pfi; char *fontname; Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing; -int res, width; +int res, width = 1; int mask; int i; @@ -723,19 +716,19 @@ int i; mask = 0; for (i=0; i<pfi->nprops; i++, props++) { - if ( props->name == xa_pcl_font_name ) { + if ( (Atom) props->name == xa_pcl_font_name ) { pin->pcl_font_name = NameForAtom(props->value); mask |= 0x1; } else if ( props->name == XA_POINT_SIZE ) { pin->height = (float) props->value / 10.0; mask |= 0x2; - } else if ( props->name == xa_res ) { + } else if ( (Atom) props->name == xa_res ) { res = (int) props->value; mask |= 0x4; - } else if ( props->name == xa_ave_width ) { + } else if ( (Atom) props->name == xa_ave_width ) { width = (int) props->value / 10; mask |= 0x8; - } else if ( props->name == xa_spacing ) { + } else if ( (Atom) props->name == xa_spacing ) { pin->spacing = NameForAtom(props->value); mask |= 0x10; } @@ -746,8 +739,11 @@ int i; return (PclInternalFontPtr) NULL; } - if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) + if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) { + if (width == 0) + width = 1; pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */ + } pin->next = (PclInternalFontPtr)NULL; if ( prev == (PclInternalFontPtr) NULL) @@ -791,7 +787,7 @@ unsigned int byte_width; unsigned char *p; register int nbyGlyphWidth; unsigned char *pglyph, *pg; -int i, j; +unsigned int i, j; pcd->h_offset = pci->metrics.leftSideBearing; pcd->v_offset = pci->metrics.ascent; @@ -868,7 +864,7 @@ Atom dest; pfi = (FontInfoRec *)&pfont->info; props = pfi->props; for (i=0; i<pfi->nprops; i++, props++) { - if ( props->name == dest && props->value == 2 ) + if ( (Atom) props->name == dest && props->value == 2 ) return INTERNAL_FONT; } return DOWNLOAD_FONT; diff --git a/Xprint/pcl/PclWindow.c b/Xprint/pcl/PclWindow.c index 7c830b897..b58bd43a1 100644 --- a/Xprint/pcl/PclWindow.c +++ b/Xprint/pcl/PclWindow.c @@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclWindow.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */ #include <stdio.h> #include <string.h> +#include <sys/types.h> #include <sys/wait.h> #include "mistruct.h" @@ -57,8 +59,7 @@ copyright holders. #include "Pcl.h" -extern WindowPtr *WindowTable; - +#if 0 /* * The following list of strings defines the properties which will be * placed on the screen's root window if the property was defined in @@ -75,7 +76,7 @@ static /* const */ char *propStrings[] = { DT_PRINT_PAGE_COMMAND, (char *)NULL }; - +#endif /* * PclCreateWindow - watch for the creation of the root window. @@ -207,7 +208,6 @@ PclPaintWindow( RegionPtr pRegion, int what) { - int status; WindowPtr pRoot; #define FUNCTION 0 @@ -367,13 +367,13 @@ PclPaintWindow( } break; case GCClipMask: - if ((pointer) pGC->clientClipType != (pointer)CT_NONE) { + if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) { gcmask |= index; gcval[i++] = (pointer)CT_NONE; } break; case GCSubwindowMode: - if ((pointer) pGC->subWindowMode != newValues[SUBWINDOW]) { + if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) { gcmask |= index; gcval[i++] = newValues[SUBWINDOW]; } @@ -387,7 +387,7 @@ PclPaintWindow( } break; case GCFillStyle: - if ((pointer) pGC->fillStyle != newValues[FILLSTYLE]) { + if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) { gcmask |= index; gcval[i++] = newValues[FILLSTYLE]; } diff --git a/Xprint/pcl/Pclmap.h b/Xprint/pcl/Pclmap.h index ecec35776..1386b0ab4 100644 --- a/Xprint/pcl/Pclmap.h +++ b/Xprint/pcl/Pclmap.h @@ -30,166 +30,180 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ +/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pclmap.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */ #ifndef _PCLMAP_H_ #define _PCLMAP_H_ #ifdef XP_PCL_COLOR -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define NAME(subname) PclCr##subname +#ifdef CATNAME +#undef CATNAME +#endif +#if !defined(UNIXCPP) || defined(ANSICPP) +#define PCLNAME(subname) PclCr##subname #define CATNAME(prefix,subname) prefix##Color##subname #else -#define NAME(subname) PclCr/**/subname +#define PCLNAME(subname) PclCr/**/subname #define CATNAME(prefix,subname) prefix/**/Color/**/subname #endif #endif /* XP_PCL_COLOR */ #ifdef XP_PCL_MONO -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define NAME(subname) PclMn##subname +#ifdef CATNAME +#undef CATNAME +#endif +#if !defined(UNIXCPP) || defined(ANSICPP) +#define PCLNAME(subname) PclMn##subname #define CATNAME(prefix,subname) prefix##Mono##subname #else -#define NAME(subname) PclMn/**/subname +#define PCLNAME(subname) PclMn/**/subname #define CATNAME(prefix,subname) prefix/**/Mono/**/subname #endif #endif /* XP_PCL_MONO */ #ifdef XP_PCL_LJ3 -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define NAME(subname) PclLj3##subname +#ifdef CATNAME +#undef CATNAME +#endif +#if !defined(UNIXCPP) || defined(ANSICPP) +#define PCLNAME(subname) PclLj3##subname #define CATNAME(prefix,subname) prefix##Lj3##subname #else -#define NAME(subname) PclLj3/**/subname +#define PCLNAME(subname) PclLj3/**/subname #define CATNAME(prefix,subname) prefix/**/Lj3/**/subname #endif #endif /* XP_PCL_LJ3 */ +#ifdef PCLNAME + /* PclInit.c */ #define InitializePclDriver CATNAME(Initialize, PclDriver) -#define PclCloseScreen NAME(CloseScreen) -#define PclGetContextFromWindow NAME(GetContextFromWindow) -#define PclScreenPrivateIndex NAME(ScreenPrivateIndex) -#define PclWindowPrivateIndex NAME(WindowPrivateIndex) -#define PclContextPrivateIndex NAME(ContextPrivateIndex) -#define PclPixmapPrivateIndex NAME(PixmapPrivateIndex) -#define PclGCPrivateIndex NAME(GCPrivateIndex) +#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) /* PclPrint.c */ -#define PclStartJob NAME(StartJob) -#define PclEndJob NAME(EndJob) -#define PclStartPage NAME(StartPage) -#define PclEndPage NAME(EndPage) -#define PclStartDoc NAME(StartDoc) -#define PclEndDoc NAME(EndDoc) -#define PclDocumentData NAME(DocumentData) -#define PclGetDocumentData NAME(GetDocumentData) +#define PclStartJob PCLNAME(StartJob) +#define PclEndJob PCLNAME(EndJob) +#define PclStartPage PCLNAME(StartPage) +#define PclEndPage PCLNAME(EndPage) +#define PclStartDoc PCLNAME(StartDoc) +#define PclEndDoc PCLNAME(EndDoc) +#define PclDocumentData PCLNAME(DocumentData) +#define PclGetDocumentData PCLNAME(GetDocumentData) /* PclWindow.c */ -#define PclCreateWindow NAME(CreateWindow) -#define PclMapWindow NAME(MapWindow) -#define PclPositionWindow NAME(PositionWindow) -#define PclUnmapWindow NAME(UnmapWindow) -#define PclCopyWindow NAME(CopyWindow) -#define PclChangeWindowAttributes NAME(ChangeWindowAttributes) -#define PclPaintWindow NAME(PaintWindow) -#define PclDestroyWindow NAME(DestroyWindow) +#define PclCreateWindow PCLNAME(CreateWindow) +#define PclMapWindow PCLNAME(MapWindow) +#define PclPositionWindow PCLNAME(PositionWindow) +#define PclUnmapWindow PCLNAME(UnmapWindow) +#define PclCopyWindow PCLNAME(CopyWindow) +#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes) +#define PclPaintWindow PCLNAME(PaintWindow) +#define PclDestroyWindow PCLNAME(DestroyWindow) /* PclGC.c */ -#define PclCreateGC NAME(CreateGC) -#define PclDestroyGC NAME(DestroyGC) -#define PclGetDrawablePrivateStuff NAME(GetDrawablePrivateStuff) -#define PclSetDrawablePrivateGC NAME(SetDrawablePrivateGC) -#define PclSendPattern NAME(SendPattern) -#define PclUpdateDrawableGC NAME(UpdateDrawableGC) -#define PclComputeCompositeClip NAME(ComputeCompositeClip) -#define PclValidateGC NAME(ValidateGC) +#define PclCreateGC PCLNAME(CreateGC) +#define PclDestroyGC PCLNAME(DestroyGC) +#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff) +#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC) +#define PclSendPattern PCLNAME(SendPattern) +#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC) +#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip) +#define PclValidateGC PCLNAME(ValidateGC) /* PclAttr.c */ -#define PclGetAttributes NAME(GetAttributes) -#define PclGetOneAttribute NAME(GetOneAttribute) -#define PclAugmentAttributes NAME(AugmentAttributes) -#define PclSetAttributes NAME(SetAttributes) +#define PclGetAttributes PCLNAME(GetAttributes) +#define PclGetOneAttribute PCLNAME(GetOneAttribute) +#define PclAugmentAttributes PCLNAME(AugmentAttributes) +#define PclSetAttributes PCLNAME(SetAttributes) /* PclColor.c */ -#define PclLookUp NAME(LookUp) -#define PclCreateDefColormap NAME(CreateDefColormap) -#define PclCreateColormap NAME(CreateColormap) -#define PclDestroyColormap NAME(DestroyColormap) -#define PclInstallColormap NAME(InstallColormap) -#define PclUninstallColormap NAME(UninstallColormap) -#define PclListInstalledColormaps NAME(ListInstalledColormaps) -#define PclStoreColors NAME(StoreColors) -#define PclResolveColor NAME(ResolveColor) -#define PclFindPaletteMap NAME(FindPaletteMap) -#define PclUpdateColormap NAME(UpdateColormap) -#define PclReadMap NAME(ReadMap) +#define PclLookUp PCLNAME(LookUp) +#define PclCreateDefColormap PCLNAME(CreateDefColormap) +#define PclCreateColormap PCLNAME(CreateColormap) +#define PclDestroyColormap PCLNAME(DestroyColormap) +#define PclInstallColormap PCLNAME(InstallColormap) +#define PclUninstallColormap PCLNAME(UninstallColormap) +#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps) +#define PclStoreColors PCLNAME(StoreColors) +#define PclResolveColor PCLNAME(ResolveColor) +#define PclFindPaletteMap PCLNAME(FindPaletteMap) +#define PclUpdateColormap PCLNAME(UpdateColormap) +#define PclReadMap PCLNAME(ReadMap) /* PclPixmap.c */ -#define PclCreatePixmap NAME(CreatePixmap) -#define PclDestroyPixmap NAME(DestroyPixmap) +#define PclCreatePixmap PCLNAME(CreatePixmap) +#define PclDestroyPixmap PCLNAME(DestroyPixmap) /* PclArc.c */ -#define PclDoArc NAME(DoArc) -#define PclPolyArc NAME(PolyArc) -#define PclPolyFillArc NAME(PolyFillArc) +#define PclDoArc PCLNAME(DoArc) +#define PclPolyArc PCLNAME(PolyArc) +#define PclPolyFillArc PCLNAME(PolyFillArc) /* PclArea.c */ -#define PclPutImage NAME(PutImage) -#define PclCopyArea NAME(CopyArea) -#define PclCopyPlane NAME(CopyPlane) +#define PclPutImage PCLNAME(PutImage) +#define PclCopyArea PCLNAME(CopyArea) +#define PclCopyPlane PCLNAME(CopyPlane) /* PclLine */ -#define PclPolyLine NAME(PolyLine) -#define PclPolySegment NAME(PolySegment) +#define PclPolyLine PCLNAME(PolyLine) +#define PclPolySegment PCLNAME(PolySegment) /* PclPixel.c */ -#define PclPolyPoint NAME(PolyPoint) -#define PclPushPixels NAME(PushPixels) +#define PclPolyPoint PCLNAME(PolyPoint) +#define PclPushPixels PCLNAME(PushPixels) /* PclPolygon.c */ -#define PclPolyRectangle NAME(PolyRectangle) -#define PclFillPolygon NAME(FillPolygon) -#define PclPolyFillRect NAME(PolyFillRect) +#define PclPolyRectangle PCLNAME(PolyRectangle) +#define PclFillPolygon PCLNAME(FillPolygon) +#define PclPolyFillRect PCLNAME(PolyFillRect) /* PclSpans.c */ -#define PclFillSpans NAME(FillSpans) -#define PclSetSpans NAME(SetSpans) +#define PclFillSpans PCLNAME(FillSpans) +#define PclSetSpans PCLNAME(SetSpans) /* PclText.c */ -#define PclPolyText8 NAME(PolyText8) -#define PclPolyText16 NAME(PolyText16) -#define PclImageText8 NAME(ImageText8) -#define PclImageText16 NAME(ImageText16) -#define PclImageGlyphBlt NAME(ImageGlyphBlt) -#define PclPolyGlyphBlt NAME(PolyGlyphBlt) -#define PclPolyGlyphBlt NAME(PolyGlyphBlt) +#define PclPolyText8 PCLNAME(PolyText8) +#define PclPolyText16 PCLNAME(PolyText16) +#define PclImageText8 PCLNAME(ImageText8) +#define PclImageText16 PCLNAME(ImageText16) +#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt) +#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt) +#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt) /* PclFonts.c */ -#define PclRealizeFont NAME(RealizeFont) -#define PclUnrealizeFont NAME(UnrealizeFont) +#define PclRealizeFont PCLNAME(RealizeFont) +#define PclUnrealizeFont PCLNAME(UnrealizeFont) /* PclSFonts.c */ -#define PclDownloadSoftFont8 NAME(DownloadSoftFont8) -#define PclDownloadSoftFont16 NAME(DownloadSoftFont16) -#define PclCreateSoftFontInfo NAME(CreateSoftFontInfo) -#define PclDestroySoftFontInfo NAME(DestroySoftFontInfo) +#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8) +#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16) +#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo) +#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo) /* PclMisc.c */ -#define PclQueryBestSize NAME(QueryBestSize) -#define GetPropString NAME(GetPropString) -#define SystemCmd NAME(SystemCmd) -#define PclGetMediumDimensions NAME(GetMediumDimensions) -#define PclGetReproducibleArea NAME(GetReproducibleArea) -#define PclSpoolFigs NAME(SpoolFigs) -#define PclSendData NAME(SendData) +#define PclQueryBestSize PCLNAME(QueryBestSize) +#define GetPropString PCLNAME(GetPropString) +#define SystemCmd PCLNAME(SystemCmd) +#define PclGetMediumDimensions PCLNAME(GetMediumDimensions) +#define PclGetReproducibleArea PCLNAME(GetReproducibleArea) +#define PclSpoolFigs PCLNAME(SpoolFigs) +#define PclSendData PCLNAME(SendData) /* PclCursor.c */ -#define PclConstrainCursor NAME(ConstrainCursor) -#define PclCursorLimits NAME(CursorLimits) -#define PclDisplayCursor NAME(DisplayCursor) -#define PclRealizeCursor NAME(RealizeCursor) -#define PclUnrealizeCursor NAME(UnrealizeCursor) -#define PclRecolorCursor NAME(RecolorCursor) -#define PclSetCursorPosition NAME(SetCursorPosition) +#define PclConstrainCursor PCLNAME(ConstrainCursor) +#define PclCursorLimits PCLNAME(CursorLimits) +#define PclDisplayCursor PCLNAME(DisplayCursor) +#define PclRealizeCursor PCLNAME(RealizeCursor) +#define PclUnrealizeCursor PCLNAME(UnrealizeCursor) +#define PclRecolorCursor PCLNAME(RecolorCursor) +#define PclSetCursorPosition PCLNAME(SetCursorPosition) + +#endif #endif /* _PCLMAP_H_ */ |