1
0
Fork 0

Fix colors for horizontal background gradients

COGL_PIXEL_FORMAT_RGB_888 is packed 3-bytes per pixel.
This commit is contained in:
Owen W. Taylor 2014-09-12 10:44:18 -04:00
parent 09b46029fa
commit e27bbdc769

View file

@ -505,7 +505,7 @@ ensure_color_texture (MetaBackground *self)
{ {
ClutterBackend *backend = clutter_get_default_backend (); ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend); CoglContext *ctx = clutter_backend_get_cogl_context (backend);
uint8_t pixels[8]; uint8_t pixels[6];
int width, height; int width, height;
if (priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID) if (priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID)
@ -516,7 +516,6 @@ ensure_color_texture (MetaBackground *self)
pixels[0] = priv->color.red; pixels[0] = priv->color.red;
pixels[1] = priv->color.green; pixels[1] = priv->color.green;
pixels[2] = priv->color.blue; pixels[2] = priv->color.blue;
pixels[3] = 0xFF;
} }
else else
{ {
@ -537,16 +536,14 @@ ensure_color_texture (MetaBackground *self)
pixels[0] = priv->color.red; pixels[0] = priv->color.red;
pixels[1] = priv->color.green; pixels[1] = priv->color.green;
pixels[2] = priv->color.blue; pixels[2] = priv->color.blue;
pixels[3] = 0xFF; pixels[3] = priv->second_color.red;
pixels[4] = priv->second_color.red; pixels[4] = priv->second_color.green;
pixels[5] = priv->second_color.green; pixels[5] = priv->second_color.blue;
pixels[6] = priv->second_color.blue;
pixels[7] = 0xFF;
} }
priv->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height, priv->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
COGL_PIXEL_FORMAT_RGB_888, COGL_PIXEL_FORMAT_RGB_888,
4, width * 3,
pixels, pixels,
NULL)); NULL));
} }