From b80e84dea67a3f328628215b129b126c13fda604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 7 Jul 2022 09:20:04 +0200 Subject: [PATCH] clutter/frame-clock: Allow frame clock listener iface allocate frame This will allow the frame clock listener to allocate larger structs where it can keep e.g. backend specific frame state. Part-of: --- clutter/clutter/clutter-frame-clock.c | 6 +++++- clutter/clutter/clutter-frame-clock.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index fccc55aca..e4f03df6b 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -732,7 +732,11 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock, frame_count = frame_clock->frame_count++; - frame = clutter_frame_new (); + if (iface->new_frame) + frame = iface->new_frame (frame_clock, frame_clock->listener.user_data); + if (!frame) + frame = clutter_frame_new (); + frame->frame_count = frame_count; frame->has_target_presentation_time = frame_clock->is_next_presentation_time_valid; frame->target_presentation_time_us = frame_clock->next_presentation_time_us; diff --git a/clutter/clutter/clutter-frame-clock.h b/clutter/clutter/clutter-frame-clock.h index 9dfc8dc28..6fd5de47a 100644 --- a/clutter/clutter/clutter-frame-clock.h +++ b/clutter/clutter/clutter-frame-clock.h @@ -51,6 +51,8 @@ typedef struct _ClutterFrameListenerIface ClutterFrameResult (* frame) (ClutterFrameClock *frame_clock, ClutterFrame *frame, gpointer user_data); + ClutterFrame * (* new_frame) (ClutterFrameClock *frame_clock, + gpointer user_data); } ClutterFrameListenerIface; CLUTTER_EXPORT