Optimize TestFreeRow

This commit has not fully tested yet. If you experience problems, please submit an issue.
This commit is contained in:
Star Brilliant 2013-11-28 00:00:28 +08:00
parent 136e61556a
commit 71776baccc

View File

@ -355,8 +355,10 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime):
rowmax = height-bottomReserved-c[7]
if c[4] in (1, 2):
while row < rowmax and res < c[7]:
if rows[c[4]][row] and rows[c[4]][row][0]+lifetime > c[0]:
targetRow = rows[c[4]][row]
if targetRow and targetRow[0]+lifetime > c[0]:
break
while rows[c[4]][row] == targetRow:
row += 1
res += 1
else:
@ -371,6 +373,7 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime):
break
except ZeroDivisionError:
pass
while rows[c[4]][row] == targetRow:
row += 1
res += 1
return res