ref: 140d0e7efff27c8e0522a2c20bd01abf9eb34499
parent: 2d5aecc845ace18efd730e0f207c31f9aca60afe
author: cinap_lenrek <[email protected]>
date: Fri Mar 23 10:34:10 EDT 2012
mothra: clip to intersection of r and b->clipr when drawing panels
--- a/sys/src/cmd/mothra/libpanel/draw.c
+++ b/sys/src/cmd/mothra/libpanel/draw.c
@@ -152,8 +152,6 @@
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 @@
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);
--- a/sys/src/cmd/mothra/libpanel/rtext.c
+++ b/sys/src/cmd/mothra/libpanel/rtext.c
@@ -153,8 +153,13 @@
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 @@
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);
}