1 #include "../lib9.h" 2 3 #include "../libdraw/draw.h" 4 #include "../libmemdraw/memdraw.h" 5 #include "../libmemlayer/memlayer.h" 6 7 /* 8 * Hide puts that portion of screenr now on the screen into the window's save area. 9 * Expose puts that portion of screenr now in the save area onto the screen. 10 * 11 * Hide and Expose both require that the layer structures in the screen 12 * match the geometry they are being asked to update, that is, they update the 13 * save area (hide) or screen (expose) based on what those structures tell them. 14 * This means they must be called at the correct time during window shuffles. 15 */ 16 17 static 18 void 19 lhideop(Memimage *src, Rectangle screenr, Rectangle clipr, void *etc, int insave) 20 { 21 Rectangle r; 22 Memlayer *l; 23 24 USED(clipr.min.x); 25 USED(insave); 26 l = etc; 27 if(src != l->save){ /* do nothing if src is already in save area */ 28 r = rectsubpt(screenr, l->delta); 29 memdraw(l->save, r, src, screenr.min, nil, screenr.min); 30 } 31 } 32 33 void 34 memlhide(Memimage *i, Rectangle screenr) 35 { 36 if(i->layer->save == nil) 37 return; 38 if(rectclip(&screenr, i->layer->screen->image->r) == 0) 39 return; 40 memlayerop(lhideop, i, screenr, screenr, i->layer); 41 } 42 43 void 44 lexposeop(Memimage *dst, Rectangle screenr, Rectangle clipr, void *etc, int insave) 45 { 46 Memlayer *l; 47 Rectangle r; 48 49 USED(clipr.min.x); 50 if(insave) /* if dst is save area, don't bother */ 51 return; 52 l = etc; 53 r = rectsubpt(screenr, l->delta); 54 if(l->save) 55 memdraw(dst, screenr, l->save, r.min, nil, r.min); 56 else 57 l->refreshfn(dst, r, l->refreshptr); 58 } 59 60 void 61 memlexpose(Memimage *i, Rectangle screenr) 62 { 63 if(rectclip(&screenr, i->layer->screen->image->r) == 0) 64 return; 65 memlayerop(lexposeop, i, screenr, screenr, i->layer); 66 } 67