mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
2f445682b1
The current "create context/draw/destroy context" pattern presents various problems. The first issue is that it defers memory management to the caller of the create() or create_region() methods, which makes bookkeeping of the cairo_t* harder for language bindings and third party libraries. The second issue is that, while it's easier for draw-and-forget texturs, this API is needlessly complicated for contents that have to change programmatically - and it introduces constraints like calling the drawing code explicitly after a surface resize (e.g. inside an allocate() implementation). By using a signal-based approach we can make the CairoTexture actor behave like other actors, and like other libraries using Cairo as their 2D drawing API. The semantics of the newly-introduced ::draw signal are the same as the one used by GTK+: - the signal is emitted on invalidation; - the cairo_t* context is owned by the actor; - it is safe to have multiple callbacks attached to the same signal, to allow composition; - the cairo_t* is already clipped to the invalidated area, so that Cairo can discard geometry immediately before we upload the texture data. There are possible future improvements, like coalescing multiple invalidations inside regions, and performing clipped draws during the paint cycle; we could even perform clipped redraws if we know the extent of the invalidated area. |
||
---|---|---|
.. | ||
common | ||
cookbook | ||
reference | ||
actor-invariants.txt | ||
AUTHORS.old | ||
CODING_STYLE | ||
HACKING | ||
HACKING.backends | ||
Makefile.am | ||
RELEASING | ||
size-negotiation.txt |