[mutter/gbsneto/graphene-ray: 2/6] clutter/pick-stack: Store current matrix entry
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene-ray: 2/6] clutter/pick-stack: Store current matrix entry
- Date: Mon, 26 Oct 2020 13:01:52 +0000 (UTC)
commit 620f0ad74bee99b977f991aaf96585ff51e6f2bc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Oct 17 09:37:39 2020 -0300
clutter/pick-stack: Store current matrix entry
This is the beginning of the preparations to passing unprojected
rectangles to the clip stack. Store a ref to the current tip of
the matrix entry.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
clutter/clutter/clutter-pick-stack.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/clutter/clutter/clutter-pick-stack.c b/clutter/clutter/clutter-pick-stack.c
index 1f0c47a214..4fd279d37b 100644
--- a/clutter/clutter/clutter-pick-stack.c
+++ b/clutter/clutter/clutter-pick-stack.c
@@ -23,12 +23,14 @@ typedef struct
graphene_point_t vertices[4];
ClutterActor *actor;
int clip_index;
+ CoglMatrixEntry *matrix_entry;
} PickRecord;
typedef struct
{
int prev;
graphene_point_t vertices[4];
+ CoglMatrixEntry *matrix_entry;
} PickClipRecord;
struct _ClutterPickStack
@@ -224,6 +226,20 @@ clutter_pick_stack_dispose (ClutterPickStack *pick_stack)
g_clear_pointer (&pick_stack->clip_stack, g_array_unref);
}
+static void
+clear_pick_record (gpointer data)
+{
+ PickRecord *rec = data;
+ g_clear_pointer (&rec->matrix_entry, cogl_matrix_entry_unref);
+}
+
+static void
+clear_clip_record (gpointer data)
+{
+ PickClipRecord *clip = data;
+ g_clear_pointer (&clip->matrix_entry, cogl_matrix_entry_unref);
+}
+
/**
* clutter_pick_stack_new:
* @context: a #CoglContext
@@ -244,6 +260,9 @@ clutter_pick_stack_new (CoglContext *context)
pick_stack->clip_stack = g_array_new (FALSE, FALSE, sizeof (PickClipRecord));
pick_stack->current_clip_stack_top = -1;
+ g_array_set_clear_func (pick_stack->vertices_stack, clear_pick_record);
+ g_array_set_clear_func (pick_stack->clip_stack, clear_clip_record);
+
return pick_stack;
}
@@ -301,6 +320,8 @@ clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
memcpy (rec.vertices, vertices, 4 * sizeof (graphene_point_t));
rec.actor = actor;
rec.clip_index = pick_stack->current_clip_stack_top;
+ rec.matrix_entry = cogl_matrix_stack_get_entry (pick_stack->matrix_stack);
+ cogl_matrix_entry_ref (rec.matrix_entry);
g_array_append_val (pick_stack->vertices_stack, rec);
}
@@ -315,6 +336,8 @@ clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
clip.prev = pick_stack->current_clip_stack_top;
memcpy (clip.vertices, vertices, 4 * sizeof (graphene_point_t));
+ clip.matrix_entry = cogl_matrix_stack_get_entry (pick_stack->matrix_stack);
+ cogl_matrix_entry_ref (clip.matrix_entry);
g_array_append_val (pick_stack->clip_stack, clip);
pick_stack->current_clip_stack_top = pick_stack->clip_stack->len - 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]