lhide.c - vx32 - Local 9vx git repository for patches.
 (HTM) git clone git://r-36.net/vx32
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       lhide.c (1674B)
       ---
            1 #include "u.h"
            2 #include "lib.h"
            3 #include "draw.h"
            4 #include "memdraw.h"
            5 #include "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, S);
           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 static
           44 void
           45 lexposeop(Memimage *dst, Rectangle screenr, Rectangle clipr, void *etc, int insave)
           46 {
           47         Memlayer *l;
           48         Rectangle r;
           49 
           50         USED(clipr.min.x);
           51         if(insave)        /* if dst is save area, don't bother */
           52                 return;
           53         l = etc;
           54         r = rectsubpt(screenr, l->delta);
           55         if(l->save)
           56                 memdraw(dst, screenr, l->save, r.min, nil, r.min, S);
           57         else
           58                 l->refreshfn(dst, r, l->refreshptr);
           59 }
           60 
           61 void
           62 memlexpose(Memimage *i, Rectangle screenr)
           63 {
           64         if(rectclip(&screenr, i->layer->screen->image->r) == 0)
           65                 return;
           66         _memlayerop(lexposeop, i, screenr, screenr, i->layer);
           67 }