From f20cb09f344d98fd0a4fc2ddbdebc42b4dee8020 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Tue, 2 Jan 2024 14:33:24 +0100 Subject: [PATCH] cogl: Generate a GType for Buffer{BindTarget|UpdateHint} Part-of: --- cogl/cogl/cogl-buffer.c | 15 +++++++++------ cogl/cogl/meson.build | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cogl/cogl/cogl-buffer.c b/cogl/cogl/cogl-buffer.c index 16b5b2fdd..807382c6e 100644 --- a/cogl/cogl/cogl-buffer.c +++ b/cogl/cogl/cogl-buffer.c @@ -43,6 +43,7 @@ #include #include +#include "cogl/cogl-enum-types.h" #include "cogl/cogl-util.h" #include "cogl/cogl-context-private.h" #include "cogl/cogl-pixel-buffer-private.h" @@ -135,7 +136,7 @@ cogl_buffer_set_property (GObject *gobject, { gboolean use_malloc = FALSE; - buffer->last_target = g_value_get_uint (value); + buffer->last_target = g_value_get_enum (value); if (buffer->last_target == COGL_BUFFER_BIND_TARGET_PIXEL_PACK || buffer->last_target == COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK) { @@ -165,7 +166,7 @@ cogl_buffer_set_property (GObject *gobject, break; case PROP_UPDATE_HINT: - buffer->update_hint = g_value_get_uint (value); + buffer->update_hint = g_value_get_enum (value); break; default: @@ -193,13 +194,15 @@ cogl_buffer_class_init (CoglBufferClass *klass) G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); obj_props[PROP_DEFAULT_TARGET] = - g_param_spec_uint ("default-target", NULL, NULL, - 0, G_MAXINT, 0, + g_param_spec_enum ("default-target", NULL, NULL, + COGL_TYPE_BUFFER_BIND_TARGET, + COGL_BUFFER_BIND_TARGET_PIXEL_PACK, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); obj_props[PROP_UPDATE_HINT] = - g_param_spec_uint ("update-hint", NULL, NULL, - 0, G_MAXINT, 0, + g_param_spec_enum ("update-hint", NULL, NULL, + COGL_TYPE_BUFFER_UPDATE_HINT, + COGL_BUFFER_UPDATE_HINT_STATIC, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index 68b1b4f89..414171705 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -32,7 +32,6 @@ cogl_nonintrospected_headers = [ 'cogl-atlas-texture.h', 'cogl-attribute-buffer.h', 'cogl-attribute.h', - 'cogl-buffer.h', 'cogl-depth-state.h', 'cogl-display.h', 'cogl-dma-buf-handle.h', @@ -356,6 +355,7 @@ if have_egl_xlib endif cogl_enum_headers = [ + 'cogl-buffer.h', 'cogl-pixel-format.h', ]