summaryrefslogtreecommitdiff
path: root/Xprint/ps
diff options
context:
space:
mode:
Diffstat (limited to 'Xprint/ps')
-rw-r--r--Xprint/ps/Ps.h56
-rw-r--r--Xprint/ps/PsArea.c138
-rw-r--r--Xprint/ps/PsAttVal.c11
-rw-r--r--Xprint/ps/PsAttr.c2
-rw-r--r--Xprint/ps/PsCache.c194
-rw-r--r--Xprint/ps/PsColor.c2
-rw-r--r--Xprint/ps/PsFonts.c9
-rw-r--r--Xprint/ps/PsGC.c6
-rw-r--r--Xprint/ps/PsInit.c61
-rw-r--r--Xprint/ps/PsLine.c1
-rw-r--r--Xprint/ps/PsMisc.c1
-rw-r--r--Xprint/ps/PsPixel.c1
-rw-r--r--Xprint/ps/PsPixmap.c12
-rw-r--r--Xprint/ps/PsPolygon.c3
-rw-r--r--Xprint/ps/PsPrint.c7
-rw-r--r--Xprint/ps/PsSpans.c12
-rw-r--r--Xprint/ps/PsText.c7
-rw-r--r--Xprint/ps/PsWindow.c14
-rw-r--r--Xprint/ps/psout.c43
-rw-r--r--Xprint/ps/psout.h15
20 files changed, 311 insertions, 284 deletions
diff --git a/Xprint/ps/Ps.h b/Xprint/ps/Ps.h
index 942e8f9f8..9c65dc26f 100644
--- a/Xprint/ps/Ps.h
+++ b/Xprint/ps/Ps.h
@@ -7,7 +7,6 @@ Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
-documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@@ -74,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/Ps.h,v 1.13 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PS_H_
#define _PS_H_
@@ -87,24 +87,11 @@ in this Software without prior written authorization from The Open Group.
#include "scrnintstr.h"
#include "dix.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 "PsDef.h"
#include "psout.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"
@@ -114,13 +101,17 @@ in this Software without prior written authorization from The Open Group.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
#define Status int
#define True 1
#define False 0
+#endif
+
#include "misc.h"
-#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
/*
* Public index variables from PsInit.c
@@ -130,7 +121,7 @@ extern int PsScreenPrivateIndex;
extern int PsWindowPrivateIndex;
extern int PsContextPrivateIndex;
extern int PsPixmapPrivateIndex;
-extern int PsGCPrivateIndex;
+extern XpValidatePoolsRec PsValidatePoolsRec;
/*
* Display list structures
@@ -255,7 +246,7 @@ typedef struct
{
XrmDatabase resDB;
ColormapPtr CMap;
- Bool (*DestroyWindow)();
+ Bool (*DestroyWindow)(WindowPtr);
} PsScreenPrivRec, *PsScreenPrivPtr;
typedef struct
@@ -278,12 +269,6 @@ typedef struct
typedef struct
{
- unsigned freeCompClip;
- RegionPtr pCompositeClip;
-} PsGCPrivRec, *PsGCPrivPtr;
-
-typedef struct
-{
XpContextPtr context;
GC lastGC;
int validGC;
@@ -296,7 +281,9 @@ typedef struct
#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
/*
* Functions in PsInit.c
@@ -304,7 +291,6 @@ typedef struct
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
char **argv);
-static Bool PsDestroyContext(XpContextPtr pCon);
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
/*
@@ -328,9 +314,6 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
*/
extern Bool PsCreateGC(GCPtr pGC);
-static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
- unsigned long *valid, PsOutPtr *psOut,
- ColormapPtr *cMap);
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
PsOutPtr *psOut, ColormapPtr *cMap);
extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
@@ -383,6 +366,9 @@ extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *pImage);
+extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *pImage);
extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int width, int height,
int dstx, int dsty);
@@ -517,4 +503,14 @@ extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
+/*
+ * Functions in PsCache.c
+ */
+
+#ifdef BM_CACHE
+extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer);
+extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer);
+extern void PsBmClearImageCache(void);
+#endif
+
#endif /* _PS_H_ */
diff --git a/Xprint/ps/PsArea.c b/Xprint/ps/PsArea.c
index 134686a87..eed650ada 100644
--- a/Xprint/ps/PsArea.c
+++ b/Xprint/ps/PsArea.c
@@ -228,7 +228,7 @@ error:
return;
}
-void
+static void
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, int imageRes, char *pImage)
{
@@ -269,9 +269,9 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
ColormapPtr cMap;
int pageRes, sw, sh;
#ifdef BM_CACHE
- long cache_id = 0;
+ long cache_id = 0;
#endif
-
+
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
if (!imageRes) {
sw = w;
@@ -296,100 +296,100 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_BeginImageCache(psOut, cache_id);
#endif
- if( depth==24 )
+ if( depth==24 )
+ {
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ if( format==XYPixmap )
{
- PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
- if( format==XYPixmap )
- {
- int rowsiz = PixmapBytePad(w, depth);
- char *planes[3];
- planes[0] = pImage;
- planes[1] = &pImage[rowsiz*h];
- planes[2] = &pImage[rowsiz*h*2];
- for( r=0 ; r<h ; r++ )
- {
- char *pt[3];
- for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
- for( c=0 ; c<w ; c++ )
- {
- for( i=0 ; i<3 ; i++ )
- { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
- }
- }
- }
- else if( format==ZPixmap )
+ int rowsiz = PixmapBytePad(w, depth);
+ char *planes[3];
+ planes[0] = pImage;
+ planes[1] = &pImage[rowsiz*h];
+ planes[2] = &pImage[rowsiz*h*2];
+ for( r=0 ; r<h ; r++ )
{
- int rowsiz = PixmapBytePad(w, depth);
- for( r=0 ; r<h ; r++ )
+ char *pt[3];
+ for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
+ for( c=0 ; c<w ; c++ )
{
- char *pt = &pImage[rowsiz*r];
- for( c=0 ; c<w ; c++,pt+=4 )
- {
- if( swap )
- {
- char tmp[4];
- tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
- PsOut_OutImageBytes(psOut, 3, &tmp[1]);
- }
- else
- PsOut_OutImageBytes(psOut, 3, &pt[1]);
- }
+ for( i=0 ; i<3 ; i++ )
+ { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
}
}
- else goto error;
- PsOut_EndImage(psOut);
}
- else if( depth==8 )
+ else if( format==ZPixmap )
{
int rowsiz = PixmapBytePad(w, depth);
- PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
- for( c=0 ; c<w ; c++,pt++ )
+ for( c=0 ; c<w ; c++,pt+=4 )
{
- int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
- char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
- tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
- PsOut_OutImageBytes(psOut, 3, &ipt[1]);
+ PsOut_OutImageBytes(psOut, 3, &pt[1]);
}
}
- PsOut_EndImage(psOut);
}
- else if( depth==1 )
+ else goto error;
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==8 )
+ {
+ int rowsiz = PixmapBytePad(w, depth);
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ for( r=0 ; r<h ; r++ )
{
+ char *pt = &pImage[rowsiz*r];
+ for( c=0 ; c<w ; c++,pt++ )
{
- int rowsiz = BitmapBytePad(w);
- int psrsiz = (w+7)/8;
- PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
- PsGetPixelColor(cMap, pGC->fgPixel),
- x, y, w, h, sw, sh, 1);
- for( r=0 ; r<h ; r++ )
+ int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
+ char *ipt = (char *)&val;
+ if( swap )
{
- char *pt = &pImage[rowsiz*r];
- for( i=0 ; i<psrsiz ; i++ )
- {
- int iv_, iv = (int)pt[i]&0xFF;
- char c;
- if( swap )
- { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
- else
- iv_ = iv;
- c = iv_;
- PsOut_OutImageBytes(psOut, 1, &c);
- }
+ char tmp[4];
+ tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
- PsOut_EndImage(psOut);
+ else
+ PsOut_OutImageBytes(psOut, 3, &ipt[1]);
}
}
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==1 )
+ {
+ {
+ int rowsiz = BitmapBytePad(w);
+ int psrsiz = (w+7)/8;
+ PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel),
+ x, y, w, h, sw, sh, 1);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( i=0 ; i<psrsiz ; i++ )
+ {
+ int iv_, iv = (int)pt[i]&0xFF;
+ char c;
+ if( swap )
+ { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
+ else
+ iv_ = iv;
+ c = iv_;
+ PsOut_OutImageBytes(psOut, 1, &c);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+ }
#ifdef BM_CACHE
- PsOut_EndImageCache(psOut);
+ PsOut_EndImageCache(psOut);
}
PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel),
PsGetPixelColor(cMap, pGC->fgPixel));
diff --git a/Xprint/ps/PsAttVal.c b/Xprint/ps/PsAttVal.c
index 83133e53a..a6a375487 100644
--- a/Xprint/ps/PsAttVal.c
+++ b/Xprint/ps/PsAttVal.c
@@ -32,6 +32,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/ps/PsAttVal.c,v 1.5 2001/12/19 21:28:44 dawes Exp $ */
#include "Ps.h"
#include "AttrValid.h"
@@ -142,6 +143,13 @@ static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
};
+/*
+** So filtered printers that accept other raw formats can be
+** used with this driver.
+**
+** Noah Roberts (jik-)
+*/
+#if 0
static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@@ -149,6 +157,7 @@ static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
static XpOidDocFmtList ValidRawFormatsSupported = {
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
};
+#endif
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@@ -196,7 +205,7 @@ XpValidatePoolsRec PsValidatePoolsRec = {
&ValidPrinterResolutions, &DefaultPrinterResolutions,
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
&ValidListfontsModes, &DefaultListfontsModes,
- &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
&ValidSetupProviso,
&DefaultDocumentFormat
};
diff --git a/Xprint/ps/PsAttr.c b/Xprint/ps/PsAttr.c
index 8a5bee9e3..13c4e1978 100644
--- a/Xprint/ps/PsAttr.c
+++ b/Xprint/ps/PsAttr.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttr.c,v 1.5 2001/12/14 19:59:15 dawes Exp $ */
/*******************************************************************
**
@@ -75,7 +76,6 @@ in this Software without prior written authorization from The Open Group.
********************************************************************/
#include "Ps.h"
-#include "attributes.h"
char *
PsGetAttributes(
diff --git a/Xprint/ps/PsCache.c b/Xprint/ps/PsCache.c
index 8c9f4a926..b688fbba1 100644
--- a/Xprint/ps/PsCache.c
+++ b/Xprint/ps/PsCache.c
@@ -79,21 +79,21 @@ in this Software without prior written authorization from The Open Group.
#include "fntfil.h"
#include "fntfilst.h"
-#define GET 0
-#define RESET 1
+#define GET 0
+#define RESET 1
struct bm_cache_list {
- struct bm_cache_list *next;
- struct bm_cache_list *prev;
+ struct bm_cache_list *next;
+ struct bm_cache_list *prev;
int height;
- long id;
+ long id;
char *pBuffer;
};
struct bm_cache_head {
- struct bm_cache_list *head;
- int width;
- struct bm_cache_head *next;
+ struct bm_cache_list *head;
+ int width;
+ struct bm_cache_head *next;
struct bm_cache_head *prev;
};
@@ -106,14 +106,14 @@ PsBmUniqueId(int func)
if(func == RESET)
{
- unique_id = 0;
- return 0;
+ unique_id = 0;
+ return 0;
}
else
- return ++unique_id;
+ return ++unique_id;
}
-int
+int
PsBmIsImageCached(
int gWidth,
int gHeight,
@@ -126,28 +126,28 @@ PsBmIsImageCached(
{
if(pList->width == gWidth)
{
- struct bm_cache_list *pItem = pList->head;
-
- while(pItem != NULL)
- {
- if(pItem->height == gHeight)
- {
- int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
-
- if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
- {
- return_val = pItem->id;
- break;
- }
- }
- else if(pItem->height > gHeight)
- break;
-
- pItem = pItem->next;
- }
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height == gHeight)
+ {
+ int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
+
+ if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
+ {
+ return_val = pItem->id;
+ break;
+ }
+ }
+ else if(pItem->height > gHeight)
+ break;
+
+ pItem = pItem->next;
+ }
}
- else if(pList->width > gWidth)
- break;
+ else if(pList->width > gWidth)
+ break;
pList = pList->next;
}
@@ -180,39 +180,39 @@ PsBmPutImageInCache(
while(pList != NULL)
{
if(pList->width == gWidth)
- {
- struct bm_cache_list *pItem = pList->head;
-
- while(pItem != NULL)
- {
- if(pItem->height >= gHeight)
- {
- pNew->next = pItem;
- pNew->prev = pItem->prev;
- if(pItem->prev != NULL)
- pItem->prev->next = pNew;
+ {
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height >= gHeight)
+ {
+ pNew->next = pItem;
+ pNew->prev = pItem->prev;
+ if(pItem->prev != NULL)
+ pItem->prev->next = pNew;
else
- pList->head = pNew;
+ pList->head = pNew;
pItem->prev = pNew;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
- else if(pItem->next == NULL)
- {
- pNew->prev = pItem;
- pItem->next = pNew;
+ break;
+ }
+ else if(pItem->next == NULL)
+ {
+ pNew->prev = pItem;
+ pItem->next = pNew;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
+ break;
+ }
- pItem = pItem->next;
- }
+ pItem = pItem->next;
+ }
- break;
+ break;
}
pList = pList->next;
@@ -223,50 +223,50 @@ PsBmPutImageInCache(
struct bm_cache_head *pNewList;
pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head));
-
+
pNewList->next = NULL;
pNewList->prev = NULL;
pNewList->width = gWidth;
pNewList->head = pNew;
-
+
if(bm_cache == NULL)
{
- bm_cache = pNewList;
- return_val = pNew->id;
+ bm_cache = pNewList;
+ return_val = pNew->id;
}
else
{
- pList = bm_cache;
+ pList = bm_cache;
- while(pList != NULL)
- {
- if(pList->width > gWidth)
- {
- pNewList->next = pList;
- pNewList->prev = pList->prev;
+ while(pList != NULL)
+ {
+ if(pList->width > gWidth)
+ {
+ pNewList->next = pList;
+ pNewList->prev = pList->prev;
- if(pList->prev != NULL)
- pList->prev->next = pNewList;
+ if(pList->prev != NULL)
+ pList->prev->next = pNewList;
else
- bm_cache = pNewList;
- pList->prev = pNewList;
+ bm_cache = pNewList;
+ pList->prev = pNewList;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
- else if(pList->next == NULL)
+ break;
+ }
+ else if(pList->next == NULL)
{
- pNewList->prev = pList;
- pList->next = pNewList;
+ pNewList->prev = pList;
+ pList->next = pNewList;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
+ break;
+ }
- pList = pList->next;
- }
+ pList = pList->next;
+ }
}
}
@@ -280,35 +280,35 @@ PsBmClearImageCacheItem(
{
if(pItem != NULL)
{
- if(pItem->pBuffer != NULL)
- free(pItem->pBuffer);
+ if(pItem->pBuffer != NULL)
+ free(pItem->pBuffer);
pItem->pBuffer = NULL;
- if(pItem->next)
- PsBmClearImageCacheItem(pItem->next);
+ if(pItem->next)
+ PsBmClearImageCacheItem(pItem->next);
pItem->next = NULL;
- free(pItem);
- pItem = NULL;
+ free(pItem);
+ pItem = NULL;
}
}
-static void
+static void
PsBmClearImageCacheList(
struct bm_cache_head *pList)
{
if(pList != NULL)
{
- if(pList->head)
- PsBmClearImageCacheItem(pList->head);
+ if(pList->head)
+ PsBmClearImageCacheItem(pList->head);
pList->head = NULL;
- if(pList->next)
- PsBmClearImageCacheList(pList->next);
+ if(pList->next)
+ PsBmClearImageCacheList(pList->next);
pList->next = NULL;
- free(pList);
- pList = NULL;
+ free(pList);
+ pList = NULL;
}
}
diff --git a/Xprint/ps/PsColor.c b/Xprint/ps/PsColor.c
index 9c76904d6..92082226f 100644
--- a/Xprint/ps/PsColor.c
+++ b/Xprint/ps/PsColor.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsColor.c,v 1.3 2001/12/14 19:59:15 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -85,7 +86,6 @@ PsCreateColormap(ColormapPtr pColor)
int i;
unsigned short rgb;
VisualPtr pVisual = pColor->pVisual;
- Pixel pix;
if( pVisual->class==TrueColor )
{
diff --git a/Xprint/ps/PsFonts.c b/Xprint/ps/PsFonts.c
index 1a4692692..15abc4b88 100644
--- a/Xprint/ps/PsFonts.c
+++ b/Xprint/ps/PsFonts.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsFonts.c,v 1.6 2001/12/19 21:55:59 dawes Exp $ */
/*******************************************************************
**
@@ -109,7 +110,7 @@ PsGetFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==name )
+ if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@@ -149,7 +150,7 @@ PsGetPSFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==name )
+ if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@@ -170,8 +171,8 @@ PsIsISOLatin1Encoding(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==reg ) rv = props[i].value;
- if( props[i].name==enc ) ev = props[i].value;
+ if( (Atom)props[i].name == reg ) rv = props[i].value;
+ if( (Atom)props[i].name == enc ) ev = props[i].value;
}
if( rv ) rp = NameForAtom(rv);
if( ev ) ep = NameForAtom(ev);
diff --git a/Xprint/ps/PsGC.c b/Xprint/ps/PsGC.c
index c6e352279..c1e12f57c 100644
--- a/Xprint/ps/PsGC.c
+++ b/Xprint/ps/PsGC.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsGC.c,v 1.6 2001/12/14 19:59:15 dawes Exp $ */
/*******************************************************************
**
@@ -144,7 +145,6 @@ PsGetDrawablePrivateStuff(
ColormapPtr *cMap)
{
XpContextPtr pCon;
- PsPixmapPrivPtr pPriv;
PsContextPrivPtr cPriv;
PsScreenPrivPtr sPriv;
@@ -229,7 +229,7 @@ PsUpdateDrawableGC(
}
}
- if( freeClip ) (*pGC->pScreen->RegionDestroy)(pReg);
+ if( freeClip ) REGION_DESTROY(pGC->pScreen, pReg);
PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
}
@@ -293,7 +293,7 @@ PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
clp->rects[i].w = (boxes[i].x2-boxes[i].x1)+1;
clp->rects[i].h = (boxes[i].y2-boxes[i].y1)+1;
}
- (*pGC->pScreen->RegionDestroy)((RegionPtr)pValue);
+ REGION_DESTROY(pGC->pScreen, (RegionPtr)pValue);
break;
case CT_UNSORTED:
case CT_YSORTED:
diff --git a/Xprint/ps/PsInit.c b/Xprint/ps/PsInit.c
index 72c83448e..fe2471185 100644
--- a/Xprint/ps/PsInit.c
+++ b/Xprint/ps/PsInit.c
@@ -71,33 +71,35 @@ in this Software without prior written authorization from The Open Group.
** * Copyright: Copyright 1996 The Open Group, Inc.
** *
** *********************************************************
-**
+**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsInit.c,v 1.13 2002/10/16 21:13:33 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "Ps.h"
+#include "mi.h"
#include "AttrValid.h"
#include "../../mfb/mfb.h"
#include "windowstr.h"
+#include "DiPrint.h"
static void AllocatePsPrivates(ScreenPtr pScreen);
static int PsInitContext(XpContextPtr pCon);
+static int PsDestroyContext(XpContextPtr pCon);
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
extern Bool cfbCreateDefColormap(ScreenPtr pScreen);
int PsScreenPrivateIndex;
int PsContextPrivateIndex;
int PsPixmapPrivateIndex;
int PsWindowPrivateIndex;
-int PsGCPrivateIndex;
Bool
InitializePsDriver(ndx, pScreen, argc, argv)
@@ -106,11 +108,7 @@ InitializePsDriver(ndx, pScreen, argc, argv)
int argc;
char **argv;
{
- int maxXres, maxYres, maxWidth, maxHeight;
- int maxRes, maxDim, numBytes;
PsScreenPrivPtr pPriv;
- char **printerNames;
- int numPrinters;
int nVisuals;
int nDepths;
VisualPtr visuals;
@@ -134,9 +132,9 @@ InitializePsDriver(ndx, pScreen, argc, argv)
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize;
- pScreen->SaveScreen = _XpBoolNoop;
- pScreen->GetImage = _XpVoidNoop;
- pScreen->GetSpans = _XpVoidNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PsCreateWindow;
pScreen->DestroyWindow = PsDestroyWindow;
pScreen->PositionWindow = PsPositionWindow;
@@ -207,18 +205,18 @@ InitializePsDriver(ndx, pScreen, argc, argv)
/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 24 BIT */
/* miScreenInit(pScreen, (pointer)0,
pScreen->width, pScreen->height,
- pScreen->width / (pScreen->mmWidth / 25.40),
+ pScreen->width / (pScreen->mmWidth / 25.40),
pScreen->height / (pScreen->mmHeight / 25.40),
0, 24, nDepths,
- depths, visuals[1].vid, nVisuals, visuals, (miBSFuncPtr)0); */
+ depths, visuals[1].vid, nVisuals, visuals); */
/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 8 BIT */
miScreenInit(pScreen, (pointer)0,
pScreen->width, pScreen->height,
- (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
+ (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
(int) (pScreen->height / (pScreen->mmHeight / 25.40)),
0, 8, nDepths,
- depths, visuals[1].vid, nVisuals, visuals, (miBSFuncPtr)0);
+ depths, visuals[1].vid, nVisuals, visuals);
if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE;
@@ -230,9 +228,9 @@ InitializePsDriver(ndx, pScreen, argc, argv)
static void
AllocatePsPrivates(ScreenPtr pScreen)
{
- static int PsGeneration = -1;
+ static unsigned long PsGeneration = 0;
- if(PsGeneration != serverGeneration)
+ if((unsigned long)PsGeneration != serverGeneration)
{
PsScreenPrivateIndex = AllocateScreenPrivateIndex();
@@ -241,13 +239,9 @@ AllocatePsPrivates(ScreenPtr pScreen)
sizeof(PsWindowPrivRec));
PsContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate(PsContextPrivateIndex,
+ XpAllocateContextPrivate(PsContextPrivateIndex,
sizeof(PsContextPrivRec));
- PsGCPrivateIndex = AllocateGCPrivateIndex();
- AllocateGCPrivate(pScreen, PsGCPrivateIndex,
- sizeof(PsGCPrivRec));
-
PsPixmapPrivateIndex = AllocatePixmapPrivateIndex();
AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex,
sizeof(PsPixmapPrivRec));
@@ -280,8 +274,7 @@ PsInitContext(pCon)
XpDriverFuncsPtr pFuncs;
PsContextPrivPtr pConPriv;
char *server, *attrStr;
- extern XpValidatePoolsRec PsValidatePoolsRec;
-
+
/*
* Initialize the attribute store for this printer.
*/
@@ -299,15 +292,15 @@ PsInitContext(pCon)
pFuncs->EndPage = PsEndPage;
pFuncs->PutDocumentData = PsDocumentData;
pFuncs->GetDocumentData = PsGetDocumentData;
- pFuncs->GetAttributes = (char *(*)())PsGetAttributes;
- pFuncs->SetAttributes = (int (*)())PsSetAttributes;
- pFuncs->AugmentAttributes = (int (*)())PsAugmentAttributes;
- pFuncs->GetOneAttribute = (char *(*)())PsGetOneAttribute;
+ pFuncs->GetAttributes = PsGetAttributes;
+ pFuncs->SetAttributes = PsSetAttributes;
+ pFuncs->AugmentAttributes = PsAugmentAttributes;
+ pFuncs->GetOneAttribute = PsGetOneAttribute;
pFuncs->DestroyContext = PsDestroyContext;
pFuncs->GetMediumDimensions = PsGetMediumDimensions;
pFuncs->GetReproducibleArea = PsGetReproducibleArea;
pFuncs->SetImageResolution = PsSetImageResolution;
-
+
/*
* Set up the context privates
*/
@@ -326,15 +319,15 @@ PsInitContext(pCon)
server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
if ((attrStr = (char *) xalloc(strlen(server) +
strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
- + strlen(PAGE_ATT_VAL) + 6)) == NULL)
+ + strlen(PAGE_ATT_VAL) + 6)) == NULL)
{
return BadAlloc;
}
- sprintf(attrStr, "*%s:\t%s %s %s",
+ sprintf(attrStr, "*%s:\t%s %s %s",
DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL);
XpAugmentAttributes( pCon, XPPrinterAttr, attrStr);
xfree(attrStr);
-
+
/*
* job-attributes-supported
*/
@@ -347,7 +340,7 @@ PsInitContext(pCon)
sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL);
XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
xfree(attrStr);
-
+
/*
* xp-page-attributes-supported
*/
@@ -378,7 +371,7 @@ PsDestroyContext(pCon)
{
PsContextPrivPtr pConPriv =
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
-
+
if( pConPriv->pJobFile!=(FILE *)NULL )
{
fclose(pConPriv->pJobFile);
diff --git a/Xprint/ps/PsLine.c b/Xprint/ps/PsLine.c
index 23e105804..ff4c6da80 100644
--- a/Xprint/ps/PsLine.c
+++ b/Xprint/ps/PsLine.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsLine.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
diff --git a/Xprint/ps/PsMisc.c b/Xprint/ps/PsMisc.c
index 86d862ce1..75f692d56 100644
--- a/Xprint/ps/PsMisc.c
+++ b/Xprint/ps/PsMisc.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsMisc.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
#include <stdio.h>
diff --git a/Xprint/ps/PsPixel.c b/Xprint/ps/PsPixel.c
index c2c360d2e..09a89fa2d 100644
--- a/Xprint/ps/PsPixel.c
+++ b/Xprint/ps/PsPixel.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixel.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include <stdio.h>
diff --git a/Xprint/ps/PsPixmap.c b/Xprint/ps/PsPixmap.c
index 2c3e43245..2e821aa1c 100644
--- a/Xprint/ps/PsPixmap.c
+++ b/Xprint/ps/PsPixmap.c
@@ -57,7 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
-
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixmap.c,v 1.5 2001/12/14 19:59:16 dawes Exp $ */
/*******************************************************************
**
** *********************************************************
@@ -79,10 +79,6 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
-#define BitsPerPixel(d) (\
- (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
- (PixmapWidthPaddingInfo[d].padRoundUp+1))
-
PixmapPtr
PsCreatePixmap(
ScreenPtr pScreen,
@@ -203,7 +199,7 @@ PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
return(disp);
}
-void
+static void
PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
{
switch(elm->type)
@@ -492,6 +488,8 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
case PolyFillArcCmd:
*nElms += elm->c.arcs.nArcs;
break;
+ default:
+ break;
}
}
}
@@ -554,6 +552,8 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
*nElms += 1;
}
break;
+ default:
+ break;
}
}
}
diff --git a/Xprint/ps/PsPolygon.c b/Xprint/ps/PsPolygon.c
index e1f0b9003..0cd826f43 100644
--- a/Xprint/ps/PsPolygon.c
+++ b/Xprint/ps/PsPolygon.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPolygon.c,v 1.7 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -175,7 +176,7 @@ PsFillPolygon(
}
else
{
- pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y;
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
for( i=1 ; i<nPoints ; i++ )
{
pts[i].x = pts[i-1].x+pPoints[i].x;
diff --git a/Xprint/ps/PsPrint.c b/Xprint/ps/PsPrint.c
index 49ed97583..8a06205e5 100644
--- a/Xprint/ps/PsPrint.c
+++ b/Xprint/ps/PsPrint.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPrint.c,v 1.11 2001/12/21 21:02:06 dawes Exp $ */
#include <stdio.h>
#include <string.h>
@@ -90,7 +91,6 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
#include "windowstr.h"
-#include "attributes.h"
#include "Oid.h"
/* static utility function to get document/page attributes */
@@ -268,7 +268,7 @@ PsEndJob(
#ifdef BM_CACHE
PsBmClearImageCache();
#endif
-
+
return r;
}
@@ -281,13 +281,10 @@ PsStartPage(
{
int iorient, iplex, icount, ires;
unsigned short iwd, iht;
- register WindowPtr pChild;
PsContextPrivPtr pConPriv =
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
PsWindowPrivPtr pWinPriv =
(PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
- char s[80];
- xEvent event;
/*
* Put a pointer to the context in the window private structure
diff --git a/Xprint/ps/PsSpans.c b/Xprint/ps/PsSpans.c
index 4d8fb3459..32ca58d20 100644
--- a/Xprint/ps/PsSpans.c
+++ b/Xprint/ps/PsSpans.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsSpans.c,v 1.9 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -87,11 +88,10 @@ PsFillSpans(
int *pWidths,
int fSorted)
{
- char t[80];
PsOutPtr psOut;
int xoffset, yoffset;
xRectangle *rects, *r;
- RegionPtr fillRegion, region;
+ RegionPtr fillRegion, region = 0;
int i;
int nbox;
BoxPtr pbox;
@@ -113,14 +113,14 @@ PsFillSpans(
r->width = pWidths[i];
r->height = 1;
}
- fillRegion = miRectsToRegion(nSpans, rects,
+ 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);
@@ -144,8 +144,8 @@ PsFillSpans(
/*
* Clean up the temporary regions
*/
- miRegionDestroy(fillRegion);
- miRegionDestroy(region);
+ REGION_DESTROY(pGC->pScreen, fillRegion);
+ REGION_DESTROY(pGC->pScreen, region);
xfree(rects);
}
diff --git a/Xprint/ps/PsText.c b/Xprint/ps/PsText.c
index 618d0a163..41ba592f6 100644
--- a/Xprint/ps/PsText.c
+++ b/Xprint/ps/PsText.c
@@ -73,11 +73,11 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsText.c,v 1.12 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
#include "windowstr.h"
-#include "fntfil.h"
#include "fntfilst.h"
#include <sys/stat.h>
@@ -85,9 +85,8 @@ static int readFontName(char *fileName, char *file_name, char *dlfnam)
{
FILE *file;
struct stat statb;
- int count, i, status;
char buf[256];
- char *front, *end, *fn;
+ char *front, *fn;
file = fopen(fileName, "r");
if(file)
@@ -389,7 +388,7 @@ PsPolyGlyphBlt(
pointer pGlyphBase)
{
int width, height;
- PixmapPtr pPixmap;
+ PixmapPtr pPixmap = NullPixmap;
int nbyLine; /* bytes per line of padded pixmap */
FontPtr pfont;
GCPtr pGCtmp;
diff --git a/Xprint/ps/PsWindow.c b/Xprint/ps/PsWindow.c
index 3a9a7ed2a..87d8143aa 100644
--- a/Xprint/ps/PsWindow.c
+++ b/Xprint/ps/PsWindow.c
@@ -73,9 +73,11 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsWindow.c,v 1.12 2001/12/19 21:55:59 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "mistruct.h"
@@ -85,8 +87,7 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.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
@@ -103,7 +104,7 @@ static char *propStrings[] = {
DT_PRINT_PAGE_COMMAND,
(char *)NULL
};
-
+#endif
/*
* PsCreateWindow - watch for the creation of the root window.
@@ -218,7 +219,6 @@ PsPaintWindow(
RegionPtr pRegion,
int what)
{
- int status;
WindowPtr pRoot;
#define FUNCTION 0
@@ -377,14 +377,14 @@ PsPaintWindow(
}
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];
@@ -398,7 +398,7 @@ PsPaintWindow(
}
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/ps/psout.c b/Xprint/ps/psout.c
index d4a64eacb..f1507d849 100644
--- a/Xprint/ps/psout.c
+++ b/Xprint/ps/psout.c
@@ -73,13 +73,24 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.c,v 1.12 2001/12/21 21:02:06 dawes Exp $ */
+
+/*
+ * For XFree86 3.3.3:
+ *
+ * As a *quick* way of preventing some buffers overflowing onto the stack,
+ * they have been made static. There are potential problems with
+ * PsOutRec.Buf overflowing too which should be investigated as part of a
+ * review of this code, but that is at least always allocated with malloc
+ * and shouldn't pose an immediate stack trashing problem.
+ *
+ */
#include <stdlib.h>
#include "os.h"
+#include "Ps.h"
#include "psout.h"
-PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
-
typedef void *voidPtr;
typedef struct PsPatRec_
@@ -398,7 +409,7 @@ static void
S_OutNum(PsOutPtr self, float num)
{
int i;
- char buf[64];
+ static char buf[64];
sprintf(buf, "%.3f", num);
for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0';
@@ -411,7 +422,7 @@ static void
S_OutStr(PsOutPtr self, char *txt, int txtl)
{
int i, k;
- char buf[512];
+ static char buf[512];
for( i=0,k=0 ; i<txtl ; i++ )
{
if( (txt[i]>=' ' && txt[i]<='~') &&
@@ -948,7 +959,7 @@ void
PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
{
int i;
- char buf[256];
+ static char buf[256];
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
siz==self->FontSize ) return;
if( self->FontName ) xfree(self->FontName);
@@ -968,7 +979,7 @@ void
PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
{
int i;
- char buf[256];
+ static char buf[256];
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
@@ -1170,7 +1181,7 @@ PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
if( self->InFrame || self->InTile ) xo = yo = 0;
x += xo; y += yo;
- sprintf(cacheID, "c%di", cache_id);
+ sprintf(cacheID, "c%ldi", cache_id);
S_OutNum(self, (float)x);
S_OutNum(self, (float)y);
@@ -1203,7 +1214,7 @@ PsOut_BeginImageCache(PsOutPtr self, long cache_id)
{
char cacheID[10];
- sprintf(cacheID, "/c%di {", cache_id);
+ sprintf(cacheID, "/c%ldi {", cache_id);
S_OutTok(self, cacheID, 0);
} /* new */
@@ -1214,7 +1225,7 @@ PsOut_EndImageCache(PsOutPtr self)
S_OutTok(self, "}bd", 1);
} /* new */
#endif
-
+
void
PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
int w, int h, int sw, int sh, int format)
@@ -1477,11 +1488,13 @@ PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
}
self->Patterns[self->NPatterns].tag = tag;
self->Patterns[self->NPatterns].type = type;
- sprintf(key, "/ %d", (int)tag);
+ sprintf(key, "/ %ld", (long)tag);
switch(type) {
case PsTile: key[1] = 't'; break;
case PsStip: key[1] = 's'; break;
- case PsOpStip: key[1] = 'o'; break; }
+ case PsOpStip: key[1] = 'o'; break;
+ default: break;
+ }
S_OutTok(self, key, 0);
S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
@@ -1522,11 +1535,13 @@ PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
for( i=0 ; i<self->NPatterns ; i++ )
{ if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
if( i>=self->NPatterns ) return;
- sprintf(key, " %d", (int)tag);
+ sprintf(key, " %ld", (long)tag);
switch(type) {
case PsTile: key[0] = 't'; break;
case PsStip: key[0] = 's'; break;
- case PsOpStip: key[0] = 'o'; break; }
+ case PsOpStip: key[0] = 'o'; break;
+ default: break;
+ }
S_OutTok(self, key, 0);
S_OutTok(self, "spt", 1);
self->CurColor = 0xFFFFFFFF;
@@ -1546,7 +1561,7 @@ PsOut_DownloadType1(PsOutPtr self, char *name, char *fname)
{
int i;
int stt;
- char buf[256];
+ static char buf[256];
FILE *fp;
for( i=0 ; i<self->NDownloads ; i++ )
diff --git a/Xprint/ps/psout.h b/Xprint/ps/psout.h
index e8ca56458..2fe83ffc7 100644
--- a/Xprint/ps/psout.h
+++ b/Xprint/ps/psout.h
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.h,v 1.5 2001/12/21 21:02:06 dawes Exp $ */
/*******************************************************************
**
@@ -182,8 +183,10 @@ extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
int bclr);
-extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
+extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
int w, int h, int sw, int sh, int format);
+extern void PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
+ int w, int h, int sw, int sh, int format);
extern void PsOut_EndImage(PsOutPtr self);
extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
@@ -199,4 +202,14 @@ extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
extern void PsOut_RawData(PsOutPtr self, char *data, int len);
extern void PsOut_DownloadType1(PsOutPtr self, char *name, char *fname);
+#ifdef BM_CACHE
+extern void PsOut_BeginImageCache(PsOutPtr self, long cache_id);
+extern void PsOut_EndImageCache(PsOutPtr self);
+extern void PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id,
+ int bclr, int fclr);
+#endif
+
+extern FILE *PsOut_ChangeFile(PsOutPtr self, FILE *fp);
+
+
#endif