Add cogl_primitive_foreach_attribute()
This adds a public function to iterate the attributes of a CoglPrimitive. Previously there was no way to query back the attributes but there was methods to query back all of the other properties. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
146803c191
commit
354e923cbf
3 changed files with 49 additions and 0 deletions
|
@ -596,3 +596,15 @@ cogl_primitive_draw (CoglPrimitive *primitive)
|
|||
{
|
||||
_cogl_primitive_draw (primitive, 0 /* no flags */);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
|
||||
CoglPrimitiveAttributeCallback callback,
|
||||
void *user_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < primitive->n_attributes; i++)
|
||||
if (!callback (primitive, primitive->attributes[i], user_data))
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -816,6 +816,41 @@ cogl_primitive_draw (CoglPrimitive *primitive);
|
|||
gboolean
|
||||
cogl_is_primitive (void *object);
|
||||
|
||||
/**
|
||||
* CoglPrimitiveAttributeCallback:
|
||||
* @primitive: The #CoglPrimitive whose attributes are being iterated
|
||||
* @attribute: The #CoglAttribute
|
||||
* @user_data: The private data passed to cogl_primitive_foreach_attribute()
|
||||
*
|
||||
* The callback prototype used with cogl_primitive_foreach_attribute()
|
||||
* for iterating all the attributes of a #CoglPrimitive.
|
||||
*
|
||||
* The function should return TRUE to continue iteration or FALSE to
|
||||
* stop.
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: Unstable
|
||||
*/
|
||||
typedef gboolean (* CoglPrimitiveAttributeCallback) (CoglPrimitive *primitive,
|
||||
CoglAttribute *attribute,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* cogl_primitive_foreach_attribute:
|
||||
* @primitive: A #CoglPrimitive object
|
||||
* @callback: A #CoglPrimitiveAttributeCallback to be called for each attribute
|
||||
* @user_data: Private data that will be passed to the callback
|
||||
*
|
||||
* Iterates all the attributes of the given #CoglPrimitive.
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: Unstable
|
||||
*/
|
||||
void
|
||||
cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
|
||||
CoglPrimitiveAttributeCallback callback,
|
||||
void *user_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PRIMITIVE_H__ */
|
||||
|
|
|
@ -238,6 +238,8 @@ cogl_primitive_set_attributes
|
|||
cogl_primitive_set_indices
|
||||
cogl_primitive_draw
|
||||
cogl_primitive_copy
|
||||
CoglPrimitiveAttributeCallback
|
||||
cogl_primitive_foreach_attribute
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
|
Loading…
Reference in a new issue