mirror of
https://github.com/brl/mutter.git
synced 2025-02-04 07:34:09 +00:00
cogl: Generate a GType for PixelFormat
So that CoglTexture uses the proper pspec type for it format property Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3357>
This commit is contained in:
parent
e7ba16689d
commit
63a558950b
40
cogl/cogl/cogl-enum-types.c.in
Normal file
40
cogl/cogl/cogl-enum-types.c.in
Normal file
@ -0,0 +1,40 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#include "config.h"
|
||||
#include "cogl/cogl-enum-types.h"
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
|
||||
/* enumerations from "@filename@" */
|
||||
#include "@filename@"
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static size_t g_enum_type_id = 0;
|
||||
|
||||
if (g_once_init_enter (&g_enum_type_id))
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
GType id;
|
||||
|
||||
id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
||||
|
||||
g_once_init_leave (&g_enum_type_id, id);
|
||||
}
|
||||
|
||||
return g_enum_type_id;
|
||||
}
|
||||
/*** END value-tail ***/
|
27
cogl/cogl/cogl-enum-types.h.in
Normal file
27
cogl/cogl/cogl-enum-types.h.in
Normal file
@ -0,0 +1,27 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#pragma once
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
||||
#error "Only <cogl/cogl.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "cogl/cogl-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
COGL_EXPORT GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define COGL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
||||
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
G_END_DECLS
|
||||
|
||||
/*** END file-tail ***/
|
@ -40,6 +40,7 @@
|
||||
#include "cogl/cogl-bitmap.h"
|
||||
#include "cogl/cogl-bitmap-private.h"
|
||||
#include "cogl/cogl-buffer-private.h"
|
||||
#include "cogl/cogl-enum-types.h"
|
||||
#include "cogl/cogl-pixel-buffer-private.h"
|
||||
#include "cogl/cogl-private.h"
|
||||
#include "cogl/cogl-texture-private.h"
|
||||
@ -135,7 +136,7 @@ cogl_texture_set_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_FORMAT:
|
||||
_cogl_texture_set_internal_format (texture, g_value_get_uint (value));
|
||||
_cogl_texture_set_internal_format (texture, g_value_get_enum (value));
|
||||
/* Although we want to initialize texture::components according
|
||||
* to the source format, we always want the internal layout to
|
||||
* be considered premultiplied by default.
|
||||
@ -188,8 +189,8 @@ cogl_texture_class_init (CoglTextureClass *klass)
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_FORMAT] =
|
||||
g_param_spec_uint ("format", NULL, NULL,
|
||||
COGL_PIXEL_FORMAT_ANY, G_MAXINT,
|
||||
g_param_spec_enum ("format", NULL, NULL,
|
||||
COGL_TYPE_PIXEL_FORMAT,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
@ -85,6 +85,7 @@
|
||||
#include "cogl/cogl-atlas-texture.h"
|
||||
#include "cogl/cogl-meta-texture.h"
|
||||
#include "cogl/cogl-primitive-texture.h"
|
||||
#include "cogl/cogl-enum-types.h"
|
||||
#include "cogl/cogl-index-buffer.h"
|
||||
#include "cogl/cogl-attribute-buffer.h"
|
||||
#include "cogl/cogl-indices.h"
|
||||
|
@ -18,7 +18,6 @@ cogl_headers = [
|
||||
'cogl-pipeline-layer-state.h',
|
||||
'cogl-pipeline-state.h',
|
||||
'cogl-pipeline.h',
|
||||
'cogl-pixel-format.h',
|
||||
'cogl-snippet.h',
|
||||
'cogl-texture-2d-sliced.h',
|
||||
'cogl-texture-2d.h',
|
||||
@ -356,7 +355,26 @@ if have_egl_xlib
|
||||
]
|
||||
endif
|
||||
|
||||
cogl_enum_headers = [
|
||||
'cogl-pixel-format.h',
|
||||
]
|
||||
|
||||
cogl_headers += [
|
||||
cogl_enum_headers,
|
||||
]
|
||||
|
||||
cogl_enums = gnome.mkenums('cogl-enums',
|
||||
sources: cogl_enum_headers,
|
||||
c_template: 'cogl-enum-types.c.in',
|
||||
h_template: 'cogl-enum-types.h.in',
|
||||
install_dir: cogl_cogl_includedir,
|
||||
install_header: true,
|
||||
)
|
||||
|
||||
cogl_sources += [cogl_enums[0]]
|
||||
|
||||
cogl_introspected_headers = [
|
||||
cogl_enums[1],
|
||||
cogl_headers,
|
||||
cogl_deprecated_headers,
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user