summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--libtk/utils.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 447bd2e4..3d81ef20 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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)