From e27bbdc769ca7753b961e3eef6899c9027c3c2ed Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Fri, 12 Sep 2014 10:44:18 -0400 Subject: [PATCH] Fix colors for horizontal background gradients COGL_PIXEL_FORMAT_RGB_888 is packed 3-bytes per pixel. --- src/compositor/meta-background.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index d78603c1c..0fb784a15 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -505,7 +505,7 @@ ensure_color_texture (MetaBackground *self) { ClutterBackend *backend = clutter_get_default_backend (); CoglContext *ctx = clutter_backend_get_cogl_context (backend); - uint8_t pixels[8]; + uint8_t pixels[6]; int width, height; if (priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID) @@ -516,7 +516,6 @@ ensure_color_texture (MetaBackground *self) pixels[0] = priv->color.red; pixels[1] = priv->color.green; pixels[2] = priv->color.blue; - pixels[3] = 0xFF; } else { @@ -537,16 +536,14 @@ ensure_color_texture (MetaBackground *self) pixels[0] = priv->color.red; pixels[1] = priv->color.green; pixels[2] = priv->color.blue; - pixels[3] = 0xFF; - pixels[4] = priv->second_color.red; - pixels[5] = priv->second_color.green; - pixels[6] = priv->second_color.blue; - pixels[7] = 0xFF; + pixels[3] = priv->second_color.red; + pixels[4] = priv->second_color.green; + pixels[5] = priv->second_color.blue; } priv->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height, COGL_PIXEL_FORMAT_RGB_888, - 4, + width * 3, pixels, NULL)); }