mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 05:12:15 +00:00
cogl: Port OnscreenTemplate away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:
parent
df8ae83040
commit
d71fe5c55e
@ -237,7 +237,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
|
||||
backend->cogl_display = cogl_display_new (backend->cogl_renderer, tmpl);
|
||||
|
||||
/* the display owns the template */
|
||||
cogl_object_unref (tmpl);
|
||||
g_object_unref (tmpl);
|
||||
}
|
||||
|
||||
if (backend->cogl_display == NULL)
|
||||
|
@ -70,7 +70,7 @@ cogl_display_dispose (GObject *object)
|
||||
|
||||
if (display->onscreen_template)
|
||||
{
|
||||
cogl_object_unref (display->onscreen_template);
|
||||
g_object_unref (display->onscreen_template);
|
||||
display->onscreen_template = NULL;
|
||||
}
|
||||
|
||||
@ -128,10 +128,10 @@ cogl_display_set_onscreen_template (CoglDisplay *display,
|
||||
g_return_if_fail (display->setup == FALSE);
|
||||
|
||||
if (onscreen_template)
|
||||
cogl_object_ref (onscreen_template);
|
||||
g_object_ref (onscreen_template);
|
||||
|
||||
if (display->onscreen_template)
|
||||
cogl_object_unref (display->onscreen_template);
|
||||
g_object_unref (display->onscreen_template);
|
||||
|
||||
display->onscreen_template = onscreen_template;
|
||||
|
||||
|
@ -30,13 +30,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cogl/cogl-object-private.h"
|
||||
#include "cogl/cogl-swap-chain.h"
|
||||
#include "cogl/cogl-framebuffer-private.h"
|
||||
|
||||
struct _CoglOnscreenTemplate
|
||||
{
|
||||
CoglObject _parent;
|
||||
GObject parent_instance;
|
||||
|
||||
CoglFramebufferConfig config;
|
||||
};
|
||||
|
@ -31,29 +31,27 @@
|
||||
|
||||
#include "cogl-config.h"
|
||||
|
||||
#include "cogl/cogl-object.h"
|
||||
|
||||
#include "cogl/cogl-framebuffer-private.h"
|
||||
#include "cogl/cogl-onscreen-template-private.h"
|
||||
#include "cogl/cogl-gtype-private.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template);
|
||||
|
||||
COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template);
|
||||
COGL_GTYPE_DEFINE_CLASS (OnscreenTemplate, onscreen_template);
|
||||
G_DEFINE_TYPE (CoglOnscreenTemplate, cogl_onscreen_template, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
_cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template)
|
||||
cogl_onscreen_template_init (CoglOnscreenTemplate *onscreen_template)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_onscreen_template_class_init (CoglOnscreenTemplateClass *class)
|
||||
{
|
||||
g_free (onscreen_template);
|
||||
}
|
||||
|
||||
CoglOnscreenTemplate *
|
||||
cogl_onscreen_template_new (CoglSwapChain *swap_chain)
|
||||
{
|
||||
CoglOnscreenTemplate *onscreen_template = g_new0 (CoglOnscreenTemplate, 1);
|
||||
CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL);
|
||||
char *user_config;
|
||||
|
||||
onscreen_template->config.swap_chain = swap_chain;
|
||||
@ -74,7 +72,7 @@ cogl_onscreen_template_new (CoglSwapChain *swap_chain)
|
||||
samples_per_pixel;
|
||||
}
|
||||
|
||||
return _cogl_onscreen_template_object_new (onscreen_template);
|
||||
return onscreen_template;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -42,17 +42,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate;
|
||||
typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate;
|
||||
|
||||
#define COGL_ONSCREEN_TEMPLATE(OBJECT) ((CoglOnscreenTemplate *)OBJECT)
|
||||
#define COGL_TYPE_ONSCREEN_TEMPLATE (cogl_onscreen_template_get_type ())
|
||||
|
||||
/**
|
||||
* cogl_onscreen_template_get_gtype:
|
||||
*
|
||||
* Returns: a #GType that can be used with the GLib type system.
|
||||
*/
|
||||
COGL_EXPORT
|
||||
GType cogl_onscreen_template_get_gtype (void);
|
||||
G_DECLARE_FINAL_TYPE (CoglOnscreenTemplate, cogl_onscreen_template,
|
||||
COGL, ONSCREEN_TEMPLATE, GObject)
|
||||
|
||||
COGL_EXPORT CoglOnscreenTemplate *
|
||||
cogl_onscreen_template_new (CoglSwapChain *swap_chain);
|
||||
@ -95,18 +91,7 @@ cogl_onscreen_template_set_samples_per_pixel (
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
cogl_onscreen_template_set_stereo_enabled (
|
||||
CoglOnscreenTemplate *onscreen_template,
|
||||
gboolean enabled);
|
||||
/**
|
||||
* cogl_is_onscreen_template:
|
||||
* @object: A #CoglObject pointer
|
||||
*
|
||||
* Gets whether the given object references a #CoglOnscreenTemplate.
|
||||
*
|
||||
* Return value: %TRUE if the object references a #CoglOnscreenTemplate
|
||||
* and %FALSE otherwise.
|
||||
*/
|
||||
COGL_EXPORT gboolean
|
||||
cogl_is_onscreen_template (void *object);
|
||||
CoglOnscreenTemplate *onscreen_template,
|
||||
gboolean enabled);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -164,7 +164,7 @@ meta_clutter_backend_x11_get_display (ClutterBackend *clutter_backend,
|
||||
if (res)
|
||||
display = cogl_display_new (renderer, onscreen_template);
|
||||
|
||||
cogl_object_unref (onscreen_template);
|
||||
g_object_unref (onscreen_template);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user