Index: xc/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.851 diff -u -2 -0 -r1.851 ChangeLog --- xc/ChangeLog 1 Apr 2005 21:28:50 -0000 1.851 +++ xc/ChangeLog 1 Apr 2005 21:39:58 -0000 @@ -1,20 +1,38 @@ +2005-04-01 Roland Mainz + * xc/programs/Xserver/Xprint/Init.c + * xc/programs/Xserver/Xprint/ps/Imakefile + * xc/programs/Xserver/Xprint/ps/Ps.h + * xc/programs/Xserver/Xprint/ps/PsArea.c + * xc/programs/Xserver/Xprint/ps/PsColor.c + * xc/programs/Xserver/Xprint/ps/PsImageUtil.c + * xc/programs/Xserver/Xprint/ps/PsInit.c + * xc/programs/Xserver/Xprint/ps/psout.h + bugzilla #2879 (https://bugs.freedesktop.org/show_bug.cgi?id=2879) + attachment #xxx (https://bugs.freedesktop.org/attachment.cgi?id=xxx) + Follow-up to bugzilla #1299: Add new visuals in the Postscript DDX + (including TrueColor 16bit, PseudoColor 15bit/12bpg(12 bits per R-, + G-, B-channel as in PostScript Level 2 (and above) colors can have 12 + bits per component (36 bit for RGB)), PseudoColor+GrayScale+StaticGray + 12bit/12bpg) and switch the default visual from PseudoColor 8bit/8bpg + to PseudoColor 12bit/12bpg. + 2005-04-01 Matthieu Herrb * programs/Xserver/hw/xfree86/loader/xf86sym.c * programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c Fix setjump0 declaration for DllLoader. 2005-04-01 Kevin E. Martin * programs/Xserver/hw/xfree86/int10/helper_exec.c: (x_inl), (x_outl), (pciCfg1out): bugzilla #2880 (https://bugs.freedesktop.org/show_bug.cgi?id=2880) attachment #2285 (https://bugs.freedesktop.org/attachment.cgi?id=2285) Use system method to access PCI config space. 2005-04-01 Adam Jackson * programs/Xserver/hw/xfree86/loader/dixsym.c: Bug #2835: Add symbol exports to support the ReadDisplay extension. 2005-04-01 Alan Hourihane Index: xc/programs/Xserver/Xprint/Init.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/Init.c,v retrieving revision 1.10 diff -u -2 -0 -r1.10 Init.c --- xc/programs/Xserver/Xprint/Init.c 23 Mar 2005 19:58:45 -0000 1.10 +++ xc/programs/Xserver/Xprint/Init.c 1 Apr 2005 21:40:13 -0000 @@ -147,40 +147,42 @@ static PixmapFormatRec MonoPclPixmapFormats[] = { { 1, 1, BITMAP_SCANLINE_PAD } }; #define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0]) #endif #if defined(XPPCLDDX) || defined(XPMONOPCLDDX) #include "pcl/Pcl.h" #endif #ifdef XPPSDDX static PixmapFormatRec PSPixmapFormats[] = { { 1, 1, BITMAP_SCANLINE_PAD }, { 8, 8, BITMAP_SCANLINE_PAD }, { 12, 16, BITMAP_SCANLINE_PAD }, + { 15, 16, BITMAP_SCANLINE_PAD }, + { 16, 16, BITMAP_SCANLINE_PAD }, { 24, 32, BITMAP_SCANLINE_PAD } }; #define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0]) #include "ps/Ps.h" #endif /* * The driverInitArray contains an entry for each driver the * server knows about. Each element contains pointers to pixmap formats, the * driver's initialization routine, and pointers to the driver's * attribute validation rec, and/or a driver function which * returns the maximum medium width&height, and maximum resolution * given a printer name. Either the validation rec OR the dimension * function can be NULL. If the function is non-NULL then it * will be called, and will be passed the (possibly NULL) validation rec. * If the function is NULL, then XpGetMaxWidthHeightRes() is called. */ Index: xc/programs/Xserver/Xprint/ps/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/Imakefile,v retrieving revision 1.8 diff -u -2 -0 -r1.8 Imakefile --- xc/programs/Xserver/Xprint/ps/Imakefile 25 Mar 2005 23:11:14 -0000 1.8 +++ xc/programs/Xserver/Xprint/ps/Imakefile 1 Apr 2005 21:40:13 -0000 @@ -10,76 +10,76 @@ TTF2PT1OURCEDIR = $(TOP)/extras/ttf2pt1 FT_DEFINES = -DXP_USE_FREETYPE FTSRCS = psout_ft.c psout_ftpstype1.c psout_ftpstype3.c PsFTFonts.c FTOBJS = psout_ft.o psout_ftpstype1.o psout_ftpstype3.o PsFTFonts.o #if !defined (LynxOSArchitecture) TTF2PT1SRCFILE = ttf2pt1.c TTF2PT1OBJFILE = ttf2pt1.o #else TTF2PT1SRCFILE = ttf2pt1wrap.c TTF2PT1OBJFILE = ttf2pt1wrap.o #endif TTF2PT1SRCS = ft.c pt1.c runt1asm.c $(TTF2PT1SRCFILE) TTF2PT1OBJS = ft.o pt1.o runt1asm.o $(TTF2PT1OBJFILE) TTF2PT1_DEFINES = -DUSE_FREETYPE -DXP_ONLY_BLOCKS #endif /* BuildFreeType || BuildFreetype2Library */ SRCS1 = PsInit.c PsPrint.c PsGC.c PsMisc.c PsSpans.c PsArea.c PsPixel.c \ PsLine.c PsPolygon.c PsArc.c PsText.c PsWindow.c PsFonts.c \ - PsAttr.c PsAttVal.c PsColor.c PsPixmap.c psout.c PsCache.c + PsAttr.c PsAttVal.c PsColor.c PsPixmap.c psout.c PsCache.c PsImageUtil.c OBJS1 = PsInit.o PsPrint.o PsGC.o PsMisc.o PsSpans.o PsArea.o PsPixel.o \ PsLine.o PsPolygon.o PsArc.o PsText.o PsWindow.o PsFonts.o \ - PsAttr.o PsAttVal.o PsColor.o PsPixmap.o psout.o PsCache.o + PsAttr.o PsAttVal.o PsColor.o PsPixmap.o psout.o PsCache.o PsImageUtil.o SRCS = $(SRCS1) $(TTF2PT1SRCS) $(FTSRCS) OBJS = $(OBJS1) $(TTF2PT1OBJS) $(FTOBJS) #if BuildFreeType || BuildFreetype2Library LinkSourceFile(ttf2pt1.c,$(TTF2PT1OURCEDIR)/) LinkSourceFile(pt1.c,$(TTF2PT1OURCEDIR)/) LinkSourceFile(pt1.h,$(TTF2PT1OURCEDIR)/) LinkSourceFile(ft.c,$(TTF2PT1OURCEDIR)/) LinkSourceFile(runt1asm.c,$(TTF2PT1OURCEDIR)/) LinkSourceFile(t1asm.c,$(TTF2PT1OURCEDIR)/) LinkSourceFile(ttf.h,$(TTF2PT1OURCEDIR)/) LinkSourceFile(global.h,$(TTF2PT1OURCEDIR)/) LinkSourceFile(version.h,$(TTF2PT1OURCEDIR)/) #endif /* BuildFreeType || BuildFreetype2Library */ #ifdef XVendorString VENDORSTRING = XVendorString VENDOR_STRING = -DVENDOR_STRING=\"$(VENDORSTRING)\" #endif #ifdef XVendorRelease VENDORRELEASE = XVendorRelease VENDOR_RELEASE = -DVENDOR_RELEASE="$(VENDORRELEASE)" #endif VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) XCOMM DEFINES = -DPIXPRIV XCOMM BM_CACHE disabled because it causes PostScript errors XCOMM (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1489) -XCOMM DEFINES = -DXP_PSTEXT -DBM_CACHE $(VENDOR_DEFINES) $(TTF2PT1_DEFINES) $(FT_DEFINES) - DEFINES = -UXFree86LOADER -DXP_PSTEXT -D_XP_PRINT_SERVER_ $(VENDOR_DEFINES) $(TTF2PT1_DEFINES) $(FT_DEFINES) $(EXT_DEFINES) +XCOMM DEFINES = -DPSOUT_USE_DEEPCOLOR -DXP_PSTEXT -DBM_CACHE $(VENDOR_DEFINES) $(TTF2PT1_DEFINES) $(FT_DEFINES) + DEFINES = -UXFree86LOADER -DPSOUT_USE_DEEPCOLOR -DXP_PSTEXT -D_XP_PRINT_SERVER_ $(VENDOR_DEFINES) $(TTF2PT1_DEFINES) $(FT_DEFINES) $(EXT_DEFINES) INCLUDES = -I. -I../../mi -I../../mfb -I$(LIBSRC) \ -I$(XINCLUDESRC) -I../../include -I.. -I$(TOP)/include \ -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(FONTLIBSRC)/include \ $(FT2INCS) -I../../../../lib/font/FreeType LINTLIBS = $(TOP)/server/dix/llib-ldix.ln $(TOP)/server/os/llib-los.ln \ $(TOP)/server/ddx/mfb/llib-lmfb.ln \ $(TOP)/server/ddx/mi/llib-lmi.ln NormalLibraryObjectRule() NormalLibraryTarget(ps,$(OBJS)) NormalLintTarget($(SRCS1) $(SRCS2)) DependTarget() Index: xc/programs/Xserver/Xprint/ps/Ps.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/Ps.h,v retrieving revision 1.6 diff -u -2 -0 -r1.6 Ps.h --- xc/programs/Xserver/Xprint/ps/Ps.h 10 Jan 2005 14:16:29 -0000 1.6 +++ xc/programs/Xserver/Xprint/ps/Ps.h 1 Apr 2005 21:40:13 -0000 @@ -558,21 +558,29 @@ /* * Functions in PsPixmap.c */ extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height, int depth); extern void PsScrubPixmap(PixmapPtr pPixmap); extern Bool PsDestroyPixmap(PixmapPtr pPixmap); extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv); extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable); extern int PsCloneDisplayElm(PixmapPtr dst, DisplayElmPtr elm, DisplayElmPtr newElm, int xoff, int yoff); extern void PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff, int yoff, int x, int y, int w, int h); extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms); extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms); extern void PsDestroyFillElementList(int nElms, PsElmPtr elms); +/* + * Functions in PsImageUtil.c + */ + +extern unsigned long +PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format, + int px, int py); + #endif /* _PS_H_ */ Index: xc/programs/Xserver/Xprint/ps/PsArea.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/PsArea.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 PsArea.c --- xc/programs/Xserver/Xprint/ps/PsArea.c 4 Oct 2004 05:04:14 -0000 1.3 +++ xc/programs/Xserver/Xprint/ps/PsArea.c 1 Apr 2005 21:40:14 -0000 @@ -61,432 +61,284 @@ /******************************************************************* ** ** ********************************************************* ** * ** * File: PsArea.c ** * ** * Contents: Image and Area functions for the PS DDX driver ** * ** * Created By: Roger Helmendach (Liberty Systems) ** * ** * Copyright: Copyright 1996 The Open Group, Inc. ** * ** ********************************************************* ** ********************************************************************/ #include "Ps.h" #include "gcstruct.h" #include "windowstr.h" + void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, int imageRes, char *pImage) { if( pDrawable->type==DRAWABLE_PIXMAP ) { int size = PixmapBytePad(w, depth)*h; DisplayElmPtr elm; PixmapPtr pix = (PixmapPtr)pDrawable; PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; DisplayListPtr disp; GCPtr gc; if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; disp = PsGetFreeDisplayBlock(priv); elm = &disp->elms[disp->nelms]; elm->type = PutImageCmd; elm->gc = gc; elm->c.image.depth = depth; elm->c.image.x = x; elm->c.image.y = y; elm->c.image.w = w; elm->c.image.h = h; elm->c.image.leftPad = leftPad; elm->c.image.format = format; elm->c.image.res = imageRes; elm->c.image.pData = (char *)xalloc(size); memcpy(elm->c.image.pData, pImage, size); disp->nelms += 1; } else { int i, j; int r, c; - int swap; char *pt; PsOutPtr psOut; ColormapPtr cMap; int pageRes, sw, sh; if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; if (!imageRes) { sw = w; sh = h; } else { pageRes = XpGetResolution(XpGetPrintContext(requestingClient)); sw = (float)w * (float)pageRes / (float)imageRes + 0.5; sh = (float)h * (float)pageRes / (float)imageRes + 0.5; } PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - pt = (char *)(&i); i = 1; if( pt[0]=='\001' ) swap = 1; else swap = 0; -#ifdef PSOUT_USE_DEEPCOLOR - if( depth==30 ) - { - ErrorF("PsPutScaledImage: Not implemented yet for 30bit\m"); - } - else -#endif /* PSOUT_USE_DEEPCOLOR */ - if( depth==24 ) - { - PsOut_BeginImage(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 8) && (depth < 16) ) + if( depth!=1 ) { - int rowsiz = PixmapBytePad(w, depth); PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3); + for( r=0 ; rbgPixel), + PsGetPixelColor(cMap, pGC->fgPixel), + x, y, w, h, sw, sh, 1); for( r=0 ; r>j)&1)<<(7-j)); } +#elif IMAGE_BYTE_ORDER == MSBFirst + iv_ = iv; +#else +#error Unsupported byte order +#endif + c = iv_; + PsOut_OutImageBytes(psOut, 1, &c); } } PsOut_EndImage(psOut); } - else if( depth==1 ) - { - { - int rowsiz = BitmapBytePad(w); - int psrsiz = (w+7)/8; - PsOut_BeginImage(psOut, PsGetPixelColor(cMap, pGC->bgPixel), - PsGetPixelColor(cMap, pGC->fgPixel), - x, y, w, h, sw, sh, 1); - for( r=0 ; r>j)&1)<<(7-j)); } - else - iv_ = iv; - c = iv_; - PsOut_OutImageBytes(psOut, 1, &c); - } - } - PsOut_EndImage(psOut); - } - } } -error: - return; } void PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, int imageRes, char *pImage) { if( pDrawable->type==DRAWABLE_PIXMAP ) { int size = PixmapBytePad(w, depth)*h; DisplayElmPtr elm; PixmapPtr pix = (PixmapPtr)pDrawable; PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; DisplayListPtr disp; GCPtr gc; if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; disp = PsGetFreeDisplayBlock(priv); elm = &disp->elms[disp->nelms]; elm->type = PutImageCmd; elm->gc = gc; elm->c.image.depth = depth; elm->c.image.x = x; elm->c.image.y = y; elm->c.image.w = w; elm->c.image.h = h; elm->c.image.leftPad = leftPad; elm->c.image.format = format; elm->c.image.res = imageRes; elm->c.image.pData = (char *)xalloc(size); memcpy(elm->c.image.pData, pImage, size); disp->nelms += 1; } else { int i, j; int r, c; - int swap; char *pt; PsOutPtr psOut; ColormapPtr cMap; int pageRes, sw, sh; #ifdef BM_CACHE long cache_id = 0; #endif if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; if (!imageRes) { sw = w; sh = h; } else { pageRes = XpGetResolution(XpGetPrintContext(requestingClient)); sw = (float)w * (float)pageRes / (float)imageRes + 0.5; sh = (float)h * (float)pageRes / (float)imageRes + 0.5; } PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - pt = (char *)(&i); i = 1; if( pt[0]=='\001' ) swap = 1; else swap = 0; #ifdef BM_CACHE cache_id = PsBmIsImageCached(w, h, pImage); if(!cache_id) { cache_id = PsBmPutImageInCache(w, h, pImage); if(!cache_id) return; PsOut_BeginImageCache(psOut, cache_id); #endif - -#ifdef PSOUT_USE_DEEPCOLOR - if( depth==30 ) - { - ErrorF("PsPutScaledImageIM: Not implemented yet for 30bit\m"); - } - else -#endif /* PSOUT_USE_DEEPCOLOR */ - if( depth==24 ) - { - 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 8) && (depth < 16) ) + if( depth!=1 ) { - int rowsiz = PixmapBytePad(w, depth); - PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3); - for( r=0 ; rbgPixel), + 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>j)&1)<<(7-j)); } - else - iv_ = iv; - c = iv_; - PsOut_OutImageBytes(psOut, 1, &c); - } + int iv_, iv = (int)pt[i]&0xFF; + char c; +/* XXX: Is this the right way to detect the platform endianess ? */ +#if IMAGE_BYTE_ORDER == LSBFirst + { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); } +#elif IMAGE_BYTE_ORDER == MSBFirst + iv_ = iv; +#else +#error Unsupported byte order +#endif + c = iv_; + PsOut_OutImageBytes(psOut, 1, &c); } - PsOut_EndImage(psOut); } + PsOut_EndImage(psOut); } #ifdef BM_CACHE PsOut_EndImageCache(psOut); } PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel), PsGetPixelColor(cMap, pGC->fgPixel)); #endif } -error: - return; } void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { XpContextPtr pcon; if (requestingClient && (pcon = XpGetPrintContext(requestingClient))) PsPutScaledImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pcon->imageRes, pImage); } void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { XpContextPtr pcon; if (requestingClient && (pcon = XpGetPrintContext(requestingClient))) PsPutScaledImageIM(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pcon->imageRes, pImage); } Index: xc/programs/Xserver/Xprint/ps/PsColor.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/PsColor.c,v retrieving revision 1.5 diff -u -2 -0 -r1.5 PsColor.c --- xc/programs/Xserver/Xprint/ps/PsColor.c 15 Oct 2004 22:08:38 -0000 1.5 +++ xc/programs/Xserver/Xprint/ps/PsColor.c 1 Apr 2005 21:40:14 -0000 @@ -134,53 +134,56 @@ void PsResolveColor( unsigned short *pRed, unsigned short *pGreen, unsigned short *pBlue, VisualPtr pVisual) { miResolveColor(pRed, pGreen, pBlue, pVisual); } PsOutColor PsGetPixelColor(ColormapPtr cMap, int pixval) { VisualPtr v = cMap->pVisual; switch( v->class ) { case TrueColor: { PsOutColor p = pixval; PsOutColor r, g, b; -#ifdef PSOUT_USE_DEEPCOLOR - int shift = 16 - v->bitsPerRGBValue; -#else - int shift = 8 - v->bitsPerRGBValue; -#endif /* PSOUT_USE_DEEPCOLOR */ - - r = ((p & v->redMask) >> v->offsetRed) << shift; - g = ((p & v->greenMask) >> v->offsetGreen) << shift; - b = ((p & v->blueMask) >> v->offsetBlue) << shift; + r = (p & v->redMask) >> v->offsetRed; + g = (p & v->greenMask) >> v->offsetGreen; + b = (p & v->blueMask) >> v->offsetBlue; + + r = cMap->red[r].co.local.red; + g = cMap->green[g].co.local.green; + b = cMap->blue[b].co.local.blue; + #ifdef PSOUT_USE_DEEPCOLOR return((r<<32)|(g<<16)|b); #else + r >>= 8; + g >>= 8; + b >>= 8; + return((r<<16)|(g<<8)|b); #endif /* PSOUT_USE_DEEPCOLOR */ } case PseudoColor: case GrayScale: case StaticGray: { PsOutColor r, g, b; if( pixval < 0 || pixval > v->ColormapEntries) return(0); r = cMap->red[pixval].co.local.red; g = cMap->red[pixval].co.local.green; b = cMap->red[pixval].co.local.blue; if ((v->class | DynamicClass) == GrayScale) { /* rescale to gray (see |miResolveColor()|) */ r = g = b = (30L*r + 59L*g + 11L*b) / 100L; Index: xc/programs/Xserver/Xprint/ps/PsImageUtil.c =================================================================== RCS file: xc/programs/Xserver/Xprint/ps/PsImageUtil.c diff -N xc/programs/Xserver/Xprint/ps/PsImageUtil.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/programs/Xserver/Xprint/ps/PsImageUtil.c 1 Apr 2005 21:40:14 -0000 @@ -0,0 +1,325 @@ + +/* $Xorg: PsImageUtil.c,v 1.1 2005/03/25 1:19:56 gisburn Exp $ */ +/* +Copyright (c) 2005 Roland Mainz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the names of the copyright holders shall +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. +*/ + +/* Please do not beat me for this ugly code - most of it has been stolen from + * xc/lib/X11/ImUtil.c */ + +#include "gcstruct.h" +#include "windowstr.h" +#include "servermd.h" +#include "attributes.h" + +static unsigned char const _reverse_byte[0x100] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff +}; + +static +int XReverse_Bytes( + register unsigned char *bpt, + register int nb) +{ + do { + *bpt = _reverse_byte[*bpt]; + bpt++; + } while (--nb > 0); + return 0; +} + +/* + * Data structure for "image" data, used by image manipulation routines. + */ +typedef struct { + int width, height; /* size of image */ + int xoffset; /* number of pixels offset in X direction */ + int format; /* XYBitmap, XYPixmap, ZPixmap */ + char *data; /* pointer to image data */ + int byte_order; /* data byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* quant. of scanline 8, 16, 32 */ + int bitmap_bit_order; /* LSBFirst, MSBFirst */ + int depth; /* depth of image */ + int bytes_per_line; /* accelarator to next line */ + int bits_per_pixel; /* bits per pixel (ZPixmap) */ +} TmpImage; + + +static void xynormalizeimagebits ( + register unsigned char *bp, + register TmpImage *img) +{ + register unsigned char c; + + if (img->byte_order != img->bitmap_bit_order) { + switch (img->bitmap_unit) { + + case 16: + c = *bp; + *bp = *(bp + 1); + *(bp + 1) = c; + break; + + case 32: + c = *(bp + 3); + *(bp + 3) = *bp; + *bp = c; + c = *(bp + 2); + *(bp + 2) = *(bp + 1); + *(bp + 1) = c; + break; + } + } + if (img->bitmap_bit_order == MSBFirst) + XReverse_Bytes (bp, img->bitmap_unit >> 3); +} + +static void znormalizeimagebits ( + register unsigned char *bp, + register TmpImage *img) +{ + register unsigned char c; + switch (img->bits_per_pixel) { + + case 4: + *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF); + break; + + case 16: + c = *bp; + *bp = *(bp + 1); + *(bp + 1) = c; + break; + + case 24: + c = *(bp + 2); + *(bp + 2) = *bp; + *bp = c; + break; + + case 32: + c = *(bp + 3); + *(bp + 3) = *bp; + *bp = c; + c = *(bp + 2); + *(bp + 2) = *(bp + 1); + *(bp + 1) = c; + break; + } +} + +/* + * Macros + * + * The ROUNDUP macro rounds up a quantity to the specified boundary, + * then truncates to bytes. + * + * The XYNORMALIZE macro determines whether XY format data requires + * normalization and calls a routine to do so if needed. The logic in + * this module is designed for LSBFirst byte and bit order, so + * normalization is done as required to present the data in this order. + * + * The ZNORMALIZE macro performs byte and nibble order normalization if + * required for Z format data. + * + * The XYINDEX macro computes the index to the starting byte (char) boundary + * for a bitmap_unit containing a pixel with coordinates x and y for image + * data in XY format. + * + * The ZINDEX macro computes the index to the starting byte (char) boundary + * for a pixel with coordinates x and y for image data in ZPixmap format. + * + */ + +#if defined(Lynx) && defined(ROUNDUP) +#undef ROUNDUP +#endif + +#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) + +#define XYNORMALIZE(bp, img) \ + if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \ + xynormalizeimagebits((unsigned char *)(bp), img) + +#define ZNORMALIZE(bp, img) \ + if (img->byte_order == MSBFirst) \ + znormalizeimagebits((unsigned char *)(bp), img) + +#define XYINDEX(x, y, img) \ + ((y) * img->bytes_per_line) + \ + (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3) + +#define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \ + (((x) * img->bits_per_pixel) >> 3) + +/* + * GetPixel + * + * Returns the specified pixel. The X and Y coordinates are relative to + * the origin (upper left [0,0]) of the image. The pixel value is returned + * in normalized format, i.e. the LSB of the long is the LSB of the pixel. + * The algorithm used is: + * + * copy the source bitmap_unit or Zpixel into temp + * normalize temp if needed + * extract the pixel bits into return value + * + */ + +static unsigned long const low_bits_table[] = { + 0x00000000, 0x00000001, 0x00000003, 0x00000007, + 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, + 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, + 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, + 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, + 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, + 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, + 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, + 0xffffffff +}; + +static unsigned long XGetPixel (TmpImage *ximage, int x, int y) +{ + unsigned long pixel, px; + register char *src; + register char *dst; + register int i, j; + int bits, nbytes; + long plane; + + if ((ximage->bits_per_pixel | ximage->depth) == 1) { + src = &ximage->data[XYINDEX(x, y, ximage)]; + dst = (char *)&pixel; + pixel = 0; + for (i = ximage->bitmap_unit >> 3; --i >= 0; ) *dst++ = *src++; + XYNORMALIZE(&pixel, ximage); + bits = (x + ximage->xoffset) % ximage->bitmap_unit; + pixel = ((((char *)&pixel)[bits>>3])>>(bits&7)) & 1; + } else if (ximage->format == XYPixmap) { + pixel = 0; + plane = 0; + nbytes = ximage->bitmap_unit >> 3; + for (i = ximage->depth; --i >= 0; ) { + src = &ximage->data[XYINDEX(x, y, ximage)+ plane]; + dst = (char *)&px; + px = 0; + for (j = nbytes; --j >= 0; ) *dst++ = *src++; + XYNORMALIZE(&px, ximage); + bits = (x + ximage->xoffset) % ximage->bitmap_unit; + pixel = (pixel << 1) | + (((((char *)&px)[bits>>3])>>(bits&7)) & 1); + plane = plane + (ximage->bytes_per_line * ximage->height); + } + } else if (ximage->format == ZPixmap) { + src = &ximage->data[ZINDEX(x, y, ximage)]; + dst = (char *)&px; + px = 0; + for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; ) + *dst++ = *src++; + ZNORMALIZE(&px, ximage); + pixel = 0; + for (i=sizeof(unsigned long); --i >= 0; ) + pixel = (pixel << 8) | ((unsigned char *)&px)[i]; + if (ximage->bits_per_pixel == 4) { + if (x & 1) + pixel >>= 4; + else + pixel &= 0xf; + } + } else { + return 0; /* bad image */ + } + if (ximage->bits_per_pixel == ximage->depth) + return pixel; + else + return (pixel & low_bits_table[ximage->depth]); +} + +unsigned long +PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format, + int px, int py) +{ + TmpImage xi = {0}; + + xi.width = w; + xi.height = h; + xi.xoffset = 0/*leftPad*/; + xi.format = format; + xi.data = pImage; + xi.byte_order = IMAGE_BYTE_ORDER; + xi.bitmap_bit_order = BITMAP_BIT_ORDER; + xi.bitmap_unit = ((depth > 16)?(32): + ((depth > 8)?(16): + ((depth > 1)? (8): + (1)))); + xi.depth = depth; + xi.bits_per_pixel = xi.bitmap_unit; + + /* + * compute per line accelerator. + */ + if (format == ZPixmap) + xi.bytes_per_line = + ROUNDUP((xi.bits_per_pixel * xi.width), 32); + else + xi.bytes_per_line = + ROUNDUP((xi.width + xi.xoffset), 32); + + return XGetPixel(&xi, px, py); +} + + + Index: xc/programs/Xserver/Xprint/ps/PsInit.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/PsInit.c,v retrieving revision 1.8 diff -u -2 -0 -r1.8 PsInit.c --- xc/programs/Xserver/Xprint/ps/PsInit.c 25 Mar 2005 23:11:14 -0000 1.8 +++ xc/programs/Xserver/Xprint/ps/PsInit.c 1 Apr 2005 21:40:14 -0000 @@ -104,46 +104,51 @@ #endif /* GLXEXT */ Bool InitializePsDriver(ndx, pScreen, argc, argv) int ndx; ScreenPtr pScreen; int argc; char **argv; { #if 0 int maxXres, maxYres, maxWidth, maxHeight; int maxRes, maxDim, numBytes; PsScreenPrivPtr pPriv; #endif char **printerNames; int numPrinters; int nv, /* total number of visuals */ nv_1bit, /* number of 8bit visuals */ nv_8bit, /* number of 8bit visuals */ nv_12bit, /* number of 12bit visuals */ + nv_15bit, /* number of 15bit visuals */ + nv_16bit, /* number of 16bit visuals */ nv_24bit, /* number of 24bit visuals*/ nv_30bit; /* number of 30bit visuals*/ int nd; /* number of depths */ + int defaultVisualIndex = -1; VisualID *vids_1bit, *vids_8bit, *vids_12bit, + *vids_15bit, + *vids_16bit, *vids_24bit, *vids_30bit; VisualPtr visuals; DepthPtr depths; VisualID defaultVisual; int rootDepth; /* * Register this driver's InitContext function with the print * extension. */ XpRegisterInitFunc(pScreen, "XP-POSTSCRIPT", PsInitContext); /* * Create and fill in the devPrivate for the PS driver. */ AllocatePsPrivates(pScreen); #if 0 pPriv = (PsScreenPrivPtr)pScreen->devPrivates[PsScreenPrivateIndex].ptr; @@ -170,78 +175,186 @@ /* XXX Hard routine to write! */ /* * These two are going to be VERY different... */ pScreen->CreatePixmap = PsCreatePixmap; pScreen->DestroyPixmap = PsDestroyPixmap; pScreen->RealizeFont = PsRealizeFont; pScreen->UnrealizeFont = PsUnrealizeFont; pScreen->CreateGC = PsCreateGC; pScreen->CreateColormap = PsCreateColormap; pScreen->DestroyColormap = PsDestroyColormap; pScreen->InstallColormap = PsInstallColormap; pScreen->UninstallColormap = PsUninstallColormap; pScreen->ListInstalledColormaps = PsListInstalledColormaps; pScreen->StoreColors = PsStoreColors; pScreen->ResolveColor = PsResolveColor; /* Will BitmapToRegion make any difference at all? */ pScreen->BitmapToRegion = mfbPixmapToRegion; - visuals = (VisualPtr) xalloc(8*sizeof(VisualRec)); - depths = (DepthPtr) xalloc(8*sizeof(DepthRec)); - vids_1bit = (VisualID *)xalloc(8*sizeof(VisualID)); - vids_8bit = (VisualID *)xalloc(8*sizeof(VisualID)); - vids_12bit = (VisualID *)xalloc(8*sizeof(VisualID)); - vids_24bit = (VisualID *)xalloc(8*sizeof(VisualID)); - vids_30bit = (VisualID *)xalloc(8*sizeof(VisualID)); + visuals = (VisualPtr) xalloc(16*sizeof(VisualRec)); + depths = (DepthPtr) xalloc(16*sizeof(DepthRec)); + vids_1bit = (VisualID *)xalloc(16*sizeof(VisualID)); + vids_8bit = (VisualID *)xalloc(16*sizeof(VisualID)); + vids_12bit = (VisualID *)xalloc(16*sizeof(VisualID)); + vids_15bit = (VisualID *)xalloc(16*sizeof(VisualID)); + vids_16bit = (VisualID *)xalloc(16*sizeof(VisualID)); + vids_24bit = (VisualID *)xalloc(16*sizeof(VisualID)); + vids_30bit = (VisualID *)xalloc(16*sizeof(VisualID)); - nv = nv_1bit = nv_8bit = nv_12bit = nv_24bit = nv_30bit = nd = 0; + nv = nv_1bit = nv_8bit = nv_12bit = nv_15bit = nv_16bit = nv_24bit = nv_30bit = nd = 0; + +#ifdef PSOUT_USE_DEEPCOLOR +/* gisburn: 30bit TrueColor has been disabled for now since it causes problems + * with GLX - see https://bugs.freedesktop.org/show_bug.cgi?id=2868 ("Mesa + * seems to be unable to handle 30bit TrueColor visuals") for details... + */ +#ifdef DISABLED_FOR_NOW + /* TrueColor, 30bit, 10bit per R-,G-,B-gun */ + visuals[nv].vid = FakeClientID(0); + visuals[nv].class = TrueColor; + visuals[nv].bitsPerRGBValue = 10; + visuals[nv].ColormapEntries = 1024; + visuals[nv].nplanes = 30; + visuals[nv].redMask = 0X3FF00000; + visuals[nv].greenMask = 0X000FFC00; + visuals[nv].blueMask = 0X000003FF; + visuals[nv].offsetRed = 20; + visuals[nv].offsetGreen = 10; + visuals[nv].offsetBlue = 0; + vids_30bit[nv_30bit] = visuals[nv].vid; + nv++; nv_30bit++; +#endif /* DISABLED_FOR_NOW */ +#endif /* PSOUT_USE_DEEPCOLOR */ /* TrueColor, 24bit */ visuals[nv].vid = FakeClientID(0); visuals[nv].class = TrueColor; visuals[nv].bitsPerRGBValue = 8; visuals[nv].ColormapEntries = 256; visuals[nv].nplanes = 24; visuals[nv].redMask = 0X00FF0000; visuals[nv].greenMask = 0X0000FF00; visuals[nv].blueMask = 0X000000FF; visuals[nv].offsetRed = 16; visuals[nv].offsetGreen = 8; visuals[nv].offsetBlue = 0; vids_24bit[nv_24bit] = visuals[nv].vid; nv++; nv_24bit++; + /* TrueColor, 16bit */ + visuals[nv].vid = FakeClientID(0); + visuals[nv].class = TrueColor; + visuals[nv].bitsPerRGBValue = 6; + visuals[nv].ColormapEntries = 64; + visuals[nv].nplanes = 16; + visuals[nv].redMask = 0x0000f800; + visuals[nv].greenMask = 0x000007e0; + visuals[nv].blueMask = 0x0000001f; + visuals[nv].offsetRed = 11; + visuals[nv].offsetGreen = 5; + visuals[nv].offsetBlue = 0; + vids_16bit[nv_16bit] = visuals[nv].vid; + nv++; nv_16bit++; + +#ifdef PSOUT_USE_DEEPCOLOR + /* PostScript Level 2 and above, colors can have 12 bits per component + * (36 bit for RGB) */ + /* PseudoColor, 15bit */ + visuals[nv].vid = FakeClientID(0); + visuals[nv].class = PseudoColor; + visuals[nv].bitsPerRGBValue = 12; + visuals[nv].ColormapEntries = 32768; + visuals[nv].nplanes = 15; + visuals[nv].redMask = 0x0; + visuals[nv].greenMask = 0x0; + visuals[nv].blueMask = 0x0; + visuals[nv].offsetRed = 0x0; + visuals[nv].offsetGreen = 0x0; + visuals[nv].offsetBlue = 0x0; + vids_15bit[nv_15bit] = visuals[nv].vid; + nv++; nv_15bit++; + + /* PseudoColor, 12bit */ + visuals[nv].vid = FakeClientID(0); + visuals[nv].class = PseudoColor; + visuals[nv].bitsPerRGBValue = 12; + visuals[nv].ColormapEntries = 4096; + visuals[nv].nplanes = 12; + visuals[nv].redMask = 0x0; + visuals[nv].greenMask = 0x0; + visuals[nv].blueMask = 0x0; + visuals[nv].offsetRed = 0x0; + visuals[nv].offsetGreen = 0x0; + visuals[nv].offsetBlue = 0x0; + vids_12bit[nv_12bit] = visuals[nv].vid; + defaultVisualIndex = nv; + nv++; nv_12bit++; + + /* GrayScale, 12bit, 12bit per R-,G-,B-gun */ + visuals[nv].vid = FakeClientID(0); + visuals[nv].class = GrayScale; + visuals[nv].bitsPerRGBValue = 12; + visuals[nv].ColormapEntries = 4096; + visuals[nv].nplanes = 12; + visuals[nv].redMask = 0x0; + visuals[nv].greenMask = 0x0; + visuals[nv].blueMask = 0x0; + visuals[nv].offsetRed = 0x0; + visuals[nv].offsetGreen = 0x0; + visuals[nv].offsetBlue = 0x0; + vids_12bit[nv_12bit] = visuals[nv].vid; + nv++; nv_12bit++; + + /* StaticGray, 12bit, 12bit per R-,G-,B-gun */ + visuals[nv].vid = FakeClientID(0); + visuals[nv].class = StaticGray; + visuals[nv].bitsPerRGBValue = 12; + visuals[nv].ColormapEntries = 4096; + visuals[nv].nplanes = 12; + visuals[nv].redMask = 0x0; + visuals[nv].greenMask = 0x0; + visuals[nv].blueMask = 0x0; + visuals[nv].offsetRed = 0x0; + visuals[nv].offsetGreen = 0x0; + visuals[nv].offsetBlue = 0x0; + vids_12bit[nv_12bit] = visuals[nv].vid; + nv++; nv_12bit++; +#endif /* PSOUT_USE_DEEPCOLOR */ + /* PseudoColor, 8bit */ visuals[nv].vid = FakeClientID(0); visuals[nv].class = PseudoColor; visuals[nv].bitsPerRGBValue = 8; visuals[nv].ColormapEntries = 256; visuals[nv].nplanes = 8; visuals[nv].redMask = 0x0; visuals[nv].greenMask = 0x0; visuals[nv].blueMask = 0x0; visuals[nv].offsetRed = 0x0; visuals[nv].offsetGreen = 0x0; visuals[nv].offsetBlue = 0x0; vids_8bit[nv_8bit] = visuals[nv].vid; +#ifndef PSOUT_USE_DEEPCOLOR + defaultVisualIndex = nv; +#endif /* !PSOUT_USE_DEEPCOLOR */ nv++; nv_8bit++; /* GrayScale, 8bit */ visuals[nv].vid = FakeClientID(0); visuals[nv].class = GrayScale; visuals[nv].bitsPerRGBValue = 8; visuals[nv].ColormapEntries = 256; visuals[nv].nplanes = 8; visuals[nv].redMask = 0x0; visuals[nv].greenMask = 0x0; visuals[nv].blueMask = 0x0; visuals[nv].offsetRed = 0x0; visuals[nv].offsetGreen = 0x0; visuals[nv].offsetBlue = 0x0; vids_8bit[nv_8bit] = visuals[nv].vid; nv++; nv_8bit++; /* StaticGray, 8bit */ visuals[nv].vid = FakeClientID(0); visuals[nv].class = StaticGray; @@ -255,133 +368,99 @@ visuals[nv].offsetGreen = 0x0; visuals[nv].offsetBlue = 0x0; vids_8bit[nv_8bit] = visuals[nv].vid; nv++; nv_8bit++; /* StaticGray, 1bit */ visuals[nv].vid = FakeClientID(0); visuals[nv].class = StaticGray; visuals[nv].bitsPerRGBValue = 1; visuals[nv].ColormapEntries = 2; visuals[nv].nplanes = 1; visuals[nv].redMask = 0x0; visuals[nv].greenMask = 0x0; visuals[nv].blueMask = 0x0; visuals[nv].offsetRed = 0x0; visuals[nv].offsetGreen = 0x0; visuals[nv].offsetBlue = 0x0; vids_1bit[nv_1bit] = visuals[nv].vid; nv++; nv_1bit++; -#ifdef PSOUT_USE_DEEPCOLOR - /* TrueColor, 30bit, 10bit per R-,G-,B-gun */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = TrueColor; - visuals[nv].bitsPerRGBValue = 10; - visuals[nv].ColormapEntries = 1024; - visuals[nv].nplanes = 30; - visuals[nv].redMask = 0X3FF00000; - visuals[nv].greenMask = 0X000FFC00; - visuals[nv].blueMask = 0X000003FF; - visuals[nv].offsetRed = 20; - visuals[nv].offsetGreen = 10; - visuals[nv].offsetBlue = 0; - vids_30bit[nv_30bit] = visuals[nv].vid; - nv++; nv_30bit++; - - /* PostScript Level 2 and above, colors can have 12 bits per component - * (36 bit for RGB) */ - - /* GrayScale, 12bit, 12bit per R-,G-,B-gun */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = GrayScale; - visuals[nv].bitsPerRGBValue = 12; - visuals[nv].ColormapEntries = 4096; - visuals[nv].nplanes = 12; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_12bit[nv_12bit] = visuals[nv].vid; - nv++; nv_12bit++; - - /* StaticGray, 12bit, 12bit per R-,G-,B-gun */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = StaticGray; - visuals[nv].bitsPerRGBValue = 12; - visuals[nv].ColormapEntries = 4096; - visuals[nv].nplanes = 12; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_12bit[nv_12bit] = visuals[nv].vid; - nv++; nv_12bit++; -#endif /* PSOUT_USE_DEEPCOLOR */ - if( nv_30bit > 0 ) { depths[nd].depth = 30; depths[nd].numVids = nv_30bit; depths[nd].vids = vids_30bit; nd++; } if( nv_24bit > 0 ) { depths[nd].depth = 24; depths[nd].numVids = nv_24bit; depths[nd].vids = vids_24bit; nd++; } + if( nv_16bit > 0 ) + { + depths[nd].depth = 16; + depths[nd].numVids = nv_16bit; + depths[nd].vids = vids_16bit; + nd++; + } + + if( nv_15bit > 0 ) + { + depths[nd].depth = 15; + depths[nd].numVids = nv_15bit; + depths[nd].vids = vids_15bit; + nd++; + } + if( nv_12bit > 0 ) { depths[nd].depth = 12; depths[nd].numVids = nv_12bit; depths[nd].vids = vids_12bit; nd++; } if( nv_8bit > 0 ) { depths[nd].depth = 8; depths[nd].numVids = nv_8bit; depths[nd].vids = vids_8bit; nd++; } if( nv_1bit > 0 ) { depths[nd].depth = 1; depths[nd].numVids = nv_1bit; depths[nd].vids = vids_1bit; nd++; } - /* Defaul visual is 8bit PseudoColor */ - defaultVisual = visuals[1].vid; - rootDepth = visuals[1].nplanes; + /* Defaul visual is 12bit PseudoColor */ + defaultVisual = visuals[defaultVisualIndex].vid; + rootDepth = visuals[defaultVisualIndex].nplanes; #ifdef GLXEXT { miInitVisualsProcPtr proc = NULL; GlxWrapInitVisuals(&proc); /* GlxInitVisuals ignores the last three arguments. */ proc(&visuals, &depths, &nv, &nd, &rootDepth, &defaultVisual, 0, 0, 0); } #endif /* GLXEXT */ miScreenInit(pScreen, (pointer)0, pScreen->width, pScreen->height, (int) (pScreen->width / (pScreen->mmWidth / 25.40)), (int) (pScreen->height / (pScreen->mmHeight / 25.40)), 0, rootDepth, nd, depths, defaultVisual, nv, visuals); if( miCreateDefColormap(pScreen)==FALSE ) return FALSE; Index: xc/programs/Xserver/Xprint/ps/psout.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/psout.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 psout.h --- xc/programs/Xserver/Xprint/ps/psout.h 4 Oct 2004 05:04:14 -0000 1.3 +++ xc/programs/Xserver/Xprint/ps/psout.h 1 Apr 2005 21:40:14 -0000 @@ -136,53 +136,74 @@ typedef struct PsClipRec_ { int nRects; PsRectPtr rects; int nElms; PsElmPtr elms; int nOutterClips; PsRectPtr outterClips; } PsClipRec; typedef PsClipRec *PsClipPtr; typedef enum PsFTDownloadFontType_ { PsFontBitmap=0, PsFontType1, PsFontType3 } PsFTDownloadFontType; +/* Define |PsOutColor| color type which can hold one RGB value + * (note: this needs to be |signed| long/long long to represent + * special values such as |PSOUTCOLOR_NOCOLOR|) + */ #ifdef PSOUT_USE_DEEPCOLOR -typedef long long PsOutColor; +/* 64bit |PsOutColor| which can hold 16bit R-,G-,B-values */ +#ifdef WIN32 +typedef signed __int64 PsOutColor; +#else +# if defined(__alpha__) || defined(__alpha) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__sparc64__) || defined(_LP64) || \ + defined(__s390x__) || \ + defined(amd64) || defined (__amd64__) || \ + defined (__powerpc64__) || \ + (defined(sgi) && (_MIPS_SZLONG == 64)) +typedef signed long PsOutColor; +# else +typedef signed long long PsOutColor; +# endif /* native 64bit platform */ +#endif /* WIN32 */ + #define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 32) #define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 16) & 0xFFFF) #define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFFFF) #define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 65535.) #define PSOUTCOLOR_WHITE (0xFFFFFFFFFFFFLL) #define PSOUTCOLOR_NOCOLOR (-1LL) #define PSOUTCOLOR_TO_RGB24BIT(clr) (((PSOUTCOLOR_TO_REDBITS(clr) >> 8) << 16) | \ ((PSOUTCOLOR_TO_GREENBITS(clr) >> 8) << 8) | \ ((PSOUTCOLOR_TO_BLUEBITS(clr) >> 8) << 0)) #else -typedef long PsOutColor; +/* 32bit |PsOutColor| which can hold 8bit R-,G-,B-values */ +typedef signed long PsOutColor; #define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 16) #define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 8) & 0xFF) #define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFF) #define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 255.) #define PSOUTCOLOR_WHITE (0xFFFFFF) #define PSOUTCOLOR_NOCOLOR (-1) #define PSOUTCOLOR_TO_RGB24BIT(clr) ((PSOUTCOLOR_TO_REDBITS(clr) << 16) | \ (PSOUTCOLOR_TO_GREENBITS(clr) << 8) | \ (PSOUTCOLOR_TO_BLUEBITS(clr) << 0)) #endif /* PSOUT_USE_DEEPCOLOR */ #ifdef USE_PSOUT_PRIVATE typedef void *voidPtr; typedef struct PsPatRec_ { PsFillEnum type; voidPtr tag; } PsPatRec;