*** text.c.xerox	Mon Apr 18 20:16:02 1988
--- text.c	Mon Apr 18 20:33:04 1988
***************
*** 5,10 ****
--- 5,11 ----
   * Copyright (c) 1986 Sun Microsystems, Inc.
   * Copyright (c) 1986 David C. Martin, UC Berkeley
   * Copyright (c) 1987 Xerox Corporation
+  * Copyright (c) 1988 Robert N. Mayo, University of Wisconsin
   *
   * David C. Martin 
   * ARPA: dcmartin@ingres.Berkeley.EDU
***************
*** 11,16 ****
--- 12,20 ----
   * UUCP: ..!ucbvax!dcmartin
   *
   * $Log:	text.c,v $
+  * Revision 10.9  88/04/18  20:31:00  mayo
+  * Fixed parameter passing for cgX rop procedures.
+  * 
   * Revision 10.8  87/05/17  12:51:30  mayer
   * Added copyright notice.
   * 
***************
*** 553,559 ****
      goto restart;
  }
  
! #ifdef sun2
  /*
   * cg2batch.c: Sun2 Color batchrop
   */
--- 557,563 ----
      goto restart;
  }
  
! #ifdef SUN_CG2
  /*
   * cg2batch.c: Sun2 Color batchrop
   */
***************
*** 753,758 ****
--- 757,766 ----
      return (errors);
  }
  
+ #endif	SUN_CG2
+ 
+ #ifdef	SUN_CG4
+ 
  /*
   * Fudged up version for the CG4 display
   */
***************
*** 759,802 ****
  
  int (*original_batchrop)();
  
! Xcg4_batchrop(dst, op, src, count)
! 	struct pr_prpos dst;
! 	int op;
  	struct pr_prpos *src;
  	int count;
  {
  	extern int private_bgcolor, private_fgcolor, private_czmask;
  	static struct pixrect *scratch;
- 	int dx, dy, dw, dh;
  	int n;
  	int errors = 0;
  
  	op = (op & 0x1f) | PIX_COLOR(private_fgcolor);
  
! 	if (dst.pr->pr_depth == 1
! 		|| src->pr->pr_depth == dst.pr->pr_depth
  		|| private_bgcolor == 0
  		)
  	{
! 		errors = (*original_batchrop)(dst, op, src, count);
  	}
  	else if (private_bgcolor < 0)
  	{
! 		errors = Xcg4_batchstencil(
! 				dst, op, src, count
  				);
  	}
  	else if ((op & 0x1e) == PIX_SRC)
  	{
! 		errors = Xcg4_srcbatchrop(
! 				dst, op, private_bgcolor,
  				src, count
  				);
  	}
  	else
  	{
! 		errors = Xcg4_complexbatchrop(
! 				dst, op, private_bgcolor,
  				src, count
  				);
  	}
--- 767,809 ----
  
  int (*original_batchrop)();
  
! Xcg4_batchrop(dpr, dx, dy, op, src, count)
! 	struct pixrect *dpr;
! 	int dx, dy, op;
  	struct pr_prpos *src;
  	int count;
  {
  	extern int private_bgcolor, private_fgcolor, private_czmask;
  	static struct pixrect *scratch;
  	int n;
  	int errors = 0;
  
  	op = (op & 0x1f) | PIX_COLOR(private_fgcolor);
  
! 	if (dpr->pr_depth == 1
! 		|| src->pr->pr_depth == dpr->pr_depth
  		|| private_bgcolor == 0
  		)
  	{
! 		errors = (*original_batchrop)(dpr, dx, dy, op, src, count);
  	}
  	else if (private_bgcolor < 0)
  	{
! 		errors = Xcg4_batchstencil(dpr, dx, dy,
! 				op, src, count
  				);
  	}
  	else if ((op & 0x1e) == PIX_SRC)
  	{
! 		errors = Xcg4_srcbatchrop(dpr, dx, dy,
! 				op, private_bgcolor,
  				src, count
  				);
  	}
  	else
  	{
! 		errors = Xcg4_complexbatchrop(dpr, dx, dy,
! 				op, private_bgcolor,
  				src, count
  				);
  	}
***************
*** 806,819 ****
  
  
  int
! Xcg4_batchstencil(dst, op, source, count)
! 	struct pr_prpos dst;
! 	int op;
  	struct pr_prpos *source;
  	int count;
  {
  	register struct pr_prpos *src;
! 	int dx, dy;
  	int n;
  	int errors = 0;
  	int clipping = (op & PIX_DONTCLIP);
--- 813,826 ----
  
  
  int
! Xcg4_batchstencil(dpr, dx, dy, op, source, count)
! 	struct pixrect *dpr;
! 	int dx, dy, op;
  	struct pr_prpos *source;
  	int count;
  {
  	register struct pr_prpos *src;
! 	int cx, cy;
  	int n;
  	int errors = 0;
  	int clipping = (op & PIX_DONTCLIP);
***************
*** 824,869 ****
  	 *	There are a number of special cases that can be done
  	 *	efficiently.
  	 */
! 	switch (oper)
  	{
  	case PIX_CLR:
! 		return (*original_batchrop)(dst,
  			(PIX_NOT(PIX_SRC)&PIX_DST)|clipping, source, count
  			);
  	case PIX_SRC^PIX_DST:
  	case PIX_SRC|PIX_DST:
! 		return (*original_batchrop)(dst,
  			op, source, count
  			);
  	case PIX_DST:
  		return 0;
  	case PIX_SRC:
! 		errors |= (*original_batchrop)(dst,
  				(PIX_NOT(PIX_SRC)&PIX_DST)|clipping,
  				source, count
  				);
! 		errors |= (*original_batchrop)(dst,
  				(PIX_SRC|PIX_DST)|color|clipping,
  				source, count
  				);
  		return errors;
  	case PIX_SET:
! 		return (*original_batchrop)(dst,
  			(PIX_SRC|PIX_DST)|clipping, source, count
  			);
  	}
  
! 	dx = dst.pos.x;
! 	dy = dst.pos.y;
  
  	for (n = 0; n < count; n++)
  	{
  		src = &source[n];
  
! 		dx += src->pos.x;
! 		dy += src->pos.y;
  
! 		errors |= pr_stencil(dst.pr, dx, dy,
  				src->pr->pr_size.x, src->pr->pr_size.y,
  				op, src->pr, 0, 0,
  				(struct pixrect *)NULL, 0, 0
--- 831,876 ----
  	 *	There are a number of special cases that can be done
  	 *	efficiently.
  	 */
! 	switch (oper) 
  	{
  	case PIX_CLR:
! 		return (*original_batchrop)(dpr, dx, dy,
  			(PIX_NOT(PIX_SRC)&PIX_DST)|clipping, source, count
  			);
  	case PIX_SRC^PIX_DST:
  	case PIX_SRC|PIX_DST:
! 		return (*original_batchrop)(dpr, dx, dy,
  			op, source, count
  			);
  	case PIX_DST:
  		return 0;
  	case PIX_SRC:
! 		errors |= (*original_batchrop)(dpr, dx, dy,
  				(PIX_NOT(PIX_SRC)&PIX_DST)|clipping,
  				source, count
  				);
! 		errors |= (*original_batchrop)(dpr, dx, dy,
  				(PIX_SRC|PIX_DST)|color|clipping,
  				source, count
  				);
  		return errors;
  	case PIX_SET:
! 		return (*original_batchrop)(dpr, dx, dy,
  			(PIX_SRC|PIX_DST)|clipping, source, count
  			);
  	}
  
! 	cx = dx;
! 	cy = dy;
  
  	for (n = 0; n < count; n++)
  	{
  		src = &source[n];
  
! 		cx += src->pos.x;
! 		cy += src->pos.y;
  
! 		errors |= pr_stencil(dpr, cx, cy,
  				src->pr->pr_size.x, src->pr->pr_size.y,
  				op, src->pr, 0, 0,
  				(struct pixrect *)NULL, 0, 0
***************
*** 874,882 ****
  }
  
  int
! Xcg4_srcbatchrop(dst, op, bgcolor, source, count)
! 	struct pr_prpos dst;
! 	int op;
  	int bgcolor;
  	struct pr_prpos *source;
  	int count;
--- 881,889 ----
  }
  
  int
! Xcg4_srcbatchrop(dpr, dstx, dsty, op, bgcolor, source, count)
! 	struct pixrect *dpr;
! 	int dstx, dsty, op;
  	int bgcolor;
  	struct pr_prpos *source;
  	int count;
***************
*** 895,902 ****
  	p = source;
  	n = count;
  
! 	sx = dx = dst.pos.x + p->pos.x;
! 	sy = dy = dst.pos.y+ p->pos.y;
  
  	last_width = width = p->pr->pr_size.x;
  	height = p->pr->pr_size.y;
--- 902,909 ----
  	p = source;
  	n = count;
  
! 	sx = dx = dstx + p->pos.x;
! 	sy = dy = dsty+ p->pos.y;
  
  	last_width = width = p->pr->pr_size.x;
  	height = p->pr->pr_size.y;
***************
*** 916,922 ****
  			continue;
  			}
  
! 		errors |= pr_rop(dst.pr, sx, sy, width, height,
  				(PIX_SRC)|PIX_COLOR(bgcolor)|clip,
  				(struct pixrect *)NULL, 0, 0
  				);
--- 923,929 ----
  			continue;
  			}
  
! 		errors |= pr_rop(dpr, sx, sy, width, height,
  				(PIX_SRC)|PIX_COLOR(bgcolor)|clip,
  				(struct pixrect *)NULL, 0, 0
  				);
***************
*** 926,937 ****
  		height = p->pr->pr_size.y;
  	}
  
! 	errors |= pr_rop(dst.pr, sx, sy, width, height,
  			(PIX_SRC)|PIX_COLOR(bgcolor)|clip,
  			(struct pixrect *)NULL, 0, 0
  			);
  
! 	errors |= (*original_batchrop)(dst,
  			(PIX_SRC^PIX_DST)
  				|PIX_COLOR(bgcolor^fgcolor)|clip,
  			source, count
--- 933,944 ----
  		height = p->pr->pr_size.y;
  	}
  
! 	errors |= pr_rop(dpr, sx, sy, width, height,
  			(PIX_SRC)|PIX_COLOR(bgcolor)|clip,
  			(struct pixrect *)NULL, 0, 0
  			);
  
! 	errors |= (*original_batchrop)(dpr, dstx, dsty,
  			(PIX_SRC^PIX_DST)
  				|PIX_COLOR(bgcolor^fgcolor)|clip,
  			source, count
***************
*** 941,949 ****
  }
  
  int
! Xcg4_complexbatchrop(dst, op, bgcolor, source, count)
! 	struct pr_prpos dst;
! 	int op;
  	int bgcolor;
  	struct pr_prpos *source;
  	int count;
--- 948,956 ----
  }
  
  int
! Xcg4_complexbatchrop(dpr, dstx, dsty, op, bgcolor, source, count)
! 	struct pixrect *dpr;
! 	int dstx, dsty, op;
  	int bgcolor;
  	struct pr_prpos *source;
  	int count;
***************
*** 957,964 ****
  
  	op = op & 0x1f;
  
! 	dx = dst.pos.x;
! 	dy = dst.pos.y;
  
  	for (n = 0; n < count; n += 1)
  	{
--- 964,971 ----
  
  	op = op & 0x1f;
  
! 	dx = dstx;
! 	dy = dsty;
  
  	for (n = 0; n < count; n += 1)
  	{
***************
*** 995,1001 ****
  				src->pr, 0, 0
  				);
  
! 		errors |= pr_rop(dst.pr, dx, dy,
  				src->pr->pr_size.x, src->pr->pr_size.y,
  				op, scratch, 0, 0
  				);
--- 1002,1008 ----
  				src->pr, 0, 0
  				);
  
! 		errors |= pr_rop(dpr, dx, dy,
  				src->pr->pr_size.x, src->pr->pr_size.y,
  				op, scratch, 0, 0
  				);
***************
*** 1004,1009 ****
  	return errors;
  }
  	
! #endif sun2
  
  #endif	sun
--- 1011,1016 ----
  	return errors;
  }
  	
! #endif SUN_CG4
  
  #endif	sun
