From fb3d352d3ae7bbfba50d7264a85775dbfec2ef61 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Thu, 11 Feb 2010 15:21:30 +0000 Subject: [PATCH] [MutterShapedTexture] Use cogl multitexture API The older code relied on Clutter providing default texture coords for any layers for which texture coords were not specified, which does not work as of Clutter 1.1.6 (due to commit 8b950bdc87fae2626af8a96916b7f51fdea40a17). https://bugzilla.gnome.org/show_bug.cgi?id=609657 --- src/compositor/mutter-shaped-texture.c | 32 +++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/compositor/mutter-shaped-texture.c b/src/compositor/mutter-shaped-texture.c index 8a04804c0..a335cf13a 100755 --- a/src/compositor/mutter-shaped-texture.c +++ b/src/compositor/mutter-shaped-texture.c @@ -427,24 +427,34 @@ mutter_shaped_texture_paint (ClutterActor *actor) } else { - float coords[MAX_RECTS * 8]; + float coords[8]; + float x1, y1, x2, y2; + for (i = 0; i < n_rects; i++) { GdkRectangle *rect = &rects[i]; - coords[i * 8 + 0] = rect->x; - coords[i * 8 + 1] = rect->y; - coords[i * 8 + 2] = rect->x + rect->width; - coords[i * 8 + 3] = rect->y + rect->height; - coords[i * 8 + 4] = rect->x / (alloc.x2 - alloc.x1); - coords[i * 8 + 5] = rect->y / (alloc.y2 - alloc.y1); - coords[i * 8 + 6] = (rect->x + rect->width) / (alloc.x2 - alloc.x1); - coords[i * 8 + 7] = (rect->y + rect->height) / (alloc.y2 - alloc.y1); - } + x1 = rect->x; + y1 = rect->y; + x2 = rect->x + rect->width; + y2 = rect->y + rect->height; + + coords[0] = rect->x / (alloc.x2 - alloc.x1); + coords[1] = rect->y / (alloc.y2 - alloc.y1); + coords[2] = (rect->x + rect->width) / (alloc.x2 - alloc.x1); + coords[3] = (rect->y + rect->height) / (alloc.y2 - alloc.y1); + + coords[4] = coords[0]; + coords[5] = coords[1]; + coords[6] = coords[2]; + coords[7] = coords[3]; + + cogl_rectangle_with_multitexture_coords (x1, y1, x2, y2, + &coords[0], 8); + } g_free (rects); - cogl_rectangles_with_texture_coords (coords, n_rects); return; } }