mothra: clip to intersection of r and b->clipr when drawing panels

front
cinap_lenrek 2012-03-23 14:34:10 +01:00
parent 2d5aecc845
commit 140d0e7eff
2 changed files with 10 additions and 4 deletions

View File

@ -152,8 +152,6 @@ void pl_interior(int state, Point *ul, Point *size){
void pl_drawicon(Image *b, Rectangle r, int stick, int flags, Icon *s){
Rectangle save;
Point ul, offs;
save=b->clipr;
replclipr(b, b->repl, r);
ul=r.min;
offs=subpt(subpt(r.max, r.min), pl_iconsize(flags, s));
switch(stick){
@ -167,6 +165,10 @@ void pl_drawicon(Image *b, Rectangle r, int stick, int flags, Icon *s){
case PLACES: ul.x+=offs.x/2; ul.y+=offs.y; break;
case PLACESE: ul.x+=offs.x; ul.y+=offs.y; break;
}
save=b->clipr;
if(!rectclip(&r, save))
return;
replclipr(b, b->repl, r);
if(flags&BITMAP) draw(b, Rpt(ul, addpt(ul, pl_iconsize(flags, s))), s, 0, ZP);
else string(b, ul, pl_black, ZP, font, s);
replclipr(b, b->repl, save);

View File

@ -153,8 +153,13 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, int yoffs){
Point offs;
Rectangle dr;
Rectangle cr;
Rectangle xr;
xr=r;
cr=b->clipr;
replclipr(b, b->repl, r);
if(!rectclip(&xr, cr))
return;
replclipr(b, b->repl, xr);
pl_clr(b, r);
offs=subpt(r.min, Pt(0, yoffs));
for(;t;t=t->next) if(!eqrect(t->r, Rect(0,0,0,0))){
@ -162,7 +167,6 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, int yoffs){
if(dr.max.y>r.min.y
&& dr.min.y<r.max.y){
if(t->b){
// bitblt(b, dr.min, t->b, t->b->r, S|D);
draw(b, Rpt(dr.min, addpt(dr.min, subpt(t->b->r.max, t->b->r.min))), t->b, 0, t->b->r.min);
if(t->hot) border(b, insetrect(dr, -2), 1, display->black, ZP);
}