diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2011-06-13 17:18:27 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2011-06-29 12:27:02 -0400 |
commit | fe12294b92794077e7512d0322a50a082d733b7a (patch) | |
tree | 0ef3a7c5959f4cac833b73fb55deff255913438c /src/compositor/cogl-utils.c | |
parent | 61b5cfece43d9f9bb4c2e1af00f58276d5bd9d74 (diff) | |
download | mutter-fe12294b92794077e7512d0322a50a082d733b7a.tar.gz |
Create the 1x1 texture for the root background unsliced
When there was no root background pixmap, we were using a 1x1 repeating
texture as a simple way of drawing a solid color without adding a
second code path. However, when that 1x1 texture was combined into
a larger "atlas texture", hardware repeat couldn't be used, so a
small inefficiency from this approach became an enormous inefficiency
as clutter drew every pixel of the background as a separate rectangle.
https://bugzilla.gnome.org/show_bug.cgi?id=652507
Diffstat (limited to 'src/compositor/cogl-utils.c')
-rw-r--r-- | src/compositor/cogl-utils.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c index 2e5183cb4..5dbe3dfae 100644 --- a/src/compositor/cogl-utils.c +++ b/src/compositor/cogl-utils.c @@ -29,6 +29,10 @@ * @green: * @blue: * @alpha: + * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE; + * %COGL_TEXTURE_NO_SLICING is useful if the texture will be + * repeated to create a constant color fill, since hardware + * repeat can't be used for a sliced texture. * * Creates a texture that is a single pixel with the specified * unpremultiplied color components. @@ -36,10 +40,11 @@ * Return value: (transfer full): a newly created Cogl texture */ CoglHandle -meta_create_color_texture_4ub (guint8 red, - guint8 green, - guint8 blue, - guint8 alpha) +meta_create_color_texture_4ub (guint8 red, + guint8 green, + guint8 blue, + guint8 alpha, + CoglTextureFlags flags) { CoglColor color; guint8 pixel[4]; @@ -53,7 +58,7 @@ meta_create_color_texture_4ub (guint8 red, pixel[3] = cogl_color_get_alpha_byte (&color); return cogl_texture_new_from_data (1, 1, - COGL_TEXTURE_NONE, + flags, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_PIXEL_FORMAT_ANY, 4, pixel); @@ -88,7 +93,8 @@ meta_create_texture_material (CoglHandle src_texture) { CoglHandle dummy_texture; - dummy_texture = meta_create_color_texture_4ub (0xff, 0xff, 0xff, 0xff); + dummy_texture = meta_create_color_texture_4ub (0xff, 0xff, 0xff, 0xff, + COGL_TEXTURE_NONE); texture_material_template = cogl_material_new (); cogl_material_set_layer (texture_material_template, 0, dummy_texture); |