8 memlalloc(Memscreen *s, Rectangle screenr, Refreshfn refreshfn, void *refreshptr, ulong val)
12 static Memimage *paint;
15 paint = allocmemimage(Rect(0,0,1,1), RGBA32);
18 paint->flags |= Frepl;
19 paint->clipr = Rect(-0x3FFFFFF, -0x3FFFFFF, 0x3FFFFFF, 0x3FFFFFF);
22 n = allocmemimaged(screenr, s->image->chan, s->image->data);
25 l = malloc(sizeof(Memlayer));
35 l->save = allocmemimage(screenr, s->image->chan);
41 /* allocmemimage doesn't initialize memory; this paints save area */
43 memfillcolor(l->save, val);
45 l->refreshfn = refreshfn;
46 l->refreshptr = nil; /* don't set it until we're done */
51 n->zero = s->image->zero;
52 n->width = s->image->width;
55 /* start with new window behind all existing ones */
56 l->front = s->rearmost;
59 s->rearmost->layer->rear = n;
61 if(s->frontmost == nil)
65 /* now pull new window to front */
66 _memltofrontfill(n, val != DNofill);
67 l->refreshptr = refreshptr;
70 * paint with requested color; previously exposed areas are already right
71 * if this window has backing store, but just painting the whole thing is simplest.
74 memsetchan(paint, n->chan);
75 memfillcolor(paint, val);
76 memdraw(n, n->r, paint, n->r.min, nil, n->r.min, S);