From 34077fb06ba09ed1d81cf417aa57f71d91aae9a6 Mon Sep 17 00:00:00 2001 From: forsyth Date: Tue, 6 Apr 2010 19:59:10 +0100 Subject: 20100406-1957 --- libtk/utils.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libtk/utils.c') 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) -- cgit v1.2.3