Remove the X11-specific bit in ClutterStageCogl
Let's use a new virtual function in ClutterStageWindow to check whether a platform-specific implementation does support clipped redraws.
This commit is contained in:
parent
f58d393187
commit
fedfac3b7c
@ -234,3 +234,17 @@ _clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window)
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->can_clip_redraws != NULL)
|
||||
return iface->can_clip_redraws (window);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ struct _ClutterStageWindowIface
|
||||
void (* redraw) (ClutterStageWindow *stage_window);
|
||||
|
||||
CoglFramebuffer *(* get_active_framebuffer) (ClutterStageWindow *stage_window);
|
||||
|
||||
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
|
||||
};
|
||||
|
||||
GType clutter_stage_window_get_type (void) G_GNUC_CONST;
|
||||
@ -118,6 +120,8 @@ void _clutter_stage_window_redraw (ClutterStageWin
|
||||
|
||||
CoglFramebuffer *_clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window);
|
||||
|
||||
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_WINDOW_H__ */
|
||||
|
@ -45,11 +45,6 @@
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-util.h"
|
||||
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
/* FIXME: needed for a small check in redraw(), needs to be moved */
|
||||
#include "x11/clutter-stage-x11.h"
|
||||
#endif
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageCogl,
|
||||
@ -354,25 +349,15 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
CLUTTER_TIMER_START (_clutter_uprof_context, painting_timer);
|
||||
|
||||
may_use_clipped_redraw = FALSE;
|
||||
if (G_LIKELY (backend_cogl->can_blit_sub_buffer) &&
|
||||
if (_clutter_stage_window_can_clip_redraws (stage_window) &&
|
||||
G_LIKELY (backend_cogl->can_blit_sub_buffer) &&
|
||||
/* NB: a zero width redraw clip == full stage redraw */
|
||||
stage_cogl->bounding_redraw_clip.width != 0 &&
|
||||
/* some drivers struggle to get going and produce some junk
|
||||
* frames when starting up... */
|
||||
G_LIKELY (stage_cogl->frame_count > 3))
|
||||
{
|
||||
#if defined(CLUTTER_WINDOWING_X11)
|
||||
/* FIXME - move this to a StageWindow vfunc */
|
||||
|
||||
/* While resizing a window clipped redraws are disabled to avoid
|
||||
* artefacts. See clutter-event-x11.c:event_translate for a
|
||||
* detailed explanation */
|
||||
if (CLUTTER_IS_STAGE_X11 (stage_cogl) &&
|
||||
(CLUTTER_STAGE_X11 (stage_cogl)->clipped_redraws_cool_off == 0))
|
||||
{
|
||||
may_use_clipped_redraw = TRUE;
|
||||
}
|
||||
#endif
|
||||
may_use_clipped_redraw = TRUE;
|
||||
}
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
|
@ -406,6 +406,12 @@ clutter_stage_gdk_hide (ClutterStageWindow *stage_window)
|
||||
gdk_window_hide (stage_gdk->window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_gdk_can_clip_redraws (ClutterStageWindow *stage_window)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_gdk_dispose (GObject *gobject)
|
||||
{
|
||||
@ -461,6 +467,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->get_geometry = clutter_stage_gdk_get_geometry;
|
||||
iface->realize = clutter_stage_gdk_realize;
|
||||
iface->unrealize = clutter_stage_gdk_unrealize;
|
||||
iface->can_clip_redraws = clutter_stage_gdk_can_clip_redraws;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -471,7 +478,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
*
|
||||
* Return value: (transfer none): A GdkWindow* for the stage window.
|
||||
*
|
||||
* Since: 0.4
|
||||
* Since: 1.10
|
||||
*/
|
||||
GdkWindow *
|
||||
clutter_gdk_get_stage_window (ClutterStage *stage)
|
||||
@ -499,7 +506,7 @@ clutter_gdk_get_stage_window (ClutterStage *stage)
|
||||
* Return value: (transfer none): A #ClutterStage, or% NULL if a stage
|
||||
* does not exist for the window
|
||||
*
|
||||
* Since: 0.8
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterStage *
|
||||
clutter_gdk_get_stage_from_window (GdkWindow *window)
|
||||
@ -544,7 +551,7 @@ set_foreign_window_callback (ClutterActor *actor,
|
||||
*
|
||||
* Return value: %TRUE if foreign window is valid
|
||||
*
|
||||
* Since: 0.4
|
||||
* Since: 1.10
|
||||
*/
|
||||
gboolean
|
||||
clutter_gdk_set_stage_foreign (ClutterStage *stage,
|
||||
@ -554,7 +561,6 @@ clutter_gdk_set_stage_foreign (ClutterStage *stage,
|
||||
ClutterStageGdk *stage_gdk;
|
||||
ClutterStageWindow *impl;
|
||||
ClutterActor *actor;
|
||||
gpointer gtk_data = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
g_return_val_if_fail (!CLUTTER_ACTOR_IN_DESTRUCTION (stage), FALSE);
|
||||
@ -575,16 +581,6 @@ clutter_gdk_set_stage_foreign (ClutterStage *stage,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
gdk_window_get_user_data (window, >k_data);
|
||||
if (gtk_data != NULL)
|
||||
{
|
||||
g_critical ("The provided GdkWindow is already in use by a GtkWidget. "
|
||||
"Use a child GdkWindow for embedding instead");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
closure.stage_gdk = stage_gdk;
|
||||
closure.window = g_object_ref (window);
|
||||
|
||||
|
@ -759,6 +759,18 @@ clutter_stage_x11_hide (ClutterStageWindow *stage_window)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
|
||||
/* while resizing a window, clipped redraws are disabled in order to
|
||||
* avoid artefacts. see clutter-event-x11.c:event_translate for a more
|
||||
* detailed explanation
|
||||
*/
|
||||
return stage_x11->clipped_redraws_cool_off == 0;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_x11_finalize (GObject *gobject)
|
||||
{
|
||||
@ -823,6 +835,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->get_geometry = clutter_stage_x11_get_geometry;
|
||||
iface->realize = clutter_stage_x11_realize;
|
||||
iface->unrealize = clutter_stage_x11_unrealize;
|
||||
iface->can_clip_redraws = clutter_stage_x11_can_clip_redraws;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
Loading…
Reference in New Issue
Block a user