mothra: cache backup bitmap in pl_rtdraw()
This commit is contained in:
parent
8007596779
commit
a8a71a36f5
|
@ -164,14 +164,18 @@ void pl_stuffbitmap(Panel *p, Image *b){
|
||||||
}
|
}
|
||||||
|
|
||||||
void pl_rtdraw(Image *b, Rectangle r, Rtext *t, int yoffs){
|
void pl_rtdraw(Image *b, Rectangle r, Rtext *t, int yoffs){
|
||||||
|
static Image *backup;
|
||||||
Point offs, lp;
|
Point offs, lp;
|
||||||
Rectangle dr;
|
Rectangle dr;
|
||||||
Image *bb;
|
Image *bb;
|
||||||
|
|
||||||
bb = b;
|
bb = b;
|
||||||
if((b = allocimage(display, r, bb->chan, 0, DNofill)) == nil)
|
if(backup==0 || rectinrect(r, backup->r)==0){
|
||||||
b = bb;
|
freeimage(backup);
|
||||||
|
backup=allocimage(display, bb->r, bb->chan, 0, DNofill);
|
||||||
|
}
|
||||||
|
if(backup)
|
||||||
|
b=backup;
|
||||||
pl_clr(b, r);
|
pl_clr(b, r);
|
||||||
lp=ZP;
|
lp=ZP;
|
||||||
offs=subpt(r.min, Pt(0, yoffs));
|
offs=subpt(r.min, Pt(0, yoffs));
|
||||||
|
@ -188,7 +192,7 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, int yoffs){
|
||||||
else if(t->p){
|
else if(t->p){
|
||||||
plmove(t->p, subpt(dr.min, t->p->r.min));
|
plmove(t->p, subpt(dr.min, t->p->r.min));
|
||||||
pldraw(t->p, b);
|
pldraw(t->p, b);
|
||||||
if(b != bb)
|
if(b!=bb)
|
||||||
pl_stuffbitmap(t->p, bb);
|
pl_stuffbitmap(t->p, bb);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -208,11 +212,8 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, int yoffs){
|
||||||
lp=ZP;
|
lp=ZP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(b!=bb)
|
||||||
if(b != bb){
|
draw(bb, r, b, 0, r.min);
|
||||||
draw(bb, r, b, 0, b->r.min);
|
|
||||||
freeimage(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Reposition text already drawn in the window.
|
* Reposition text already drawn in the window.
|
||||||
|
|
Loading…
Reference in a new issue