diff options
author | Robert Bragg <robert.bragg@intel.com> | 2014-03-18 23:11:57 +0000 |
---|---|---|
committer | Robert Bragg <robert.bragg@intel.com> | 2014-03-24 19:37:23 +0000 |
commit | 0ca9c3b3a5afc5653087e485b790a3093147ac29 (patch) | |
tree | 58e49184e5bb4fe46a87a5f91911c8f0555352ad | |
parent | 99d726a8641b4ef2b87ae5716f2c6681eab6b131 (diff) | |
download | cogl-0ca9c3b3a5afc5653087e485b790a3093147ac29.tar.gz |
texture: make some texture vfuncs optional
This makes some of the texture vfuncs optional to simplify adding new
texture types.
-rw-r--r-- | cogl/cogl-texture-private.h | 2 | ||||
-rw-r--r-- | cogl/cogl-texture.c | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h index 0feaeb01..ecb7173e 100644 --- a/cogl/cogl-texture-private.h +++ b/cogl/cogl-texture-private.h @@ -44,7 +44,7 @@ typedef struct _CoglTextureVtable CoglTextureVtable; -/* Encodes three possibiloities result of transforming a quad */ +/* Encodes three possible result of transforming a quad */ typedef enum { /* quad doesn't cross the boundaries of a texture */ COGL_TRANSFORM_NO_REPEAT, diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index c45509bb..070a01ee 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -279,7 +279,11 @@ cogl_texture_is_sliced (CoglTexture *texture) { if (!texture->allocated) cogl_texture_allocate (texture, NULL); - return texture->vtable->is_sliced (texture); + + if (texture->vtable->is_sliced) + return texture->vtable->is_sliced (texture); + else + return FALSE; } /* If this returns FALSE, that implies _foreach_sub_texture_in_region @@ -291,7 +295,10 @@ _cogl_texture_can_hardware_repeat (CoglTexture *texture) { if (!texture->allocated) cogl_texture_allocate (texture, NULL); - return texture->vtable->can_hardware_repeat (texture); + if (texture->vtable->can_hardware_repeat) + return texture->vtable->can_hardware_repeat (texture); + else + return TRUE; } /* NB: You can't use this with textures comprised of multiple sub textures (use @@ -302,7 +309,8 @@ _cogl_texture_transform_coords_to_gl (CoglTexture *texture, float *s, float *t) { - texture->vtable->transform_coords_to_gl (texture, s, t); + if (texture->vtable->transform_coords_to_gl) + texture->vtable->transform_coords_to_gl (texture, s, t); } CoglTransformResult @@ -353,7 +361,8 @@ _cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags) void _cogl_texture_ensure_non_quad_rendering (CoglTexture *texture) { - texture->vtable->ensure_non_quad_rendering (texture); + if (texture->vtable->ensure_non_quad_rendering) + texture->vtable->ensure_non_quad_rendering (texture); } CoglBool |