[squeak-dev] Problems updating, canvas being nil
karl ramberg
karlramberg at gmail.com
Mon May 23 16:32:28 UTC 2016
I was updating and had to change this method to use 'self assuredCanvas'
because canvas instance variable was nil
WorldState>>displayWorld: aWorld submorphs: submorphs
"Update this world's display."
| deferredUpdateMode handsToDraw allDamage handDamageRects worldDamageRects
|
submorphs do: [:m | m fullBounds]. "force re-layout if needed"
self checkIfUpdateNeeded ifFalse: [^ self]. "display is already up-to-date"
deferredUpdateMode := self doDeferredUpdatingFor: aWorld.
deferredUpdateMode ifFalse: [self assuredCanvas].
worldDamageRects := self drawWorld: aWorld submorphs: submorphs
invalidAreasOn: *self assuredCanvas*. "repair world's damage on canvas"
"self handsDo:[:h| h noticeDamageRects: worldDamageRects]."
handsToDraw := self selectHandsToDrawForDamage: worldDamageRects.
handDamageRects := handsToDraw collect: [:h | h savePatchFrom: canvas].
allDamage := worldDamageRects, handDamageRects.
handsToDraw reverseDo: [:h | canvas fullDrawMorph: h]. "draw hands onto
world canvas"
"*make this true to flash damaged areas for testing*"
Preferences debugShowDamage ifTrue: [aWorld flashRects: allDamage color:
Color black].
canvas finish: allDamage.
"quickly copy altered rects of canvas to Display:"
deferredUpdateMode
ifTrue: [self forceDamageToScreen: allDamage]
ifFalse: [canvas showAt: aWorld viewBox origin invalidRects: allDamage].
handsToDraw do: [:h | h restoreSavedPatchOn: canvas]. "restore world
canvas under hands"
Display deferUpdates: false; forceDisplayUpdate.
Best,
Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160523/5e76ebfa/attachment.htm
More information about the Squeak-dev
mailing list
|