Description
It seems to me that surface interface is quite fat. In fact, the oddest responsibility of surfaces in my mind is calling the draw callback at specified intervals and times.
some draw_callback()
functions take a callback that's passed a basic_output_surface&
(without the template argument specified) but basic_unmanaged_output_surface
has a draw_callback()
that instead takes a basic_unordered_output_surface
(still no template parameter specified).
My understanding (maybe mostly assumptions) is that the reason to draw from within a callback is so that the library can first set up things like clip-regions to match only the area that needs redrawing, and also to give the library a way to request redrawing in the event of windows being covered (and then uncovered) by other windows, as well as having windows resized.
Can the draw calls on a surface be made outside of a callback as well?
I would imagine one way to simplify surfaces, and I would argue also make the interface simpler, would be to separate the responsibility to notify a program that some part of a surface need to be redrawn, and the actual drawing itself.
One way to implement temporary clip regions while updating would be to have something similar to a lock_guard
, but maybe a clip_region_guard<Surface>
. There are already other (and I would argue better) mechanisms of being notified of events on their way into the standard. like the executors and networking proposals.