Some hack you just found and want to tell to others

Double Buffering Workaround

Postby sreise » 23. Jan 2009, 13:43

hi @ all,

smalltalk (and also java) has no implementation of double buffered none 3D views by default.
if you need this mechanism, you can modify the drawing methode #redrawX:y:width:height: with the following code

Code: Select all
redrawX:x y:y width:w height:h

  buffer isNil or:[
  buffer width ~~ width or:[
  buffer height ~~ height
]]) ifTrue:[
  buffer := Form width:w height:h depth:device depth onDevice:device.

buffer clear.
buffer font:self font.

self redrawX:x y:y width:w height:h on:buffer.
self copyFrom:buffer x:x y:y toX:x y:y width:w height:h.

buffer is an instance variable.
now you have to do all your drawing actions in the methode #redrawX:y:width:height:on: instead of #redrawX:y:width:height:
Posts: 5
Joined: 10. Nov 2008, 14:22

Return to Tips and Tricks

Users browsing this forum: No registered users and 1 guest

Design by GB