paint-nodes: Sanity check color transform in blit nodes
Blitting cannot run with a shader, thus cannot do color state transformations, so log a warning when that happens. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
This commit is contained in:
parent
9a0fbbfa81
commit
a1163385db
3 changed files with 25 additions and 0 deletions
|
@ -843,3 +843,20 @@ clutter_color_state_get_transform_snippet (ClutterColorState *color_state,
|
|||
g_object_ref (snippet));
|
||||
return snippet;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_color_state_equals (ClutterColorState *color_state,
|
||||
ClutterColorState *other_color_state)
|
||||
{
|
||||
ClutterColorStatePrivate *priv;
|
||||
ClutterColorStatePrivate *other_priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_COLOR_STATE (color_state), FALSE);
|
||||
g_return_val_if_fail (CLUTTER_IS_COLOR_STATE (other_color_state), FALSE);
|
||||
|
||||
priv = clutter_color_state_get_instance_private (color_state);
|
||||
other_priv = clutter_color_state_get_instance_private (other_color_state);
|
||||
|
||||
return (priv->colorspace == other_priv->colorspace &&
|
||||
priv->transfer_function == other_priv->transfer_function);
|
||||
}
|
||||
|
|
|
@ -53,4 +53,8 @@ CLUTTER_EXPORT
|
|||
CoglSnippet * clutter_color_state_get_transform_snippet (ClutterColorState *color_state,
|
||||
ClutterColorState *target_color_state);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_color_state_equals (ClutterColorState *color_state,
|
||||
ClutterColorState *other_color_state);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -1336,6 +1336,10 @@ clutter_blit_node_draw (ClutterPaintNode *node,
|
|||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
g_warn_if_fail (clutter_color_state_equals (
|
||||
clutter_paint_context_get_color_state (paint_context),
|
||||
clutter_paint_context_get_target_color_state (paint_context)));
|
||||
|
||||
framebuffer = get_target_framebuffer (node, paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
|
|
Loading…
Reference in a new issue