Iris 4D questions

"Gary S. Moss", VLD/VMB moss at BRL.MIL
Fri Sep 8 06:29:59 AEST 1989


[from Message-Id: <3268 at watale.waterloo.edu>]
<    3.  Did anyone get the recent GIF viewer working on a 4D70?  It
<	compiled, and igif creates a window, but then says:
<	    ERROR #91 : <lrectwrite> is not implemented.
<	What does this mean?  Who didn't implement it?
Well, I got it running on a 4D60T by replacing the call to lrectwrite() with
some code from the BRL-CAD package.  Here is a patch that should do the
trick, though I really wish 'lrectwrite' would get implemented the rest of
the way...

-moss

*** igif.c	Thu Sep  7 16:17:25 1989
--- igif.c.save	Thu Sep  7 16:17:25 1989
***************
*** 303,309 ****
  
  screen_manage()
  {
! 	lrectwrite(0, 0, s_width - 1, s_height - 1, screen);
  
  	qdevice(REDRAW);
  	qdevice(PIECECHANGE);
--- 303,309 ----
  
  screen_manage()
  {
! 	fake_rectwrite(0, 0, s_width - 1, s_height - 1, screen );
  
  	qdevice(REDRAW);
  	qdevice(PIECECHANGE);
***************
*** 315,321 ****
  		switch (qread(&data)) {
  		case REDRAW:
  		case PIECECHANGE:
! 			lrectwrite(0, 0, s_width - 1, s_height - 1, screen);
  			break;
  		case WINQUIT:
  			exit(0);
--- 315,321 ----
  		switch (qread(&data)) {
  		case REDRAW:
  		case PIECECHANGE:
! 			fake_rectwrite(0, 0, s_width - 1, s_height - 1, screen);
  			break;
  		case WINQUIT:
  			exit(0);
***************
*** 325,327 ****
--- 325,385 ----
  	}
  }
  
+ 
+ /*
+  *  This is the format of the buffer for lrectwrite(),
+  *  and thus defines the format of the in-memory framebuffer copy.
+  */
+ struct sgi_pixel {
+ 	unsigned char alpha;	/* this will always be zero */
+ 	unsigned char blue;
+ 	unsigned char green;
+ 	unsigned char red;
+ };
+ 
+ /*
+  *			F A K E _ L R E C T W R I T E
+  *
+  * fake_rectwrite is necessary as lrectwrite is not yet supported
+  * for non-GT hardware in IRIX version 3.1 or earlier. There is
+  * however, a stub in the library which states that lrectwrite is not yet
+  * available for these systems. To allow us to still use
+  * shared libraries and have the same executables across the
+  * 4D series of workstations, if the system does not contain
+  * the GT hardware upgrade then this fake routine is used.
+  *
+  * Note that the real lrectwrite() subroutine operates in the pixel
+  * coordinates of the WINDOW, not the current viewport.
+  * To simplify things, this fake_rectwrite() subroutine operates in
+  * the coordinates of the VIEWPORT, because cmov2i() and writeRGB() do.
+  * Having the callers convert to window, and then to convert back in here,
+  * is more inefficient than is necessary.  However, this required the
+  * calling sequences to be somewhat altered -vs- the lrectwrite() replaced.
+  */
+ fake_rectwrite( x1, y1, x2, y2, pixels)
+ short	x1, y1;
+ short	x2, y2;
+ register struct sgi_pixel * pixels;
+ {
+ 	register struct sgi_pixel * p;
+ 	register short	n;
+ 	register short	scan;
+ 	register short	i;
+ 	static unsigned char Red_pixels[1280];
+ 	static unsigned char Green_pixels[1280];
+ 	static unsigned char Blue_pixels[1280];
+ 
+ 	p = pixels;
+ 	n = x2  - x1 + 1;
+ 	for( scan = y1; scan <= y2; scan++)  {
+ 		for ( i = 0; i < n; i++)  {
+ 			Red_pixels[i] =   p->red;
+ 			Green_pixels[i] = p->green;
+ 			Blue_pixels[i] =  p->blue;
+ 			p++;
+ 		}
+ 	
+ 		cmov2i( x1, scan);
+ 		writeRGB( n, Red_pixels, Green_pixels, Blue_pixels);
+ 	}
+ }



More information about the Comp.sys.sgi mailing list