Esteban Lorenzano

Well, I spend some time trying to blindly figure out why athens may crash time to time when drawing surfaces, basically testing the apprachs Ronie proposes.

First approach consists on copying data to not rely on a surface at all. Problem with this is that it involves a whole full copy, that causes a lot of GC that pauses a lot the image... so smoothness is gone.

Second approach seems a lot more doable, but I still don't know if it works:

Form subclass: #AthensCairoSurfaceForm
	instanceVariableNames: 'surface'
	classVariableNames: ''
	package: 'Athens-Cairo'

AthensCairoSurfaceForm>>surface
	^ surface

AthensCairoSurfaceForm>>surface: anObject
	surface := anObject

AthensCairoSurface>>asForm
	"create a form and copy an image data there"
	self checkSession.
	self flush.
	^ (AthensCairoSurfaceForm extent: (self width@self height) depth: 32 bits: id)
		surface: self;
		yourself

this will prevent surfaces to be garbage collected before it's time and seems to be working fine (at least in my machine).

27 February 2017 10:34 am 0 Comments - Link