cogl: Port SwapChain away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:
parent
312d5c367e
commit
9d71949b26
@ -254,7 +254,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
|
||||
/* the display owns the renderer and the swap chain */
|
||||
cogl_object_unref (backend->cogl_renderer);
|
||||
cogl_object_unref (swap_chain);
|
||||
g_object_unref (swap_chain);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -272,7 +272,7 @@ error:
|
||||
}
|
||||
|
||||
if (swap_chain != NULL)
|
||||
cogl_object_unref (swap_chain);
|
||||
g_object_unref (swap_chain);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ cogl_framebuffer_init_config (CoglFramebuffer *framebuffer,
|
||||
cogl_framebuffer_get_instance_private (framebuffer);
|
||||
|
||||
priv->config = *config;
|
||||
cogl_object_ref (priv->config.swap_chain);
|
||||
g_object_ref (priv->config.swap_chain);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -58,7 +58,7 @@ cogl_onscreen_template_new (CoglSwapChain *swap_chain)
|
||||
|
||||
onscreen_template->config.swap_chain = swap_chain;
|
||||
if (swap_chain)
|
||||
cogl_object_ref (swap_chain);
|
||||
g_object_ref (swap_chain);
|
||||
else
|
||||
onscreen_template->config.swap_chain = cogl_swap_chain_new ();
|
||||
|
||||
|
@ -30,11 +30,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cogl/cogl-object-private.h"
|
||||
#include <glib-object.h>
|
||||
|
||||
struct _CoglSwapChain
|
||||
{
|
||||
CoglObject _parent;
|
||||
GObject parent_instance;
|
||||
|
||||
int length;
|
||||
};
|
||||
|
@ -31,32 +31,29 @@
|
||||
|
||||
#include "cogl-config.h"
|
||||
|
||||
#include "cogl/cogl-object.h"
|
||||
|
||||
#include "cogl/cogl-swap-chain-private.h"
|
||||
#include "cogl/cogl-swap-chain.h"
|
||||
#include "cogl/cogl-gtype-private.h"
|
||||
|
||||
static void _cogl_swap_chain_free (CoglSwapChain *swap_chain);
|
||||
|
||||
COGL_OBJECT_DEFINE (SwapChain, swap_chain);
|
||||
COGL_GTYPE_DEFINE_CLASS (SwapChain, swap_chain);
|
||||
|
||||
G_DEFINE_TYPE (CoglSwapChain, cogl_swap_chain, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
_cogl_swap_chain_free (CoglSwapChain *swap_chain)
|
||||
cogl_swap_chain_init (CoglSwapChain *swap_chain)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_swap_chain_class_init (CoglSwapChainClass *class)
|
||||
{
|
||||
g_free (swap_chain);
|
||||
}
|
||||
|
||||
CoglSwapChain *
|
||||
cogl_swap_chain_new (void)
|
||||
{
|
||||
CoglSwapChain *swap_chain = g_new0 (CoglSwapChain, 1);
|
||||
CoglSwapChain *swap_chain = g_object_new (COGL_TYPE_SWAP_CHAIN, NULL);
|
||||
|
||||
swap_chain->length = -1; /* no preference */
|
||||
|
||||
return _cogl_swap_chain_object_new (swap_chain);
|
||||
return swap_chain;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,13 +40,12 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _CoglSwapChain CoglSwapChain;
|
||||
|
||||
/**
|
||||
* cogl_swap_chain_get_gtype:
|
||||
*
|
||||
* Returns: a #GType that can be used with the GLib type system.
|
||||
*/
|
||||
#define COGL_TYPE_SWAP_CHAIN (cogl_swap_chain_get_type ())
|
||||
|
||||
COGL_EXPORT
|
||||
GType cogl_swap_chain_get_gtype (void);
|
||||
G_DECLARE_FINAL_TYPE (CoglSwapChain, cogl_swap_chain,
|
||||
COGL, SWAP_CHAIN, GObject)
|
||||
|
||||
|
||||
COGL_EXPORT CoglSwapChain *
|
||||
cogl_swap_chain_new (void);
|
||||
@ -59,7 +58,4 @@ COGL_EXPORT void
|
||||
cogl_swap_chain_set_length (CoglSwapChain *swap_chain,
|
||||
int length);
|
||||
|
||||
COGL_EXPORT gboolean
|
||||
cogl_is_swap_chain (void *object);
|
||||
|
||||
G_END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user