diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2009-06-11 15:33:05 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2009-06-11 15:36:27 -0400 |
commit | 442991a712e6dc34ebf890aaa5f1343666c96d56 (patch) | |
tree | ec596126fb0fff7e4ddc63c6dbf5c1a28614abf8 | |
parent | 7eae5d4eabc33985f3a1dc4cd911f1256f2f222a (diff) | |
download | mutter-442991a712e6dc34ebf890aaa5f1343666c96d56.tar.gz |
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
-rwxr-xr-x | src/compositor/mutter/mutter-shaped-texture.c | 14 | ||||
-rw-r--r-- | src/compositor/mutter/tidy/tidy-texture-frame.c | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/compositor/mutter/mutter-shaped-texture.c b/src/compositor/mutter/mutter-shaped-texture.c index ef78e25c7..9a91150bb 100755 --- a/src/compositor/mutter/mutter-shaped-texture.c +++ b/src/compositor/mutter/mutter-shaped-texture.c @@ -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); } diff --git a/src/compositor/mutter/tidy/tidy-texture-frame.c b/src/compositor/mutter/tidy/tidy-texture-frame.c index 28ca96ac3..879cb6104 100644 --- a/src/compositor/mutter/tidy/tidy-texture-frame.c +++ b/src/compositor/mutter/tidy/tidy-texture-frame.c @@ -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); |