[cogl/wip/rig: 16/33] texture: make some texture vfuncs optional
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rig: 16/33] texture: make some texture vfuncs optional
- Date: Mon, 23 Feb 2015 21:35:38 +0000 (UTC)
commit 0ca9c3b3a5afc5653087e485b790a3093147ac29
Author: Robert Bragg <robert bragg intel com>
Date: Tue Mar 18 23:11:57 2014 +0000
texture: make some texture vfuncs optional
This makes some of the texture vfuncs optional to simplify adding new
texture types.
cogl/cogl-texture-private.h | 2 +-
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 0feaeb0..ecb7173 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 c45509b..070a01e 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]