cogl: Move TextureVertex to Clutter

The type is only used in ClutterDeformEffect, so move it there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
This commit is contained in:
Bilal Elmoussaoui
2024-07-22 11:33:44 +02:00
parent fb3f239953
commit 138e5d4f54
4 changed files with 39 additions and 53 deletions

View File

@ -100,10 +100,10 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeformEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT) CLUTTER_TYPE_OFFSCREEN_EFFECT)
static void static void
clutter_deform_effect_real_deform_vertex (ClutterDeformEffect *effect, clutter_deform_effect_real_deform_vertex (ClutterDeformEffect *effect,
gfloat width, gfloat width,
gfloat height, gfloat height,
CoglTextureVertex *vertex) ClutterTextureVertex *vertex)
{ {
g_warning ("%s: Deformation effect of type '%s' does not implement " g_warning ("%s: Deformation effect of type '%s' does not implement "
"the required ClutterDeformEffect::deform_vertex virtual " "the required ClutterDeformEffect::deform_vertex virtual "
@ -113,10 +113,10 @@ clutter_deform_effect_real_deform_vertex (ClutterDeformEffect *effect,
} }
static void static void
clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect, clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect,
gfloat width, gfloat width,
gfloat height, gfloat height,
CoglTextureVertex *vertex) ClutterTextureVertex *vertex)
{ {
CLUTTER_DEFORM_EFFECT_GET_CLASS (effect)->deform_vertex (effect, CLUTTER_DEFORM_EFFECT_GET_CLASS (effect)->deform_vertex (effect,
width, height, width, height,
@ -218,7 +218,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
for (j = 0; j < priv->x_tiles + 1; j++) for (j = 0; j < priv->x_tiles + 1; j++)
{ {
CoglVertexP3T2C4 *vertex_out; CoglVertexP3T2C4 *vertex_out;
CoglTextureVertex vertex; ClutterTextureVertex vertex;
/* CoglTextureVertex isn't an ideal structure to use for /* CoglTextureVertex isn't an ideal structure to use for
this because it contains a CoglColor. The internal this because it contains a CoglColor. The internal

View File

@ -35,6 +35,28 @@ G_BEGIN_DECLS
#define CLUTTER_TYPE_DEFORM_EFFECT (clutter_deform_effect_get_type ()) #define CLUTTER_TYPE_DEFORM_EFFECT (clutter_deform_effect_get_type ())
/**
* ClutterTextureVertex:
* @x: Model x-coordinate
* @y: Model y-coordinate
* @z: Model z-coordinate
* @tx: Texture x-coordinate
* @ty: Texture y-coordinate
* @color: The color to use at this vertex. This is ignored if
* use_color is %FALSE when calling cogl_polygon()
*
* Used to specify vertex information when calling cogl_polygon()
*/
typedef struct _ClutterTextureVertex
{
float x, y, z;
float tx, ty;
CoglColor color;
} ClutterTextureVertex;
G_STATIC_ASSERT (sizeof (ClutterTextureVertex) == 24);
CLUTTER_EXPORT CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterDeformEffect, G_DECLARE_DERIVABLE_TYPE (ClutterDeformEffect,
clutter_deform_effect, clutter_deform_effect,
@ -56,10 +78,10 @@ struct _ClutterDeformEffectClass
ClutterOffscreenEffectClass parent_class; ClutterOffscreenEffectClass parent_class;
/*< public >*/ /*< public >*/
void (* deform_vertex) (ClutterDeformEffect *effect, void (* deform_vertex) (ClutterDeformEffect *effect,
gfloat width, gfloat width,
gfloat height, gfloat height,
CoglTextureVertex *vertex); ClutterTextureVertex *vertex);
}; };
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@ -70,10 +70,10 @@ G_DEFINE_TYPE (ClutterPageTurnEffect,
CLUTTER_TYPE_DEFORM_EFFECT); CLUTTER_TYPE_DEFORM_EFFECT);
static void static void
clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect, clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect,
gfloat width, gfloat width,
gfloat height, gfloat height,
CoglTextureVertex *vertex) ClutterTextureVertex *vertex)
{ {
ClutterPageTurnEffect *self = CLUTTER_PAGE_TURN_EFFECT (effect); ClutterPageTurnEffect *self = CLUTTER_PAGE_TURN_EFFECT (effect);
gfloat cx, cy, rx, ry, radians, turn_angle; gfloat cx, cy, rx, ry, radians, turn_angle;

View File

@ -56,24 +56,9 @@ G_BEGIN_DECLS
#define COGL_PRIVATE(x) private_member_ ## x #define COGL_PRIVATE(x) private_member_ ## x
#endif #endif
#ifndef __GI_SCANNER__
/* To help catch accidental changes to public structs that should
* be stack allocated we use this macro to compile time assert that
* a struct size is as expected.
*/
#define COGL_STRUCT_SIZE_ASSERT(TYPE, SIZE) \
typedef struct { \
char compile_time_assert_ ## TYPE ## _size[ \
(sizeof (TYPE) == (SIZE)) ? 1 : -1]; \
} _ ## TYPE ## SizeCheck
#else
#define COGL_STRUCT_SIZE_ASSERT(TYPE, SIZE)
#endif
typedef struct _CoglFramebuffer CoglFramebuffer; typedef struct _CoglFramebuffer CoglFramebuffer;
typedef struct _CoglColor CoglColor; typedef struct _CoglColor CoglColor;
typedef struct _CoglTextureVertex CoglTextureVertex;
/** /**
* CoglDmaBufHandle: (free-func cogl_dma_buf_handle_free) * CoglDmaBufHandle: (free-func cogl_dma_buf_handle_free)
@ -101,27 +86,6 @@ struct _CoglColor
uint8_t alpha; uint8_t alpha;
}; };
/**
* CoglTextureVertex:
* @x: Model x-coordinate
* @y: Model y-coordinate
* @z: Model z-coordinate
* @tx: Texture x-coordinate
* @ty: Texture y-coordinate
* @color: The color to use at this vertex. This is ignored if
* use_color is %FALSE when calling cogl_polygon()
*
* Used to specify vertex information when calling cogl_polygon()
*/
struct _CoglTextureVertex
{
float x, y, z;
float tx, ty;
CoglColor color;
};
COGL_STRUCT_SIZE_ASSERT (CoglTextureVertex, 24);
/** /**
* COGL_BLEND_STRING_ERROR: * COGL_BLEND_STRING_ERROR:
* *