Exemplo n.º 1
0
void
_cogl_list_insert_list (CoglList *list,
                        CoglList *other)
{
  if (_cogl_list_empty (other))
    return;

  other->next->prev = list;
  other->prev->next = list->next;
  list->next->prev = other->prev;
  list->next = other->next;
}
Exemplo n.º 2
0
void
cogl_sdl_idle (CoglContext *context)
{
  CoglRenderer *renderer = context->display->renderer;

  cogl_poll_renderer_dispatch (renderer, NULL, 0);

  /* It is expected that this will be called from the application
   * immediately before blocking in SDL_WaitEvent. However,
   * dispatching cause more work to be queued. If that happens we need
   * to make sure the blocking returns immediately. We'll post our
   * dummy event to make sure that happens
   */
  if (!_cogl_list_empty (&renderer->idle_closures))
    _cogl_sdl_push_wakeup_event (context);
}
Exemplo n.º 3
0
void
_cogl_pipeline_node_unparent_real (CoglNode *node)
{
  CoglNode *parent = node->parent;

  if (parent == NULL)
    return;

  _COGL_RETURN_IF_FAIL (!_cogl_list_empty (&parent->children));

  _cogl_list_remove (&node->link);

  if (node->has_parent_reference)
    cogl_object_unref (parent);

  node->parent = NULL;
}
Exemplo n.º 4
0
int
cogl_poll_renderer_get_info (CoglRenderer *renderer,
                             CoglPollFD **poll_fds,
                             int *n_poll_fds,
                             int64_t *timeout)
{
  GList *l, *next;

  _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), 0);
  _COGL_RETURN_VAL_IF_FAIL (poll_fds != NULL, 0);
  _COGL_RETURN_VAL_IF_FAIL (n_poll_fds != NULL, 0);
  _COGL_RETURN_VAL_IF_FAIL (timeout != NULL, 0);

  *timeout = -1;

  if (!_cogl_list_empty (&renderer->idle_closures))
    *timeout = 0;

  /* This loop needs to cope with the prepare callback removing its
   * own fd */
  for (l = renderer->poll_sources; l; l = next)
    {
      CoglPollSource *source = l->data;

      next = l->next;

      if (source->prepare)
        {
          int64_t source_timeout = source->prepare (source->user_data);
          if (source_timeout >= 0 &&
              (*timeout == -1 || *timeout > source_timeout))
            *timeout = source_timeout;
        }
    }

  /* This is deliberately set after calling the prepare callbacks in
   * case one of them removes its fd */
  *poll_fds = (void *)renderer->poll_fds->data;
  *n_poll_fds = renderer->poll_fds->len;

  return renderer->poll_fds_age;
}