Introduction
Introduction Statistics Contact Development Disclaimer Help
balloc.c - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
balloc.c (1133B)
---
1 /* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
2 #include <u.h>
3 #include <libg.h>
4 #include "libgint.h"
5
6 Bitmap*
7 balloc(Rectangle r, int ldepth)
8 {
9 Bitmap *b;
10
11 b = _balloc(r, ldepth);
12 bitblt(b, r.min, b, r, Zero);
13 return b;
14 }
15
16 Bitmap*
17 _balloc(Rectangle r, int ldepth)
18 {
19 int id;
20 Bitmap *b;
21 int ld;
22 Rectangle rx;
23
24 b = (Bitmap *)calloc(1, sizeof(Bitmap));
25 if(b == 0)
26 berror("balloc malloc");
27 if (ldepth == 0)
28 ld = 0;
29 else
30 ld = screen.ldepth;
31 rx = r;
32 if (Dx(rx) == 0)
33 rx.max.x++;
34 if (Dy(rx) == 0)
35 rx.max.y++;
36 id = (int) XCreatePixmap(_dpy, (Drawable)screen.id,
37 Dx(rx), Dy(rx), _ld2d[ld]);
38 b->ldepth = ldepth;
39 b->r = r;
40 b->clipr = r;
41 b->id = id;
42 b->cache = 0;
43 if(ldepth == 0)
44 b->flag = DP1|BL1;
45 else
46 b->flag = screen.flag&BL1;
47 if(r.min.x==0 && r.min.y ==0)
48 b->flag |= ZORG;
49 else
50 b->flag |= SHIFT;
51 return b;
52 }
53
54 void
55 bfree(Bitmap *b)
56 {
57 if (b->fd)
58 XftDrawDestroy(b->fd);
59 XFreePixmap(_dpy, (Pixmap)b->id);
60 free(b);
61 }
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.