static void _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, const int *rectangles, int n_rectangles) { CoglOnscreenEGL *egl_onscreen = onscreen->winsys; CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; FrameCallbackData *frame_callback_data = g_slice_new (FrameCallbackData); flush_pending_resize (onscreen); /* Before calling the winsys function, * cogl_onscreen_swap_buffers_with_damage() will have pushed the * frame info object onto the end of the pending frames. We can grab * it out of the queue now because we don't care about the order and * we will just directly queue the event corresponding to the exact * frame that Wayland reports as completed. This will steal the * reference */ frame_callback_data->frame_info = g_queue_pop_tail (&onscreen->pending_frame_infos); frame_callback_data->onscreen = onscreen; frame_callback_data->callback = wl_surface_frame (wayland_onscreen->wayland_surface); wl_callback_add_listener (frame_callback_data->callback, &frame_listener, frame_callback_data); _cogl_list_insert (&wayland_onscreen->frame_callbacks, &frame_callback_data->link); parent_vtable->onscreen_swap_buffers_with_damage (onscreen, rectangles, n_rectangles); }
void _cogl_pipeline_node_set_parent_real (CoglNode *node, CoglNode *parent, CoglNodeUnparentVFunc unparent, CoglBool take_strong_reference) { /* NB: the old parent may indirectly be keeping the new parent alive * so we have to ref the new parent before unrefing the old. * * Note: we take a reference here regardless of * take_strong_reference because weak children may need special * handling when the parent disposes itself which relies on a * consistent link to all weak nodes. Once the node is linked to its * parent then we remove the reference at the end if * take_strong_reference == FALSE. */ cogl_object_ref (parent); if (node->parent) unparent (node); _cogl_list_insert (&parent->children, &node->link); node->parent = parent; node->has_parent_reference = take_strong_reference; /* Now that there is a consistent parent->child link we can remove * the parent reference if no reference was requested. If it turns * out that the new parent was only being kept alive by the old * parent then it will be disposed of here. */ if (!take_strong_reference) cogl_object_unref (parent); }
CoglClosure * _cogl_closure_list_add (CoglList *list, void *function, void *user_data, CoglUserDataDestroyCallback destroy_cb) { CoglClosure *closure = g_slice_new (CoglClosure); closure->function = function; closure->user_data = user_data; closure->destroy_cb = destroy_cb; _cogl_list_insert (list, &closure->link); return closure; }