--- .empty Thu Jan 1 00:00:00 1970 +++ NEW/xc/programs/Xserver/hw/cg14/cg14-8.c Thu Jan 1 00:00:00 1970 @@ -0,0 +1,114 @@ +#include + +#include + +#include "cg14.h" +#include "crossdepth.h" + +#define PSZ 8 +#include + +static GC *gc_8_0; +static GC *gc_8_1; +static PixmapRec *pm_px32; + +PixmapRec *create_8bit_pixmap(ScreenRec *s) +{ + return(cfbCreatePixmap(s,0,0,8)); +} + +void setup_8bit_stuff(ScreenRec *s) +{ + CARD32 attr; + + pm_px32 = create_8bit_pixmap(s); + miModifyPixmapHeader(pm_px32,size_x,size_y,8,8,PixmapBytePad(size_x,8),vram_px32); + gc_8_0 = CreateScratchGC(s,8); + gc_8_0->graphicsExposures = FALSE; + gc_8_1 = CreateScratchGC(s,8); + gc_8_1->graphicsExposures = FALSE; + attr = 0; + ChangeGC(gc_8_0,GCForeground,&attr); + ValidateGC(&pm_px32->drawable,gc_8_0); + attr = 1; + ChangeGC(gc_8_1,GCForeground,&attr); + ValidateGC(&pm_px32->drawable,gc_8_1); +} + +void free_8bit_stuff(ScreenRec *s) +{ + FreeGC(gc_8_0,0); + FreeGC(gc_8_1,0); + (*s->DestroyPixmap)(pm_px32); +} + +Bool ds_8_ScreenInit(ScreenRec *s, void *p, int w, int h, int dx, int dy, int pw) +{ + return(cfbScreenInit(s,p,w,h,dx,dy,pw)); +} + +Bool ds_8_CreateWindow(WindowRec *w) +{ + return(cfbCreateWindow(w)); +} + +void ds_8_GetImage(DrawableRec *d, int x, int y, int w, int h, unsigned int fmt, unsigned long int pm, char *dst) +{ + cfbGetImage(d,x,y,w,h,fmt,pm,dst); +} + +void ds_8_GetSpans(DrawableRec *d, int wmax, DDXPointPtr pts, int *wvec, int nsp, char *dst) +{ + cfbGetSpans(d,wmax,pts,wvec,nsp,dst); +} + +Bool ds_8_DestroyWindow(WindowRec *w) +{ + return(cfbDestroyWindow(w)); +} + +Bool ds_8_PositionWindow(WindowRec *w, int x, int y) +{ + return(cfbPositionWindow(w,x,y)); +} + +Bool ds_8_ChangeWindowAttributes(WindowRec *w, unsigned long int mask) +{ + return(cfbChangeWindowAttributes(w,mask)); +} + +void ds_8_PaintWindow(WindowRec *w, RegionRec *r, int what) +{ + cfbPaintWindow(w,r,what); +} + +void ds_8_CopyWindow(WindowRec *w, DDXPointRec oo, RegionRec *src) +{ + cfbCopyWindow(w,oo,src); +} + +Bool ds_8_CreateGC(GC *gc) +{ + return(cfbCreateGC(gc)); +} + +Bool ds_8_CloseScreen(int inx, ScreenRec *s) +{ + return(cfbCloseScreen(inx,s)); +} + +void set_depth(int x1, int y1, int x2, int y2, int d) +{ + xRectangle rect; + GC *gc; + +#ifdef DEPTH_REGION_DEBUG + fprintf(stderr,"set_depth %d: %d..%d × %d..%d\n",d,x1,x2,y1,y2); +#endif + gc = (d == 8) ? gc_8_1 : gc_8_0; + rect.x = x1; + rect.y = y1; + rect.width = x2 - x1; + rect.height = y2 - y1; + cfbPolyFillRect(&pm_px32->drawable,gc,1,&rect); +}