diff options
| author | forsyth <forsyth@vitanuova.com> | 2010-04-06 19:59:10 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2010-04-06 19:59:10 +0100 |
| commit | 34077fb06ba09ed1d81cf417aa57f71d91aae9a6 (patch) | |
| tree | a97bca466b9a0056d9e020685bcc574e16a11121 | |
| parent | 61d0ba9cf1fac12977df33d5fa8509ff13322614 (diff) | |
20100406-1957
| -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) |
