convert line ends
[canaan.git] / prj / tech / libsrc / dev2d / genmono.c
blobe800d6aacdcd507fea881bbe2b0d8b9dcc21a8e8
1 /*
2 * $Source: x:/prj/tech/libsrc/dev2d/RCS/genmono.c $
3 * $Revision: 1.3 $
4 * $Author: KEVIN $
5 * $Date: 1996/07/03 13:58:47 $
7 * Routines for clipping monochrome bitmaps to a rectangle.
9 * This file is part of the dev2d library.
13 #include <clip.h>
14 #include <grd.h>
15 #include <bmftype.h>
17 void gen_mono_bitmap (grs_bitmap *bm, int x, int y, int code, gdubm_func *ubm_func)
19 int extra;
20 grs_bitmap bm_save = *bm;
22 if (code & CLIP_LEFT) { /* off left edge */
23 extra = grd_clip.left - x;
24 bm->w -= extra;
25 extra += bm->align;
26 bm->align = extra&7;
27 bm->bits += extra>>3;
28 x = grd_clip.left;
30 if (code & CLIP_RIGHT) { /* off right edge */
31 bm->w = grd_clip.right - x;
33 if (bm->w<=0) goto punt;
35 if (code & CLIP_TOP) { /* off top */
36 extra = grd_clip.top - y;
37 bm->h -= extra;
38 bm->bits += bm->row*extra;
39 y = grd_clip.top;
41 if (code & CLIP_BOT) { /* off bottom */
42 bm->h = grd_clip.bot - y;
44 if (bm->h>0)
45 ubm_func(bm, x, y);
47 punt:
48 *bm = bm_save;