summaryrefslogtreecommitdiff
path: root/cogl/cogl-texture-private.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2010-06-11 13:50:36 +0100
committerNeil Roberts <neil@linux.intel.com>2010-06-22 11:47:33 +0100
commitebb05bcb64ca1799ce12e8262a58169e3acd79cb (patch)
tree19c8162ab2b1cfdbb34303c0af8d4a4787f31330 /cogl/cogl-texture-private.h
parent2f286446af5cf80eb5c43083f76fce6468e54d1f (diff)
cogl-texture: List texture subclass types rather than hardcoding them
Instead of having a hardcoded series of if-statements in cogl_is_texture to determine which types should appear as texture subclasses, they are now stored in a GSList attached to the Cogl context. The list is amended to using a new cogl_texture_register_type function. There is a convenience macro called COGL_TEXTURE_DEFINE which uses COGL_HANDLE_DEFINE_WITH_CODE to register the texture type when the _get_type() function is first called.
Diffstat (limited to 'cogl/cogl-texture-private.h')
-rw-r--r--cogl/cogl-texture-private.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h
index 74ffe033..a8b4cc07 100644
--- a/cogl/cogl-texture-private.h
+++ b/cogl/cogl-texture-private.h
@@ -142,6 +142,17 @@ typedef enum _CoglTextureChangeFlags
void
_cogl_texture_free (CoglTexture *texture);
+/* This is used to register a type to the list of handle types that
+ will be considered a texture in cogl_is_texture() */
+void
+_cogl_texture_register_texture_type (GQuark type);
+
+#define COGL_TEXTURE_DEFINE(TypeName, type_name) \
+ COGL_HANDLE_DEFINE_WITH_CODE \
+ (TypeName, type_name, \
+ _cogl_texture_register_texture_type (_cogl_handle_ \
+ ## type_name ## _get_type ()))
+
void
_cogl_texture_foreach_sub_texture_in_region (CoglHandle handle,
float virtual_tx_1,