[mutter] background: Merge the code for creating the color texture into here



commit 584460deec943e4c4d11e35bc7c896d949c4f33a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Aug 7 13:41:40 2014 -0400

    background: Merge the code for creating the color texture into here
    
    It's unused anywhere else.

 src/compositor/cogl-utils.c      |   42 --------------------------------------
 src/compositor/cogl-utils.h      |    5 ----
 src/compositor/meta-background.c |   17 ++++++++++----
 3 files changed, 12 insertions(+), 52 deletions(-)
---
diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c
index 962fe88..68c2127 100644
--- a/src/compositor/cogl-utils.c
+++ b/src/compositor/cogl-utils.c
@@ -22,48 +22,6 @@
 #include <clutter/clutter.h>
 #include "cogl-utils.h"
 
-/**
- * meta_create_color_texture_4ub:
- * @red: red component
- * @green: green component
- * @blue: blue component
- * @alpha: alpha component
- * @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.
- *
- * Return value: (transfer full): a newly created Cogl texture
- */
-CoglTexture *
-meta_create_color_texture_4ub (guint8           red,
-                               guint8           green,
-                               guint8           blue,
-                               guint8           alpha,
-                               CoglTextureFlags flags)
-{
-  CoglColor color;
-  guint8 pixel[4];
-
-  cogl_color_init_from_4ub (&color, red, green, blue, alpha);
-  cogl_color_premultiply (&color);
-
-  pixel[0] = cogl_color_get_red_byte (&color);
-  pixel[1] = cogl_color_get_green_byte (&color);
-  pixel[2] = cogl_color_get_blue_byte (&color);
-  pixel[3] = cogl_color_get_alpha_byte (&color);
-
-  return cogl_texture_new_from_data (1, 1,
-                                     flags,
-                                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
-                                     COGL_PIXEL_FORMAT_ANY,
-                                     4, pixel);
-}
-
-
 /* Based on gnome-shell/src/st/st-private.c:_st_create_texture_material.c */
 
 /**
diff --git a/src/compositor/cogl-utils.h b/src/compositor/cogl-utils.h
index 8184818..281f9b4 100644
--- a/src/compositor/cogl-utils.h
+++ b/src/compositor/cogl-utils.h
@@ -23,11 +23,6 @@
 
 #include <cogl/cogl.h>
 
-CoglTexture * meta_create_color_texture_4ub (guint8           red,
-                                             guint8           green,
-                                             guint8           blue,
-                                             guint8           alpha,
-                                             CoglTextureFlags flags);
 CoglPipeline * meta_create_texture_pipeline (CoglTexture *texture);
 
 #endif /* __META_COGL_UTILS_H__ */
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index 0cd2eae..a103262 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -847,6 +847,7 @@ meta_background_load_color (MetaBackground *self,
   CoglTexture  *texture;
   ClutterActor *stage = meta_get_stage_for_screen (priv->screen);
   ClutterColor  stage_color;
+  uint8_t pixels[4];
 
   ensure_pipeline (self);
 
@@ -859,11 +860,17 @@ meta_background_load_color (MetaBackground *self,
       color = &stage_color;
     }
 
-  texture = meta_create_color_texture_4ub (color->red,
-                                           color->green,
-                                           color->blue,
-                                           0xff,
-                                           COGL_TEXTURE_NO_SLICING);
+  pixels[0] = color->red;
+  pixels[1] = color->green;
+  pixels[2] = color->blue;
+  pixels[3] = 0xFF;
+
+  texture = cogl_texture_new_from_data (1, 1,
+                                        COGL_TEXTURE_NO_SLICING,
+                                        COGL_PIXEL_FORMAT_RGB_888,
+                                        COGL_PIXEL_FORMAT_ANY,
+                                        4,
+                                        pixels);
   set_texture (self, COGL_TEXTURE (texture));
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]