Commit 696f9115 authored by Guido van Rossum's avatar Guido van Rossum

Fix division by zero in some cases.

parent 444339d4
......@@ -98,11 +98,12 @@ def initcmap(ybits,ibits,qbits,chrompack):
for y in range(maxy):
yv = float(y)/float(maxy-1)
for i in range(maxi):
iv = (float(i)/float(maxi-1))-0.5
if maxi = 1: iv = 0
else: iv = (float(i)/float(maxi-1))-0.5
for q in range(maxq):
qv = (float(q)/float(maxq-1))-0.5
if maxq = 1: qv = 0
else: qv = (float(q)/float(maxq-1))-0.5
index = 2048 + y + (i << ybits) + (q << (ybits+ibits))
rv,gv,bv = colorsys.yiq_to_rgb(yv,iv,qv)
r,g,b = int(rv*255.0), int(gv*255.0), int(bv*255.0)
if index < 4096 - 256:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment