BSD 4_3_Tahoe development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 28 Mar 1986 09:19:39 +0000 (01:19 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 28 Mar 1986 09:19:39 +0000 (01:19 -0800)
Work on file usr/src/new/X/libqvss/ddxfill.c

Synthesized-from: CSRG/cd2/4.3tahoe

usr/src/new/X/libqvss/ddxfill.c [new file with mode: 0644]

diff --git a/usr/src/new/X/libqvss/ddxfill.c b/usr/src/new/X/libqvss/ddxfill.c
new file mode 100644 (file)
index 0000000..def2bf4
--- /dev/null
@@ -0,0 +1,98 @@
+/* fill.c      Perform a simple raster operation a section of the screen
+ *
+ *     PixFill         Do a function on the screen
+ *     StippleFill     Fill rectangle with a stipple pattern
+ *
+ *     Modification History
+ *
+ *     Carver 8510.25 Removed error checking in calls to copyrmsk
+ *                    and copybmsk.  No errors are ever return.
+ *
+ */
+
+#include "ddxqvss.h"
+#include "qvss.h"
+#include "vstagbl.h"
+
+extern BITMAP pbm;
+
+/*ARGSUSED*/
+PixFill (srcpix, xymask, dstx, dsty, width, height, clips, clipcount,
+        func, zmask)
+       int srcpix, dstx, dsty, width, height, clipcount, zmask;
+       register BITMAP *xymask;
+       register int func;
+       CLIP *clips;
+{
+       int constant = srcpix & 1;
+
+       if (!(zmask & 1)) {
+           return;
+       }
+       if (xymask == 0)
+         {
+         copyrmsk (VSTA$K_SRC_CONST, constant, 0, 0, 0, 0,
+                         width, height, (short *) pbm.data,
+                         pbm.width, pbm.height, dstx, dsty, func,
+                         clipcount, clips);
+         return;
+         }
+
+       copybmsk (VSTA$K_SRC_CONST, constant, 0, 0, 0, 0,
+                       (short *) xymask->data, xymask->width, 
+                       xymask->height, 0, 0, width, height, 
+                       (short *) pbm.data,
+                       pbm.width, pbm.height, dstx, dsty, func,
+                       clipcount, clips);
+       return;
+}
+
+extern int errno;
+#include <errno.h>
+
+int StippleFill (srcpix, xoff, yoff, stipmask, dstx, dsty, width, height,
+       clips, clipcount, func, zmask)
+       int srcpix;             /* source pixel */
+       int xoff, yoff;         /* stipple origin */
+       BITMAP *stipmask;       /* stipple mask */
+       int dstx, dsty;         /* destination */
+       int width, height;
+       CLIP *clips;            /* clipping rectangles */
+       int clipcount;
+       int func;               /* GX display function */
+       int zmask;              /* plane mask */
+{
+       static char funcmap[16][2] = {
+               {GXandInverted, GXandInverted}, /* GXclear */
+               {GXandInverted, GXnoop},        /* GXand */
+               {GXandInverted, GXxor},         /* GXandReverse */
+               {GXandInverted, GXor},          /* GXcopy */
+               {GXnoop,        GXandInverted}, /* GXandInverted */
+               {GXnoop,        GXnoop},        /* GXnoop */
+               {GXnoop,        GXxor},         /* GXxor */
+               {GXnoop,        GXor},          /* GXor */
+               {GXxor,         GXandInverted}, /* GXnor */
+               {GXxor,         GXnoop},        /* GXequiv */
+               {GXxor,         GXxor},         /* GXinvert */
+               {GXxor,         GXor},          /* GXorReverse */
+               {GXor,          GXandInverted}, /* GXcopyInverted */
+               {GXor,          GXnoop},        /* GXorInverted */
+               {GXor,          GXxor},         /* GXnand */
+               {GXor,          GXor}           /* GXset */
+       };
+       int newfunc = funcmap [func][srcpix & 1];
+               
+       if (!(zmask & 1)) {
+           return (1);
+       }
+       if ((stipmask->width != 16) || (stipmask->height != 16)) {
+               errno = EINVAL;
+               return (0);
+       }
+       copyrmsk (VSTA$K_SRC_HT_BITMAP, (short *)stipmask->data, 
+               stipmask->width, stipmask->height, xoff, yoff,
+               width, height,
+               (short *)pbm.data, pbm.width, pbm.height,
+               dstx, dsty, newfunc, clipcount, clips);
+       return (1);
+}