Ejemplo n.º 1
0
void
cg_indices_set_offset(cg_indices_t *indices, size_t offset)
{
    c_return_if_fail(cg_is_indices(indices));

    if (C_UNLIKELY(indices->immutable_ref))
        warn_about_midscene_changes();

    indices->offset = offset;
}
Ejemplo n.º 2
0
void
cogl_indices_set_offset (CoglIndices *indices,
                         size_t offset)
{
  _COGL_RETURN_IF_FAIL (cogl_is_indices (indices));

  if (G_UNLIKELY (indices->immutable_ref))
    warn_about_midscene_changes ();

  indices->offset = offset;
}
Ejemplo n.º 3
0
void
cogl_indices_set_offset (CoglIndices *indices,
                         gsize offset)
{
  g_return_if_fail (cogl_is_indices (indices));

  if (G_UNLIKELY (indices->immutable_ref))
    warn_about_midscene_changes ();

  indices->offset = offset;
}
Ejemplo n.º 4
0
void
cogl_primitive_set_attributes (CoglPrimitive *primitive,
                               CoglAttribute **attributes,
                               int n_attributes)
{
  int i;

  _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));

  if (G_UNLIKELY (primitive->immutable_ref))
    {
      warn_about_midscene_changes ();
      return;
    }

  /* NB: we don't unref the previous attributes before refing the new
   * in case we would end up releasing the last reference for an
   * attribute thats actually in the new list too. */
  for (i = 0; i < n_attributes; i++)
    {
      _COGL_RETURN_IF_FAIL (cogl_is_attribute (attributes[i]));
      cogl_object_ref (attributes[i]);
    }

  for (i = 0; i < primitive->n_attributes; i++)
    cogl_object_unref (primitive->attributes[i]);

  /* First try to use the embedded storage assocated with the
   * primitive, else fallback to slice allocating separate storage for
   * the attribute pointers... */

  if (n_attributes <= primitive->n_embedded_attributes)
    {
      if (primitive->attributes != &primitive->embedded_attribute)
        g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
                       primitive->attributes);
      primitive->attributes = &primitive->embedded_attribute;
    }
  else
    {
      if (primitive->attributes != &primitive->embedded_attribute)
        g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
                       primitive->attributes);
      primitive->attributes =
        g_slice_alloc (sizeof (CoglAttribute *) * n_attributes);
    }

  memcpy (primitive->attributes, attributes,
          sizeof (CoglAttribute *) * n_attributes);

  primitive->n_attributes = n_attributes;
}
Ejemplo n.º 5
0
void
cogl_primitive_set_mode (CoglPrimitive *primitive,
                         CoglVerticesMode mode)
{
  _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));

  if (G_UNLIKELY (primitive->immutable_ref))
    {
      warn_about_midscene_changes ();
      return;
    }

  primitive->mode = mode;
}
Ejemplo n.º 6
0
void
cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
                                 int first_vertex)
{
  _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));

  if (G_UNLIKELY (primitive->immutable_ref))
    {
      warn_about_midscene_changes ();
      return;
    }

  primitive->first_vertex = first_vertex;
}
Ejemplo n.º 7
0
CoglBool
cogl_buffer_set_data (CoglBuffer *buffer,
                      size_t offset,
                      const void *data,
                      size_t size)
{
  _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), FALSE);
  _COGL_RETURN_VAL_IF_FAIL ((offset + size) <= buffer->size, FALSE);

  if (G_UNLIKELY (buffer->immutable_ref))
    warn_about_midscene_changes ();

  return buffer->vtable.set_data (buffer, offset, data, size);
}
Ejemplo n.º 8
0
void *
cogl_buffer_map (CoglBuffer        *buffer,
                 CoglBufferAccess   access,
                 CoglBufferMapHint  hints)
{
  _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);

  if (G_UNLIKELY (buffer->immutable_ref))
    warn_about_midscene_changes ();

  if (buffer->flags & COGL_BUFFER_FLAG_MAPPED)
    return buffer->data;

  buffer->data = buffer->vtable.map (buffer, access, hints);
  return buffer->data;
}
Ejemplo n.º 9
0
void
cogl_primitive_set_indices (CoglPrimitive *primitive,
                            CoglIndices *indices,
                            int n_indices)
{
  _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));

  if (G_UNLIKELY (primitive->immutable_ref))
    {
      warn_about_midscene_changes ();
      return;
    }

  if (indices)
    cogl_object_ref (indices);
  if (primitive->indices)
    cogl_object_unref (primitive->indices);
  primitive->indices = indices;
  primitive->n_vertices = n_indices;
}
Ejemplo n.º 10
0
void *
cogl_buffer_map_range (CoglBuffer *buffer,
                       size_t offset,
                       size_t size,
                       CoglBufferAccess access,
                       CoglBufferMapHint hints,
                       CoglError **error)
{
  _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
  _COGL_RETURN_VAL_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);

  if (G_UNLIKELY (buffer->immutable_ref))
    warn_about_midscene_changes ();

  buffer->data = buffer->vtable.map_range (buffer,
                                           offset,
                                           size,
                                           access,
                                           hints,
                                           error);

  return buffer->data;
}