Boundary condition

This commit is contained in:
Star Brilliant 2013-12-02 22:38:44 +08:00
parent b861fed666
commit 65ca48d184

View File

@ -351,10 +351,10 @@ def ProcessComments(comments, f, width, height, bottomReserved, fontface, fontsi
def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime): def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime):
res = 0 res = 0
rowmax = height-bottomReserved-c[7] rowmax = height-bottomReserved
targetRow = None targetRow = None
if c[4] in (1, 2): if c[4] in (1, 2):
while row <= rowmax and res < c[7]: while row < rowmax and res < c[7]:
if targetRow != rows[c[4]][row]: if targetRow != rows[c[4]][row]:
targetRow = rows[c[4]][row] targetRow = rows[c[4]][row]
if targetRow and targetRow[0]+lifetime > c[0]: if targetRow and targetRow[0]+lifetime > c[0]:
@ -366,7 +366,7 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime):
thresholdTime = c[0]-lifetime*(1-width/(c[8]+width)) thresholdTime = c[0]-lifetime*(1-width/(c[8]+width))
except ZeroDivisionError: except ZeroDivisionError:
thresholdTime = c[0]-lifetime thresholdTime = c[0]-lifetime
while row <= rowmax and res < c[7]: while row < rowmax and res < c[7]:
if targetRow != rows[c[4]][row]: if targetRow != rows[c[4]][row]:
targetRow = rows[c[4]][row] targetRow = rows[c[4]][row]
try: try: