diff options
author | Adam Jackson <ajax@nwnk.net> | 2006-04-03 21:45:54 +0000 |
---|---|---|
committer | Adam Jackson <ajax@nwnk.net> | 2006-04-03 21:45:54 +0000 |
commit | 373f9f92566290d979730c09c9c5c5d50e23390c (patch) | |
tree | 2e5e350109d8187c17ec0e6883122579d47b06ba /Xprint/pcl | |
parent | d9b8bfbfafe8758ceb629606607e37546d51ca52 (diff) |
Bug #4766: Convert all Xprint drivers to fb.
Diffstat (limited to 'Xprint/pcl')
-rw-r--r-- | Xprint/pcl/PclArea.c | 85 | ||||
-rw-r--r-- | Xprint/pcl/PclColor.c | 8 | ||||
-rw-r--r-- | Xprint/pcl/PclGC.c | 110 | ||||
-rw-r--r-- | Xprint/pcl/PclInit.c | 20 |
4 files changed, 49 insertions, 174 deletions
diff --git a/Xprint/pcl/PclArea.c b/Xprint/pcl/PclArea.c index cfed7c866..dc9156b17 100644 --- a/Xprint/pcl/PclArea.c +++ b/Xprint/pcl/PclArea.c @@ -57,10 +57,7 @@ copyright holders. #include "pixmapstr.h" #include "region.h" -#include "cfb.h" -#if 1 -#include "cfb32.h" -#endif +#include "fb.h" void PclPutImage(DrawablePtr pDrawable, @@ -129,11 +126,7 @@ PclPutImage(DrawablePtr pDrawable, gcv[0] = i; DoChangeGC( pGC, GCPlaneMask, gcv, 0 ); ValidateGC( pDrawable, pGC ); - if (pPixmap->drawable.depth <= 8 ) - cfbPutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h, - leftPad, XYBitmap, pImage ); - else if (pPixmap->drawable.depth <= 32 ) - cfb32PutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h, + fbPutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h, leftPad, XYBitmap, pImage ); } } @@ -170,13 +163,13 @@ PclMonoPixmapFragment(FILE *outFile, /* * Create a storage area large enough to hold the entire pixmap, - * then use mfbGetImage to get the appropriate bits. + * then use fbGetImage 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, + fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, XYPixmap, ~0, bits ); /* @@ -226,18 +219,13 @@ PclColorPixmapFragment(FILE *outFile, /* * Create a storage area large enough to hold the entire pixmap, - * then use cfbGetImage to get the appropriate bits. + * then use fbGetImage 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, - ZPixmap, ~0, bits ); - else if (pix->drawable.depth <= 32) - cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, - ZPixmap, ~0, bits ); + fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, ZPixmap, ~0, bits ); /* * Move the cursor to the appropriate place on the page. We have @@ -306,20 +294,10 @@ PclCopyArea(DrawablePtr pSrc, /* * If we're copying from a pixmap to a pixmap, we just use the - * mfb/cfb code to do the work. + * fb code to do the work. */ if( pDst->type == DRAWABLE_PIXMAP ) - { - if( pSrc->depth == 1 ) - return mfbCopyArea( pSrc, pDst, pGC, srcx, srcy, width, - height, dstx, dsty ); - else if( pSrc->depth <= 8 ) - return cfbCopyArea( pSrc, pDst, pGC, srcx, srcy, width, - height, dstx, dsty ); - else if( pSrc->depth <= 32 ) - return cfb32CopyArea( pSrc, pDst, pGC, srcx, srcy, width, - height, dstx, dsty ); - } + fbCopyArea( pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty ); /* PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile ); @@ -328,7 +306,7 @@ PclCopyArea(DrawablePtr pSrc, /* * 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 + * drawing, instead of just handing it off to fb. Start * by determining the region that will be drawn. */ box.x1 = srcx; @@ -427,28 +405,16 @@ PclCopyPlane(DrawablePtr pSrc, if( pSrc->type == DRAWABLE_WINDOW ) return NULL; - /* - * Copying from a pixmap to a pixmap is already implemented by - * mfb/cfb. - */ + /* Copying from a pixmap to a pixmap is already implemented by fb. */ if( pSrc->type == DRAWABLE_PIXMAP && pDst->type == DRAWABLE_PIXMAP ) - { - if( pDst->depth == 1 ) - return mfbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width, - height, dstx, dsty, plane ); - else if( pDst->depth <= 8 ) - return cfbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width, - height, dstx, dsty, plane ); - else if( pDst->depth <= 32 ) - return cfb32CopyPlane( pSrc, pDst, pGC, srcx, srcy, width, - height, dstx, dsty, plane ); - } + fbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width, height, + dstx, dsty, plane ); /* - * We can use the mfb/cfbCopyPlane function to do the work of grabbing - * the plane and converting it to the desired visual. Once that's - * done, we already know how to do a CopyArea. + * We can use fbCopyPlane to do the work of grabbing the plane and + * converting it to the desired visual. Once that's done, we already + * know how to do a CopyArea. */ scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width, height, pDst->depth ); @@ -456,24 +422,9 @@ PclCopyPlane(DrawablePtr pSrc, scratchGC = GetScratchGC( pDst->depth, pDst->pScreen ); CopyGC( pGC, scratchGC, ~0L ); - if( pDst->depth == 1 ) - { - mfbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); - mfbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, - srcx, srcy, width, height, 0, 0, plane ); - } - else if( pDst->depth <= 8 ) - { - cfbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); - cfbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, - srcx, srcy, width, height, 0, 0, plane ); - } - else if( pDst->depth <= 32 ) - { - cfb32ValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); - cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, - srcx, srcy, width, height, 0, 0, plane ); - } + fbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); + fbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, + srcx, srcy, width, height, 0, 0, plane ); reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width, height, dstx, dsty ); diff --git a/Xprint/pcl/PclColor.c b/Xprint/pcl/PclColor.c index 72c7e3f99..37d42a521 100644 --- a/Xprint/pcl/PclColor.c +++ b/Xprint/pcl/PclColor.c @@ -64,7 +64,7 @@ copyright holders. #include "resource.h" #include "Pcl.h" -#include "cfb.h" +#include "fb.h" static void lookup(unsigned char *src, unsigned char *dst, @@ -80,10 +80,10 @@ static void trilinear(unsigned char *p, /* * This seems to be (and is) a duplication of effort; one would think - * that cfbCreateDefColormap would be sufficient. It almost is. The + * that fbCreateDefColormap would be sufficient. It almost is. The * only change made in this function is that the black and white pixels * are allocated with three separate variables for red, green and blue - * values, instead of the single variable in cfbCreateDefColormap. The + * values, instead of the single variable in fbCreateDefColormap. The * single variable leads to the one value being corrected by * ResolveColor three times, which leads to incorrect colors. */ @@ -137,7 +137,7 @@ PclCreateColormap(ColormapPtr pColor) /* * Use existing code to initialize the values in the colormap */ - cfbInitializeColormap( pColor ); + fbInitializeColormap( pColor ); /* * Set up the mapping between the color map and the context diff --git a/Xprint/pcl/PclGC.c b/Xprint/pcl/PclGC.c index 83ebb47e1..2be2ef787 100644 --- a/Xprint/pcl/PclGC.c +++ b/Xprint/pcl/PclGC.c @@ -56,9 +56,7 @@ copyright holders. #include "pixmapstr.h" #include "colormapst.h" #include "windowstr.h" -#include "cfb.h" -#include "cfb32.h" -#include "migc.h" +#include "fb.h" #include "scrnintstr.h" #include "resource.h" @@ -106,22 +104,8 @@ static GCFuncs PclGCFuncs = Bool PclCreateGC(GCPtr pGC) { - if( pGC->depth == 1 ) - { - if( mfbCreateGC( pGC ) == FALSE ) - return FALSE; - } - else if( pGC->depth <= 32 ) - { -#if PSZ == 8 - if( cfbCreateGC( pGC ) == FALSE ) -#else - if( cfb32CreateGC( pGC ) == FALSE ) -#endif - return FALSE; - } - else - return FALSE; + if (fbCreateGC(pGC) == FALSE) + return FALSE; pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; @@ -135,7 +119,7 @@ PclCreateGC(GCPtr pGC) void PclDestroyGC(GCPtr pGC) { - /* Handle the mfb and cfb, which share a GC private struct */ + /* fb doesn't specialize DestroyGC */ miDestroyGC( pGC ); } @@ -655,34 +639,12 @@ PclUpdateDrawableGC( h = pGC->tile.pixmap->drawable.height; w = pGC->tile.pixmap->drawable.width; - if( pGC->tile.pixmap->drawable.depth == 1 ) - { - sz = h * BitmapBytePad( w ); - - bits = (char *)xalloc( sz ); - mfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, bits); - PclSendPattern( bits, sz, 1, h, w, 100, *outFile ); - xfree( bits ); - } - else if( pGC->tile.pixmap->drawable.depth == 8 ) - { - sz = h * PixmapBytePad( w, 8 ); - bits = (char *)xalloc( sz ); - cfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits); - PclSendPattern( bits, sz, 8, h, w, 100, *outFile ); - xfree( bits ); - } -#if PSZ == 32 - else - { - sz = h * PixmapBytePad( w, 24 ); - - bits = (char *)xalloc( sz ); - cfb32GetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits); - PclSendPattern( bits, sz, 24, h, w, 100, *outFile ); - xfree( bits ); - } -#endif + sz = h * PixmapBytePad(w, pGC->tile.pixmap->drawable.depth); + bits = (char *)xalloc(sz); + fbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, + bits); + PclSendPattern( bits, sz, 1, h, w, 100, *outFile ); + xfree( bits ); } if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) ) @@ -717,7 +679,7 @@ PclUpdateDrawableGC( sz = h * BitmapBytePad( w ); bits = (char *)xalloc( sz ); - mfbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits ); + fbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits ); w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 ); /* @@ -755,37 +717,12 @@ PclUpdateDrawableGC( w, h, pGC->depth ); scratchGC = GetScratchGC( pGC->depth, pGC->pScreen ); CopyGC( pGC, scratchGC, ~0L ); - - if( pGC->depth == 1 ) - { - mfbValidateGC( scratchGC, ~0L, - (DrawablePtr)scratchPix ); - mfbCopyPlane( &(pGC->stipple->drawable), - (DrawablePtr)scratchPix, scratchGC, 0, - 0, w, h, 0, 0, 1 ); - mfbGetImage( &(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0, - bits ); - } - else if( pGC->depth <= 32 ) - { -#if PSZ == 8 - cfbValidateGC( scratchGC, ~0L, - (DrawablePtr)scratchPix ); - cfbCopyPlane( &(pGC->stipple->drawable), - (DrawablePtr)scratchPix, scratchGC, 0, - 0, w, h, 0, 0, 1 ); - cfbGetImage( &(scratchPix->drawable), 0, 0, w, h, ZPixmap, ~0, - bits ); -#else - cfb32ValidateGC( scratchGC, ~0L, - (DrawablePtr)scratchPix ); - cfb32CopyPlane( pGC->stipple, - (DrawablePtr)scratchPix, scratchGC, 0, - 0, w, h, 0, 0, 1 ); - cfb32GetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0, - bits ); -#endif - } + + fbValidateGC(scratchGC, ~0L, (DrawablePtr)scratchPix); + fbCopyPlane(&(pGC->stipple->drawable), (DrawablePtr)scratchPix, + scratchGC, 0, 0, w, h, 0, 0, 1); + fbGetImage(&(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0, + bits); PclSendPattern( bits, sz, pGC->depth, h, w, 101, *outFile ); FreeScratchGC( scratchGC ); (*pGC->pScreen->DestroyPixmap)( scratchPix ); @@ -994,18 +931,7 @@ PclValidateGC( */ if( pDrawable->type == DRAWABLE_PIXMAP ) { - if( pDrawable->depth == 1 ) - { - mfbValidateGC( pGC, ~0, pDrawable ); - } - else if( pDrawable->depth <= 32 ) - { -#if PSZ == 8 - cfbValidateGC( pGC, ~0, pDrawable ); -#else - cfb32ValidateGC( pGC, ~0, pDrawable ); -#endif - } + fbValidateGC(pGC, ~0, pDrawable); return; } diff --git a/Xprint/pcl/PclInit.c b/Xprint/pcl/PclInit.c index 8bedee7c3..272f4da9a 100644 --- a/Xprint/pcl/PclInit.c +++ b/Xprint/pcl/PclInit.c @@ -89,7 +89,7 @@ copyright holders. #include "Pcl.h" -#include "cfb.h" +#include "fb.h" #include <X11/Xos.h> /* for unlink() */ #include "attributes.h" @@ -200,18 +200,16 @@ InitializePclDriver( maxRes = MAX( xRes, yRes ); #ifdef XP_PCL_COLOR - cfbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes, - maxRes ); - /* - * Clean up the fields that we stomp (code taken from cfbCloseScreen) - */ + fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes, + maxRes, 8 ); /* XXX what's the depth here? */ + /* Clean up the fields that we stomp (code taken from fbCloseScreen) */ for( i = 0; (int) i < pScreen->numDepths; i++ ) xfree( pScreen->allowedDepths[i].vids ); xfree( pScreen->allowedDepths ); xfree( pScreen->visuals ); #else - mfbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes, - maxRes ); + fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes, + maxRes, 1 ); #endif /* XP_PCL_COLOR */ miInitializeBackingStore ( pScreen ); @@ -241,8 +239,8 @@ InitializePclDriver( pScreen->PaintWindowBorder = PclPaintWindow; pScreen->CopyWindow = PclCopyWindow; /* XXX Hard routine to write! */ - pScreen->CreatePixmap = PclCreatePixmap; - pScreen->DestroyPixmap = PclDestroyPixmap; + pScreen->CreatePixmap = fbCreatePixmap; + pScreen->DestroyPixmap = fbDestroyPixmap; pScreen->RealizeFont = PclRealizeFont; pScreen->UnrealizeFont = PclUnrealizeFont; pScreen->CreateGC = PclCreateGC; @@ -257,7 +255,7 @@ InitializePclDriver( pScreen->ResolveColor = PclResolveColor; */ - pScreen->BitmapToRegion = mfbPixmapToRegion; + pScreen->BitmapToRegion = fbPixmapToRegion; pScreen->ConstrainCursor = PclConstrainCursor; pScreen->CursorLimits = PclCursorLimits; |