-
Notifications
You must be signed in to change notification settings - Fork 80
Add atsign-guarded for creating callbacks that don't corrupt Gtk state #170
Conversation
Now passing tests. |
This is roughly what the sigatomic macro in Gtk is supposed to do, so this would only be applicable to the "fast" callback interface. |
It doesn't, though:
Moreover, because of #161 the "fast" interface is necessary for most things. |
Add atsign-guarded for creating callbacks that don't corrupt Gtk state
Ah, sigatomic doesn't apply to canvases because their callbacks are written with the "fast" interface. That explains things. Should we use |
@timholy @vtjnash I'm using something like this here Gtk drawing is internally already cairo based and you get a proper context provided by the 'draw' call (or similar). The change to Cairo.jl is accepting this context and put it into Cairo.jl shape. In Gtk.jl i add a boolean input to the GtkCanvas constructor to get 'raw' signal access. I have two reasons to do this:
Sorry for trying to highjack the discussion, i should have opened (and planned to do) this earlier, but due to other allocations, i could not follow up or drive a discussion. And Tim is creating new state of the art at the moment with incredible speed... |
You're most welcome. Glad that does what you want! |
My general plan for Canvas has been to keep it as the "GeneralCanvas" object as you described it. For any other purpose, I was intending and expecting that users would copy the file and make their own derivative of GtkCanvas that implements the desired behavior |
note that the current double-buffering / early-draw technique should also already be rendering to the hardware-accelerated backend |
Depending in your system. With cairo-trace-perf (cairo's own benchmarking on your data) i saw clearly speedups on the x11 and xcb render in comparison to image. Second thing is, GTK not only provides the cairo context, but also a valid clipping path. This can speed up redrawing partially hidden Windows. |
perhaps, but the computation of that mask can be very expensive, so I expect you are more likely to save memory than time, but at the cost of vastly slower redraw times when portions of the environment change (or this at least is what Apple would have me believe with their claims of overdrawing and quartz in general, rather than rastorizing only the visible pixels). i've also seen cairo appear to do some sort of "lazy-render", so that the cost of rendering the final frame appeared to be delayed until it had a clipping path and was being copied to the screen. note too that Canvas usually should not be using the Cairo RGB image backend; where supported it should be using an off-screen render buffer. |
@lobingera, some benchmarks with numbers would be great. |
Currently while developing a new application, it's easy to corrupt Gtk state by writing a callback that throws an error; when that happens, you have to quit julia and start all over again. This adds a convenience macro,
@guarded
, that can be applied to any function definition to prevent corruption.