mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter/effect: Don't call effect paint_node() if pre_paint() failed
Some effects such as the BrightnessContrastEffect try to skip rendering by returning early with a FALSE return value in pre_paint() in cases where the effect would not change the rendering. This stopped working when effects were ported to paint nodes. In the case of OffscreenEffects, like BrightnessContrastEffect, pre_paint() is responsible for setting up the offscreen buffer which is then used in paint_node(). However if pre_paint() fails, this buffer is not created and attempting to use it will result in several error messages and broken rendering. Instead of trying to call paint_node() of the effect if pre_paint() failed, just draw the actor. Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1576 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1658>
This commit is contained in:
parent
189eb4c7a7
commit
791761499a
@ -201,10 +201,8 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_paint_node (ClutterEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
add_actor_node (ClutterEffect *effect,
|
||||
ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPaintNode *actor_node;
|
||||
ClutterActor *actor;
|
||||
@ -216,6 +214,15 @@ clutter_effect_real_paint_node (ClutterEffect *effect,
|
||||
clutter_paint_node_unref (actor_node);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_paint_node (ClutterEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
add_actor_node (effect, node);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_paint (ClutterEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
@ -231,10 +238,16 @@ clutter_effect_real_paint (ClutterEffect *effect,
|
||||
|
||||
pre_paint_succeeded = effect_class->pre_paint (effect, node,paint_context);
|
||||
|
||||
effect_class->paint_node (effect, node, paint_context, flags);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
effect_class->post_paint (effect, node, paint_context);
|
||||
{
|
||||
effect_class->paint_node (effect, node, paint_context, flags);
|
||||
effect_class->post_paint (effect, node, paint_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just paint the actor as fallback */
|
||||
add_actor_node (effect, node);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user