summaryrefslogtreecommitdiffstats
path: root/Demo/sgi
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-03 17:25:52 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-03 17:25:52 (GMT)
commit696f91151c6fe3d885fc658056c3fd19aceb4943 (patch)
tree875b61994d130a9aba8a1a5aabe770b79c86b2a7 /Demo/sgi
parent444339d463dd1580507d07a04274fa37cbd1b46a (diff)
downloadcpython-696f91151c6fe3d885fc658056c3fd19aceb4943.zip
cpython-696f91151c6fe3d885fc658056c3fd19aceb4943.tar.gz
cpython-696f91151c6fe3d885fc658056c3fd19aceb4943.tar.bz2
Fix division by zero in some cases.
Diffstat (limited to 'Demo/sgi')
-rwxr-xr-xDemo/sgi/video/video.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Demo/sgi/video/video.py b/Demo/sgi/video/video.py
index d9872d5..da2d2c7 100755
--- a/Demo/sgi/video/video.py
+++ b/Demo/sgi/video/video.py
@@ -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: