[PATCH] Use ARB_texture_rectangle for pixmap shape rectangle when appropriate
- From: Owen W. Taylor <otaylor redhat com>
- Subject: [PATCH] Use ARB_texture_rectangle for pixmap shape rectangle when appropriate
- Date: Wed, 5 Nov 2008 18:33:10 -0500
Use the newly added cogl_texture_new_from_data_and_options() to enable
use of ARB_texture_rectangle.
Support CLUTTER_PIXMAP_TEXTURE_RECTANGLE=[force|disable] in the same
way as Clutter now does.
---
src/compositor/mutter/mutter-shaped-texture.c | 43 +++++++++++++++++++++---
1 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/src/compositor/mutter/mutter-shaped-texture.c b/src/compositor/mutter/mutter-shaped-texture.c
index c237870..3bb88f3 100644
--- a/src/compositor/mutter/mutter-shaped-texture.c
+++ b/src/compositor/mutter/mutter-shaped-texture.c
@@ -226,6 +226,36 @@ mutter_shaped_texture_get_gl_size (CoglHandle tex,
}
}
+static CoglTextureOptions
+get_texture_options (void)
+{
+ static gboolean initialized = FALSE;
+ static CoglTextureOptions options;
+
+ if (!initialized)
+ {
+ const char *env_string;
+
+ initialized = TRUE;
+
+ options = COGL_TEXTURE_ALLOW_RECTANGLE;
+
+ env_string = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE");
+ if (env_string)
+ {
+ if (strcasecmp (env_string, "force") == 0)
+ options |= COGL_TEXTURE_FORCE_RECTANGLE;
+ else if (strcasecmp (env_string, "disable") == 0)
+ options &= ~COGL_TEXTURE_ALLOW_RECTANGLE;
+ else if (env_string[0])
+ g_warning ("Unknown value for CLUTTER_PIXMAP_TEXTURE_RECTANGLE, "
+ "should be 'force' or 'disable'");
+ }
+ }
+
+ return options;
+}
+
static void
mutter_shaped_texture_ensure_mask (MutterShapedTexture *stex)
{
@@ -280,12 +310,13 @@ mutter_shaped_texture_ensure_mask (MutterShapedTexture *stex)
memset (p, 255, x2 - x1);
}
- priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
- -1, FALSE,
- COGL_PIXEL_FORMAT_A_8,
- COGL_PIXEL_FORMAT_ANY,
- tex_width,
- mask_data);
+ priv->mask_texture = cogl_texture_new_from_data_and_options (tex_width, tex_height,
+ -1,
+ get_texture_options(),
+ COGL_PIXEL_FORMAT_A_8,
+ COGL_PIXEL_FORMAT_ANY,
+ tex_width,
+ mask_data);
g_free (mask_data);
--
1.6.0.3
--=-1gOaMbTF0IoDctbcw5Ip--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]