summaryrefslogtreecommitdiff
path: root/libtk
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2010-04-06 19:59:10 +0100
committerforsyth <forsyth@vitanuova.com>2010-04-06 19:59:10 +0100
commit34077fb06ba09ed1d81cf417aa57f71d91aae9a6 (patch)
treea97bca466b9a0056d9e020685bcc574e16a11121 /libtk
parent61d0ba9cf1fac12977df33d5fa8509ff13322614 (diff)
20100406-1957
Diffstat (limited to 'libtk')
-rw-r--r--libtk/utils.c8
1 files changed, 5 insertions, 3 deletions
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)