diff options
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | libtk/utils.c | 8 |
2 files changed, 7 insertions, 3 deletions
@@ -1,3 +1,5 @@ +20100406 + fix handling of boundary case in libtk/utils.c 20100402 add new option OPTflags to libtk for later use 20100325 diff --git a/libtk/utils.c b/libtk/utils.c index 5e7030d3..2b01af03 100644 --- a/libtk/utils.c +++ b/libtk/utils.c @@ -248,8 +248,10 @@ tkgradient(TkCtxt *c, Rectangle r, int dir, ulong pix0, ulong pix1) d = c->display; y = Dy(r); x = Dx(r); - if(x <= 0 || y <= 0) - return d->black; + if(x <= 0 || y <= 0) { + r = Rect(0, 0, 1, 1); + x = y = 1; + } /* TO DO: diagonal */ s = r; if(dir == Tkhorizontal){ @@ -261,7 +263,7 @@ tkgradient(TkCtxt *c, Rectangle r, int dir, ulong pix0, ulong pix1) } b = mallocz(3*n, 0); if(b == nil) - return d->black; + return nil; locked = lockdisplay(d); i = allocimage(d, r, RGB24, 1, DNofill); if(i == nil) |
