summaryrefslogtreecommitdiff
path: root/dviware/beebe/src/fillrect.h
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/beebe/src/fillrect.h')
-rw-r--r--dviware/beebe/src/fillrect.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/dviware/beebe/src/fillrect.h b/dviware/beebe/src/fillrect.h
new file mode 100644
index 0000000000..89a768bf69
--- /dev/null
+++ b/dviware/beebe/src/fillrect.h
@@ -0,0 +1,52 @@
+/* -*-C-*- fillrect.h */
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner of the bitmap, draw
+a filled rectangle at (x,y).
+***********************************************************************/
+
+{
+ register UNSIGN32 *p;
+ register COORDINATE i,j,xloffset,xroffset,xlpart,xrpart;
+
+ if ( ((x+width) <= 0) || (XSIZE <= x) || ((y+height) <= 0) ||
+ (YSIZE <= y) )
+ return; /* Trivial reject -- rectangle outside page */
+ else
+ {
+ xlpart = x/HOST_WORD_SIZE;
+ xrpart = (x + width)/HOST_WORD_SIZE;
+ xloffset = x % HOST_WORD_SIZE;
+ xroffset = (x + width) % HOST_WORD_SIZE;
+ for (j = 0; j < height; ++j) /* loop over raster lines */
+ {
+ if (IN(0,y+j,YBIT-1))
+ {
+ p = BITMAP(y+j,xlpart);
+ if (IN(0,xlpart,XBIT-1))
+ if (xlpart < xrpart) /* set bits in left partial word */
+ *p |= rightones[xloffset];
+ else /* set bits in middle of left partial word */
+ *p |= (rightones[xloffset] & ~rightones[xroffset]);
+
+ ++p;
+ for (i = xlpart+1; i < xrpart; (++p,++i))
+ if (IN(0,i,XBIT-1))
+ *p = (UNSIGN32)ONES; /* set complete words */
+
+ /* finally, set bits in right partial word */
+ if ((xlpart < xrpart) && IN(0,xrpart,XBIT-1))
+ *BITMAP(y+j,xrpart) |= ~rightones[xroffset];
+ }
+ }
+ }
+}
+