mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter/stage-view: Have each stage view create its own frame clock
The frame clock is meant to eventually drive the painting of the view, in contrast to the master frame clock painting every view on the stage. Right now it's a useless place holder. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
c00a8e98a3
commit
2e358f3c43
@ -19,6 +19,7 @@
|
||||
#define __CLUTTER_STAGE_VIEW_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-stage-view.h"
|
||||
#include "clutter/clutter-types.h"
|
||||
|
||||
void clutter_stage_view_after_paint (ClutterStageView *view,
|
||||
cairo_region_t *redraw_clip);
|
||||
@ -62,4 +63,6 @@ void clutter_stage_view_transform_rect_to_onscreen (ClutterStageView
|
||||
int dst_height,
|
||||
cairo_rectangle_int_t *dst_rect);
|
||||
|
||||
ClutterFrameClock * clutter_stage_view_get_frame_clock (ClutterStageView *view);
|
||||
|
||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-damage-history.h"
|
||||
#include "clutter/clutter-frame-clock.h"
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "cogl/cogl.h"
|
||||
@ -76,6 +77,7 @@ typedef struct _ClutterStageViewPrivate
|
||||
cairo_region_t *redraw_clip;
|
||||
|
||||
float refresh_rate;
|
||||
ClutterFrameClock *frame_clock;
|
||||
|
||||
guint dirty_viewport : 1;
|
||||
guint dirty_projection : 1;
|
||||
@ -999,6 +1001,41 @@ clutter_stage_view_take_scanout (ClutterStageView *view)
|
||||
return g_steal_pointer (&priv->next_scanout);
|
||||
}
|
||||
|
||||
ClutterFrameClock *
|
||||
clutter_stage_view_get_frame_clock (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
return priv->frame_clock;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_frame_clock_before_frame (ClutterFrameClock *frame_clock,
|
||||
int64_t frame_count,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterStageView *view = user_data;
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
_clutter_stage_process_queued_events (priv->stage);
|
||||
}
|
||||
|
||||
static ClutterFrameResult
|
||||
handle_frame_clock_frame (ClutterFrameClock *frame_clock,
|
||||
int64_t frame_count,
|
||||
int64_t time_us,
|
||||
gpointer user_data)
|
||||
{
|
||||
return CLUTTER_FRAME_RESULT_IDLE;
|
||||
}
|
||||
|
||||
static const ClutterFrameListenerIface frame_clock_listener_iface = {
|
||||
.before_frame = handle_frame_clock_before_frame,
|
||||
.frame = handle_frame_clock_frame,
|
||||
};
|
||||
|
||||
static void
|
||||
sanity_check_framebuffer (ClutterStageView *view)
|
||||
{
|
||||
@ -1122,6 +1159,10 @@ clutter_stage_view_constructed (GObject *object)
|
||||
if (priv->use_shadowfb)
|
||||
init_shadowfb (view);
|
||||
|
||||
priv->frame_clock = clutter_frame_clock_new (priv->refresh_rate,
|
||||
&frame_clock_listener_iface,
|
||||
view);
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
@ -1148,6 +1189,7 @@ clutter_stage_view_dispose (GObject *object)
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
g_clear_object (&priv->frame_clock);
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user