[reportlab-users] probable bug in renderbase.StateTracker treatment of transforms

Boris Borcic bborcic at gmail.com
Mon Jun 4 11:15:11 EDT 2007


Hello,

In short, shouldn't renderbase.StateTracker.pop() read like :

def pop(self) :
del self._combined[-1]
prevState = self._combined[-1]
lastDelta = self._deltas.pop()
reverseDelta = {}
for key, curValue in lastDelta.items():
if key == 'transform' :
if curValue != (1 0 0 1 0 0) :
reverseDelta[key] = inverse(curValue)
elif curValue <> prevState[key] :
reverseDelta[key] = prevState[key]
return reverseDelta

rather than the current :

def pop(self):
"""steps back one, and returns a state dictionary with the
deltas to reverse out of wherever you are. Depending
on your back end, you may not need the return value,
since you can get the complete state afterwards with getState()"""

del self._combined[-1]
newState = self._combined[-1]
lastDelta = self._deltas[-1]
del self._deltas[-1]
#need to diff this against the last one in the state
reverseDelta = {}
#print 'pop()...'
for key, curValue in lastDelta.items():
prevValue = newState[key]
----------->if prevValue <> curValue:
-----------> if key == 'transform':
-----------> reverseDelta[key] = inverse(lastDelta['transform'])
else: #just return to previous state
reverseDelta[key] = prevValue
return reverseDelta

The 3 lines marked by arrows look inconsistent to me. If lastDelta['transform']
needs to be special-cased as it is there, this means that the condition of
relevance for it, is not that prevValue<>curValue but rather that curValue isn't
the identity transform.

Or am I missing something ?

TIA for comments,

Boris Borcic



More information about the reportlab-users mailing list