[mutter] Adapt to premultiplied alpha usage in Cogl
- From: Owen Taylor <otaylor src gnome org>
- To: svn-commits-list gnome org
- Subject: [mutter] Adapt to premultiplied alpha usage in Cogl
- Date: Thu, 11 Jun 2009 15:36:54 -0400 (EDT)
commit 442991a712e6dc34ebf890aaa5f1343666c96d56
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Jun 11 15:33:05 2009 -0400
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
src/compositor/mutter/mutter-shaped-texture.c | 14 ++++++++------
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 ef78e25..9a91150 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 28ca96a..879cb61 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]