1
0
Fork 0

Adapt to premultiplied alpha usage in Cogl

Cogl's default blend function has been switched to expect premultiplied
alpha. Change the combine function and the colors we use to
modulate alpha to match.

http://bugzilla.gnome.org/show_bug.cgi?id=585480
This commit is contained in:
Owen W. Taylor 2009-06-11 15:33:05 -04:00
parent 7eae5d4eab
commit 442991a712
2 changed files with 9 additions and 7 deletions

View file

@ -283,8 +283,7 @@ mutter_shaped_texture_paint (ClutterActor *actor)
priv->material = cogl_material_new ();
cogl_material_set_layer_combine (priv->material, 1,
"RGB = REPLACE (PREVIOUS)"
"A = MODULATE (PREVIOUS, TEXTURE)",
"RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
NULL);
}
material = priv->material;
@ -305,9 +304,12 @@ mutter_shaped_texture_paint (ClutterActor *actor)
{
material = priv->material_workaround = cogl_material_new ();
cogl_material_set_layer_combine (material, 0,
"RGB = MODULATE (TEXTURE, PREVIOUS)"
"A = REPLACE (PREVIOUS)",
NULL);
cogl_material_set_layer_combine (material, 1,
"RGB = REPLACE (PREVIOUS)"
"A = MODULATE (PRIMARY, TEXTURE)",
"RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
NULL);
}
@ -320,8 +322,8 @@ mutter_shaped_texture_paint (ClutterActor *actor)
{
CoglColor color;
cogl_color_set_from_4ub (&color, 255, 255, 255,
clutter_actor_get_paint_opacity (actor));
guchar opacity = clutter_actor_get_paint_opacity (actor);
cogl_color_set_from_4ub (&color, opacity, opacity, opacity, opacity);
cogl_material_set_color (material, &color);
}

View file

@ -210,7 +210,7 @@ tidy_texture_frame_paint (ClutterActor *self)
g_assert (priv->material != COGL_INVALID_HANDLE);
/* set the source material using the parent texture's COGL handle */
cogl_material_set_color4ub (priv->material, 255, 255, 255, opacity);
cogl_material_set_color4ub (priv->material, opacity, opacity, opacity, opacity);
cogl_material_set_layer (priv->material, 0, cogl_texture);
cogl_set_source (priv->material);