vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

ldelete.c (1182B)


      1 #include "u.h"
      2 #include "lib.h"
      3 #include "draw.h"
      4 #include "memdraw.h"
      5 #include "memlayer.h"
      6 
      7 void
      8 memldelete(Memimage *i)
      9 {
     10 	Memscreen *s;
     11 	Memlayer *l;
     12 
     13 	l = i->layer;
     14 	/* free backing store and disconnect refresh, to make pushback fast */
     15 	freememimage(l->save);
     16 	l->save = nil;
     17 	l->refreshptr = nil;
     18 	memltorear(i);
     19 
     20 	/* window is now the rearmost;  clean up screen structures and deallocate */
     21 	s = i->layer->screen;
     22 	if(s->fill){
     23 		i->clipr = i->r;
     24 		memdraw(i, i->r, s->fill, i->r.min, nil, i->r.min, S);
     25 	}
     26 	if(l->front){
     27 		l->front->layer->rear = nil;
     28 		s->rearmost = l->front;
     29 	}else{
     30 		s->frontmost = nil;
     31 		s->rearmost = nil;
     32 	}
     33 	free(l);
     34 	freememimage(i);
     35 }
     36 
     37 /*
     38  * Just free the data structures, don't do graphics
     39  */
     40 void
     41 memlfree(Memimage *i)
     42 {
     43 	Memlayer *l;
     44 
     45 	l = i->layer;
     46 	freememimage(l->save);
     47 	free(l);
     48 	freememimage(i);
     49 }
     50 
     51 void
     52 _memlsetclear(Memscreen *s)
     53 {
     54 	Memimage *i, *j;
     55 	Memlayer *l;
     56 
     57 	for(i=s->rearmost; i; i=i->layer->front){
     58 		l = i->layer;
     59 		l->clear = rectinrect(l->screenr, l->screen->image->clipr);
     60 		if(l->clear)
     61 			for(j=l->front; j; j=j->layer->front)
     62 				if(rectXrect(l->screenr, j->layer->screenr)){
     63 					l->clear = 0;
     64 					break;
     65 				}
     66 	}
     67 }