cogl: Keep a backpointer to context/display
Allows to retrieve the context from the renderer, allows to get rid of one GET_CONTEXT usages Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
This commit is contained in:
parent
725e826a39
commit
c1733e8d7c
5 changed files with 9 additions and 2 deletions
|
@ -224,6 +224,8 @@ cogl_context_new (CoglDisplay *display,
|
|||
memset (context->winsys_features, 0, sizeof (context->winsys_features));
|
||||
|
||||
context->display = g_object_ref (display);
|
||||
/* Keep a backpointer to the context */
|
||||
display->context = context;
|
||||
|
||||
/* This is duplicated data, but it's much more convenient to have
|
||||
the driver attached to the context and the value is accessed a
|
||||
|
|
|
@ -38,6 +38,8 @@ struct _CoglDisplay
|
|||
{
|
||||
GObjectClass parnet_class;
|
||||
|
||||
CoglContext *context;
|
||||
|
||||
gboolean setup;
|
||||
CoglRenderer *renderer;
|
||||
CoglOnscreenTemplate *onscreen_template;
|
||||
|
|
|
@ -90,6 +90,7 @@ cogl_display_new (CoglRenderer *renderer,
|
|||
CoglDisplay *display = g_object_new (COGL_TYPE_DISPLAY, NULL);
|
||||
|
||||
display->renderer = g_object_ref (renderer);
|
||||
renderer->display = display;
|
||||
display->setup = FALSE;
|
||||
|
||||
cogl_display_set_onscreen_template (display, onscreen_template);
|
||||
|
|
|
@ -43,6 +43,9 @@ typedef const CoglWinsysVtable *(*CoglCustomWinsysVtableGetter) (CoglRenderer *r
|
|||
struct _CoglRenderer
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
CoglDisplay *display;
|
||||
|
||||
gboolean connected;
|
||||
CoglDriver driver_override;
|
||||
const CoglDriverVtable *driver_vtable;
|
||||
|
|
|
@ -261,8 +261,7 @@ static gboolean
|
|||
update_all_outputs (CoglRenderer *renderer)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
_COGL_GET_CONTEXT (context, FALSE);
|
||||
CoglContext *context = renderer->display->context;
|
||||
|
||||
if (context->display == NULL) /* during connection */
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue