From owner-freebsd-ports Tue Apr 7 16:30:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA18204 for freebsd-ports-outgoing; Tue, 7 Apr 1998 16:30:04 -0700 (PDT) (envelope-from owner-freebsd-ports@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA18184; Tue, 7 Apr 1998 16:30:02 -0700 (PDT) (envelope-from gnats) Received: from pc-21490.bc.rogers.wave.ca (pc-21490.bc.rogers.wave.ca [24.113.51.240]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA17236 for ; Tue, 7 Apr 1998 16:23:59 -0700 (PDT) (envelope-from jh@pc-21490.bc.rogers.wave.ca) Received: (from jh@localhost) by pc-21490.bc.rogers.wave.ca (8.8.8/8.8.7) id QAA02626; Tue, 7 Apr 1998 16:23:27 -0700 (PDT) Message-Id: <199804072323.QAA02626@pc-21490.bc.rogers.wave.ca> Date: Tue, 7 Apr 1998 16:23:27 -0700 (PDT) From: Jonathan Hanna Reply-To: pangolin@rogers.wave.ca To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: ports/6245: xjig does not support 24bpp Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 6245 >Category: ports >Synopsis: xjig does not support 24bpp >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Apr 7 16:30:00 PDT 1998 >Last-Modified: >Originator: Jonathan Hanna >Organization: >Release: FreeBSD 3.0-CURRENT i386 >Environment: >Description: xjig is one of the many X clients that does not support "packed" 24bpp and XFree86 does not provide other visual formats. >How-To-Repeat: Run xjig using XFree86 on a Matrox Millenium at 24bpp (not 32). Observe bizarre colour patterns and perhaps a core dump. >Fix: This patch was sent to the author while ago, but as no new version has appeared... diff -u -r --new-file xjig/patches/patch-ab xjig.new/patches/patch-ab --- xjig/patches/patch-ab Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-ab Tue Apr 7 15:45:06 1998 @@ -0,0 +1,72 @@ +--- gifx_image.C.orig Wed Jul 24 00:12:55 1996 ++++ gifx_image.C Tue Apr 7 15:34:33 1998 +@@ -62,12 +62,16 @@ + offset_rows=0; + #endif + DropData(); +- switch(texture_mode) { +- case 1: Reset8(); break; +- case 2: Reset16(); break; +- case 3: Reset32(); break; +- default: fprintf( stderr, "depth not supported\n" ); +- exit(0); ++ ++ extern int pixmap_depth; ++ ++ switch(pixmap_depth) { ++ case 8: Reset8(); break; ++ case 16: Reset16(); break; ++ case 24: Reset24(); break; ++ case 32: Reset32(); break; ++ default: fprintf( stderr, "depth not supported\n" ); ++ exit(0); + } + } + +@@ -90,29 +94,40 @@ + } + + /*----------------------------------------------------------------------------*/ ++ ++#define CARD24 long ++ ++#define DATA_TYPE CARD24 ++#define DATA_BYTES 3 ++void GifXImage::Reset24() { ++# include "reset_image.H" ++} ++#undef DATA_TYPE ++#undef DATA_BYTES ++/*----------------------------------------------------------------------------*/ + #define DATA_TYPE CARD32 +-#define DATA_PAD 4 ++#define DATA_BYTES 4 + void GifXImage::Reset32() { + # include "reset_image.H" + } + #undef DATA_TYPE +-#undef DATA_PAD ++#undef DATA_BYTES + /*----------------------------------------------------------------------------*/ + #define DATA_TYPE CARD16 +-#define DATA_PAD 2 ++#define DATA_BYTES 2 + void GifXImage::Reset16() { + # include "reset_image.H" + } + #undef DATA_TYPE +-#undef DATA_PAD ++#undef DATA_BYTES + /*----------------------------------------------------------------------------*/ + #define DATA_TYPE CARD8 +-#define DATA_PAD 1 ++#define DATA_BYTES 1 + void GifXImage::Reset8() { + # include "reset_image.H" + } + #undef DATA_TYPE +-#undef DATA_PAD ++#undef DATA_BYTES + + // ======================================================================== + diff -u -r --new-file xjig/patches/patch-ac xjig.new/patches/patch-ac --- xjig/patches/patch-ac Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-ac Tue Apr 7 15:45:30 1998 @@ -0,0 +1,10 @@ +--- gifx_image.H.orig Mon Jul 15 12:59:11 1996 ++++ gifx_image.H Tue Apr 7 15:34:33 1998 +@@ -29,6 +29,7 @@ + void Reset8(); + void Reset16(); + void Reset32(); ++ void Reset24(); + + Display *dpy; + int scr; diff -u -r --new-file xjig/patches/patch-ad xjig.new/patches/patch-ad --- xjig/patches/patch-ad Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-ad Tue Apr 7 15:46:06 1998 @@ -0,0 +1,10 @@ +--- imgbuff.C.orig Wed Jul 17 00:23:26 1996 ++++ imgbuff.C Tue Apr 7 15:34:33 1998 +@@ -72,6 +72,7 @@ + + + XImage *ImageBuffer::Init(int w,int h,int bpp8) { ++ + // w+=10; h+=10; + if (w>width||h>height) { + FreeData(); diff -u -r --new-file xjig/patches/patch-ae xjig.new/patches/patch-ae --- xjig/patches/patch-ae Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-ae Tue Apr 7 15:46:33 1998 @@ -0,0 +1,60 @@ +--- objects.C.orig Wed Jul 24 15:06:28 1996 ++++ objects.C Tue Apr 7 15:34:33 1998 +@@ -533,28 +533,30 @@ + } + + #define DATA_TYPE CARD32 +-#define DATA_PAD 4 + void PixmapPiece::CreateTilemap32() { + # include "rotate.H" + } + #undef DATA_TYPE +-#undef DATA_PAD ++ ++#define CARD24 long ++ ++#define DATA_TYPE CARD24 ++void PixmapPiece::CreateTilemap24() { ++# include "rotate.H" ++} ++#undef DATA_TYPE + + #define DATA_TYPE CARD16 +-#define DATA_PAD 2 + void PixmapPiece::CreateTilemap16() { + # include "rotate.H" + } + #undef DATA_TYPE +-#undef DATA_PAD + + #define DATA_TYPE CARD8 +-#define DATA_PAD 1 + void PixmapPiece::CreateTilemap8() { + # include "rotate.H" + } + #undef DATA_TYPE +-#undef DATA_PAD + + + void PixmapPiece::DirectionChanged() { +@@ -573,10 +575,16 @@ + XPix(wcenter.X())-offx, YPix(wcenter.Y())-offy, width, height, 0, 0 ); + } + else { +- switch(texture_mode) { +- case 1: CreateTilemap8(); break; +- case 2: CreateTilemap16(); break; +- case 3: CreateTilemap32(); break; ++ extern int pixmap_depth; ++ ++ switch(pixmap_depth) { ++ case 8: CreateTilemap8(); break; ++ case 16: CreateTilemap16(); break; ++ case 32: CreateTilemap32(); break; ++ case 24: CreateTilemap24(); break; ++ default: ++ fprintf(stderr,"unhandled depth = %d\n",pixmap_depth); ++ exit(1); + } + } + } diff -u -r --new-file xjig/patches/patch-af xjig.new/patches/patch-af --- xjig/patches/patch-af Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-af Tue Apr 7 15:47:01 1998 @@ -0,0 +1,10 @@ +--- objects.H.orig Wed Jul 24 15:08:44 1996 ++++ objects.H Tue Apr 7 15:34:33 1998 +@@ -241,6 +241,7 @@ + protected: + void CreateTilemap8(); + void CreateTilemap16(); ++ void CreateTilemap24(); + void CreateTilemap32(); + + Pixmap tilemap; diff -u -r --new-file xjig/patches/patch-ag xjig.new/patches/patch-ag --- xjig/patches/patch-ag Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-ag Tue Apr 7 15:47:33 1998 @@ -0,0 +1,72 @@ +--- reset_image.H.orig Tue Jul 16 10:59:50 1996 ++++ reset_image.H Tue Apr 7 15:34:33 1998 +@@ -16,15 +16,24 @@ + // to access data beyond the allocated image, that might lead to a segmentation + // violation. Therefore, it might be good to allocated some additional + // rows of data for the image. +- offset_bytes=xwidth*offset_rows*sizeof(DATA_TYPE); +- xdata=new DATA_TYPE[xwidth*(xheight+2*offset_rows)]; ++ ++ extern int scanline_pad; ++ ++ int byte_pad = scanline_pad / 8; ++ ++ offset_bytes=xwidth*offset_rows*DATA_BYTES; ++ // xdata=new DATA_TYPE[xwidth*(xheight+2*offset_rows)]; ++ ++ xdata=(DATA_TYPE*)new char[DATA_BYTES*xwidth*(xheight+2*offset_rows)]; + { DATA_TYPE *xdata_run=xdata; + unsigned long blk_pixel=BlackPixel(dpy,scr); + for (int i=xwidth*(xheight+2*offset_rows);i>0;i--) { +- *xdata_run++=(DATA_TYPE)blk_pixel; ++ // *xdata_run++=(DATA_TYPE)blk_pixel; ++ *xdata_run=(DATA_TYPE)blk_pixel; // align fault ++ ((char *)xdata_run) += DATA_BYTES; + } + } +- xdata+=(offset_bytes/sizeof(DATA_TYPE)); ++ xdata+=(offset_bytes/DATA_BYTES); + + if (!xdata) { + fprintf(stderr,"not enough memory for XImage-data"); +@@ -32,9 +41,11 @@ + } + + // create the XImage ++ + ximage = XCreateImage(dpy, DefaultVisual(dpy,scr), +- DefaultDepth(dpy,scr), ZPixmap, 0, +- (char*)xdata, xwidth, xheight, 8*DATA_PAD, xwidth*sizeof(DATA_TYPE)); ++ DefaultDepth(dpy,scr), ZPixmap, 0, ++ (char*)xdata, xwidth, xheight, scanline_pad, ++ ((xwidth*DATA_BYTES + byte_pad - 1)/byte_pad) * byte_pad); + + if (!ximage) { + fprintf(stderr,"\n*** can't allocate ximage.\n" ); +@@ -47,9 +58,23 @@ + register const byte *org = Data(); + register int j,i; + +- for (i=0; iInit(width,height,DATA_PAD); ++ extern int scanline_pad; ++ ++ ximage = img_buf->Init(width,height,scanline_pad/8); + + if (!itm) { + if (page) { +@@ -40,7 +41,10 @@ + edge=wcenter+(*itm)*Vec2(-offx,-offy); + } + +-#if (0) ++extern int pixmap_depth; ++ ++switch(pixmap_depth) { ++case 24: + + // + // the traditional routine to copy each pixel from one image to the other +@@ -52,6 +56,15 @@ + + for (int y=0;yGetPixel( XPix(pt.X()), YPix(pt.Y()) )); ++ pt+=dirx; ++ } ++ } ++ ++#if 0 ++ for (int y=0;ydata + y * ximage->bytes_per_line); + for (int x=0;xPutImage(dpy,tilemap,DefaultGC(dpy,scr),0,0,0,0,width,height); + diff -u -r --new-file xjig/patches/patch-ai xjig.new/patches/patch-ai --- xjig/patches/patch-ai Wed Dec 31 16:00:00 1969 +++ xjig.new/patches/patch-ai Tue Apr 7 15:48:38 1998 @@ -0,0 +1,89 @@ +--- xjig.C.orig Wed Jul 24 13:14:28 1996 ++++ xjig.C Tue Apr 7 15:34:34 1998 +@@ -61,7 +61,8 @@ + Window win; + GC gc; + +-int texture_mode=0; // mode for texture mapping depending on depth ++int pixmap_depth = 0; ++int scanline_pad = 0; + + Cursor normal_cursor, move_cursor, pull_cursor, idle_cursor, no_cursor; + +@@ -324,7 +325,7 @@ + printf( " -sa : shuffle angles\n" ); + printf( " -sp : shuffle positions\n" ); + printf( " -r : rotation demo\n" ); +- printf( " -8 -16 -32 : manually select optimized texture mapping routine\n" ); ++ printf( " -8 -16 -24 -32 : manually select optimized texture mapping routine\n" ); + printf( " -dist : distortion percentage\n" ); + printf( " -maxang : maximum rotation angle at startup\n" ); + printf( " -rand : seed for random generator\n" ); +@@ -392,9 +393,10 @@ + #ifdef PINUP_DEFAULT + else if (!strcmp(argv[i],"-pinup")) filename=PINUP_DEFAULT; + #endif +- else if (!strcmp(argv[i],"-8")) texture_mode=1; +- else if (!strcmp(argv[i],"-16")) texture_mode=2; +- else if (!strcmp(argv[i],"-32")) texture_mode=3; ++ else if (!strcmp(argv[i],"-8")) pixmap_depth=8; ++ else if (!strcmp(argv[i],"-16")) pixmap_depth=16; ++ else if (!strcmp(argv[i],"-32")) pixmap_depth=32; ++ else if (!strcmp(argv[i],"-24")) pixmap_depth=24; + else if (!strcmp(argv[i],"-shm")) shared=1; + else if (!strcmp(argv[i],"-no_shm")) shared=0; + else if (!strcmp(argv[i],"-shapes")) shapes=1; +@@ -465,30 +467,34 @@ + printf( "xjig V2.4, by Helmut Hoenig, July-24-96\n" ); + printf( "\n" ); + +- if (!texture_mode) { +- // +- // check screen depth to select function for texture mappings +- // +- switch(DefaultDepth(dpy,scr)) { +- case 8: texture_mode=1; break; +- case 16: texture_mode=2; break; +- case 24: +- case 32: texture_mode=3; break; ++ XPixmapFormatValues *pmf; ++ ++ int n; ++ pmf = XListPixmapFormats (dpy, &n); ++ if (pmf) { ++ for (int i = 0; i < n; i++) { ++ if (pixmap_depth) { ++ if (pixmap_depth == pmf[i].depth) { ++ scanline_pad = pmf[i].scanline_pad; ++ break; ++ } ++ } else if (pmf[i].depth == DefaultDepth(dpy,scr)) { ++ pixmap_depth = pmf[i].depth; ++ scanline_pad = pmf[i].scanline_pad; ++ break; ++ } + } ++ XFree ((char *) pmf); + } +- if (!texture_mode) { +- fprintf( stderr, "*** Unable to select texture mode for Depth %d\n", DefaultDepth(dpy,scr) ); +- fprintf( stderr, " You can manually select one by trying either -8, -16 or -32\n" ); +- fprintf( stderr, " Good Luck.\n" ); +- exit(0); ++ ++ ++ if (!scanline_pad) { ++ fprintf(stderr,"No matching depth mode found\n"); ++ exit(1); + } + + if (verbose) { +- switch( texture_mode ) { +- case 1: printf( "texture mode 1: 1 byte\n" ); break; +- case 2: printf( "texture mode 2: 2 byte\n" ); break; +- case 3: printf( "texture mode 3: 4 byte\n" ); break; +- } ++ printf("depth: %d pad: %d\n",pixmap_depth,scanline_pad); + } + + old_handler=XSetErrorHandler( error_handler ); >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message