Fix commit 71776baccc
This commit is contained in:
Star Brilliant 2013-11-28 00:15:50 +08:00
parent 71776baccc
commit f27f9fe259

View File

@ -353,29 +353,30 @@ 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-c[7]
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]:
targetRow = rows[c[4]][row] if targetRow != rows[c[4]][row]:
if targetRow and targetRow[0]+lifetime > c[0]: targetRow = rows[c[4]][row]
break if targetRow and targetRow[0]+lifetime > c[0]:
while rows[c[4]][row] == targetRow: break
row += 1 row += 1
res += 1 res += 1
else: else:
try: try:
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]:
targetRow = rows[c[4]][row] if targetRow != rows[c[4]][row]:
try: targetRow = rows[c[4]][row]
if targetRow and (targetRow[0] > thresholdTime or targetRow[0]+targetRow[8]*lifetime/(targetRow[8]+width) > c[0]): try:
break if targetRow and (targetRow[0] > thresholdTime or targetRow[0]+targetRow[8]*lifetime/(targetRow[8]+width) > c[0]):
except ZeroDivisionError: break
pass except ZeroDivisionError:
while rows[c[4]][row] == targetRow: pass
row += 1 row += 1
res += 1 res += 1
return res return res