1: #ifndef lint 2: static char *rcsid_fill_c = "$Header: fill.c,v 10.2 86/02/01 16:20:53 tony Rel $"; 3: #endif lint 4: #ifdef sun 5: /* 6: * The Sun X drivers are a product of Sun Microsystems, Inc. and are provided 7: * for unrestricted use provided that this legend is included on all tape 8: * media and as a part of the software program in whole or part. Users 9: * may copy or modify these drivers without charge, but are not authorized 10: * to license or distribute them to anyone else except as part of a product or 11: * program developed by the user. 12: * 13: * THE SUN X DRIVERS ARE PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND 14: * INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A 15: * PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE 16: * PRACTICE. 17: * 18: * The Sun X Drivers are provided with no support and without any obligation 19: * on the part of Sun Microsystems, Inc. to assist in their use, correction, 20: * modification or enhancement. 21: * 22: * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 23: * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THE SUN X 24: * DRIVERS OR ANY PART THEREOF. 25: * 26: * In no event will Sun Microsystems, Inc. be liable for any lost revenue 27: * or profits or other special, indirect and consequential damages, even if 28: * Sun has been advised of the possibility of such damages. 29: * 30: * Sun Microsystems, Inc. 31: * 2550 Garcia Avenue 32: * Mountain View, California 94043 33: */ 34: 35: #ifndef lint 36: static char sccsid[] = "@(#)fill.c 2.1 86/01/28 Copyright 1986 Sun Micro"; 37: #endif 38: 39: /*- 40: * Copyright (c) 1986 by Sun Microsystems, Inc. 41: */ 42: 43: /* fill.c Perform a simple raster operation a section of the screen 44: * 45: * PixFill Do a function on the screen 46: * 47: */ 48: 49: #include "Xsun.h" 50: extern struct pixrect *PixRect; 51: 52: /*ARGSUSED*/ 53: PixFill (srcpix, xymask, dstx, dsty, width, height, clips, clipcount, 54: func, zmask) 55: int srcpix, dstx, dsty, width, height, clipcount, zmask; 56: register BITMAP *xymask; 57: register int func; 58: CLIP *clips; 59: { 60: int op = SUN_FROM_X_OP(func) | PIX_COLOR(srcpix) | PIX_DONTCLIP; 61: int allmask = -1; 62: 63: SetZmask(PixRect, &zmask); 64: if (xymask == NULL) { 65: do { 66: int cleft, ctop, cwidth, cheight; 67: 68: GetNextClip(clips, cleft, ctop, cwidth, cheight); 69: if (OverLap(cleft, ctop, cwidth, cheight, dstx, dsty, width, height)) { 70: int tleft = (cleft > dstx ? cleft : dstx); 71: int ttop = (ctop > dsty ? ctop : dsty); 72: int twidth = (cleft + cwidth < dstx + width ? cleft + cwidth : dstx + width) - tleft; 73: int theight = (ctop + cheight < dsty + height ? ctop + cheight : dsty + height) - ttop; 74: 75: CheckCursor(tleft, ttop, twidth, theight); 76: pr_rop(PixRect, tleft, ttop, twidth, theight, op, NULL, 0, 0); 77: } 78: } while (--clipcount > 0); 79: } 80: else { 81: struct pixrect stencil; 82: 83: stencil.pr_ops = PixRect->pr_ops; 84: stencil.pr_size.x = xymask->width; 85: stencil.pr_size.y = xymask->height; 86: stencil.pr_depth = 1; 87: stencil.pr_data = xymask->data; 88: do { 89: int cleft, ctop, cwidth, cheight; 90: 91: GetNextClip(clips, cleft, ctop, cwidth, cheight); 92: if (OverLap(cleft, ctop, cwidth, cheight, dstx, dsty, width, height)) { 93: int tleft = (cleft > dstx ? cleft : dstx); 94: int ttop = (ctop > dsty ? ctop : dsty); 95: int twidth = (cleft + cwidth < dstx + width ? cleft + cwidth : dstx + width) - tleft; 96: int theight = (ctop + cheight < dsty + height ? ctop + cheight : dsty + height) - ttop; 97: 98: CheckCursor(tleft, ttop, twidth, theight); 99: pr_stencil(PixRect, tleft, ttop, twidth, theight, op, &stencil, tleft, ttop, NULL, 0, 0); 100: } 101: } while (--clipcount > 0); 102: } 103: RestoreCursor(); 104: SetZmask(PixRect, &allmask); 105: } 106: #endif sun