[mutter/wip/cairo: 13/15] theme: Remove dead code



commit 7a87cc536c69a43e604ea596e30ff2f2ac01ff74
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Mar 1 00:27:10 2012 -0500

    theme: Remove dead code
    
    While the comment claims that we may want to keep this around
    for optimization purposes, the operations are raw bitmap operations
    that would be cleaner done in cairo.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=662962

 src/ui/theme.c |  212 --------------------------------------------------------
 1 files changed, 0 insertions(+), 212 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 7821dac..b7b5c42 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -55,8 +55,6 @@
                                      ((int)((color).green * 255) << 8)  |    \
                                      ((int)((color).blue * 255))))
 
-#define ALPHA_TO_UCHAR(d) ((unsigned char) ((d) * 255))
-
 #define DEBUG_FILL_STRUCT(s) memset ((s), 0xef, sizeof (*(s)))
 #define CLAMP_UCHAR(v) ((guchar) (CLAMP (((int)v), (int)0, (int)255)))
 #define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
@@ -6203,216 +6201,6 @@ hls_to_rgb (gdouble *h,
     }
 }
 
-#if 0
-/* These are some functions I'm saving to use in optimizing
- * MetaDrawOpList, namely to pre-composite pixbufs on client side
- * prior to rendering to the server
- */
-static void
-draw_bg_solid_composite (const MetaTextureSpec *bg,
-                         const MetaTextureSpec *fg,
-                         double                 alpha,
-                         GtkWidget             *widget,
-                         GdkDrawable           *drawable,
-                         const GdkRectangle    *clip,
-                         MetaTextureDrawMode    mode,
-                         double                 xalign,
-                         double                 yalign,
-                         int                    x,
-                         int                    y,
-                         int                    width,
-                         int                    height)
-{
-  GdkRGBA bg_color;
-
-  g_assert (bg->type == META_TEXTURE_SOLID);
-  g_assert (fg->type != META_TEXTURE_COMPOSITE);
-  g_assert (fg->type != META_TEXTURE_SHAPE_LIST);
-
-  meta_color_spec_render (bg->data.solid.color_spec,
-                          widget,
-                          &bg_color);
-
-  switch (fg->type)
-    {
-    case META_TEXTURE_SOLID:
-      {
-        GdkRGBA fg_color;
-
-        meta_color_spec_render (fg->data.solid.color_spec,
-                                widget,
-                                &fg_color);
-
-        color_composite (&bg_color, &fg_color,
-                         alpha, &fg_color);
-
-        draw_color_rectangle (widget, drawable, &fg_color, clip,
-                              x, y, width, height);
-      }
-      break;
-
-    case META_TEXTURE_GRADIENT:
-      /* FIXME I think we could just composite all the colors in
-       * the gradient prior to generating the gradient?
-       */
-      /* FALL THRU */
-    case META_TEXTURE_IMAGE:
-      {
-        GdkPixbuf *pixbuf;
-        GdkPixbuf *composited;
-
-        pixbuf = meta_texture_spec_render (fg, widget, mode, 255,
-                                           width, height);
-
-        if (pixbuf == NULL)
-          return;
-
-        composited = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
-                                     gdk_pixbuf_get_has_alpha (pixbuf), 8,
-                                     gdk_pixbuf_get_width (pixbuf),
-                                     gdk_pixbuf_get_height (pixbuf));
-
-        if (composited == NULL)
-          {
-            g_object_unref (G_OBJECT (pixbuf));
-            return;
-          }
-
-        gdk_pixbuf_composite_color (pixbuf,
-                                    composited,
-                                    0, 0,
-                                    gdk_pixbuf_get_width (pixbuf),
-                                    gdk_pixbuf_get_height (pixbuf),
-                                    0.0, 0.0, /* offsets */
-                                    1.0, 1.0, /* scale */
-                                    GDK_INTERP_BILINEAR,
-                                    255 * alpha,
-                                    0, 0,     /* check offsets */
-                                    0,        /* check size */
-                                    GDK_COLOR_RGB (bg_color),
-                                    GDK_COLOR_RGB (bg_color));
-
-        /* Need to draw background since pixbuf is not
-         * necessarily covering the whole thing
-         */
-        draw_color_rectangle (widget, drawable, &bg_color, clip,
-                              x, y, width, height);
-
-        render_pixbuf_aligned (drawable, clip, composited,
-                               xalign, yalign,
-                               x, y, width, height);
-
-        g_object_unref (G_OBJECT (pixbuf));
-        g_object_unref (G_OBJECT (composited));
-      }
-      break;
-
-    case META_TEXTURE_BLANK:
-    case META_TEXTURE_COMPOSITE:
-    case META_TEXTURE_SHAPE_LIST:
-      g_assert_not_reached ();
-      break;
-    }
-}
-
-static void
-draw_bg_gradient_composite (const MetaTextureSpec *bg,
-                            const MetaTextureSpec *fg,
-                            double                 alpha,
-                            GtkWidget             *widget,
-                            GdkDrawable           *drawable,
-                            const GdkRectangle    *clip,
-                            MetaTextureDrawMode    mode,
-                            double                 xalign,
-                            double                 yalign,
-                            int                    x,
-                            int                    y,
-                            int                    width,
-                            int                    height)
-{
-  g_assert (bg->type == META_TEXTURE_GRADIENT);
-  g_assert (fg->type != META_TEXTURE_COMPOSITE);
-  g_assert (fg->type != META_TEXTURE_SHAPE_LIST);
-
-  switch (fg->type)
-    {
-    case META_TEXTURE_SOLID:
-    case META_TEXTURE_GRADIENT:
-    case META_TEXTURE_IMAGE:
-      {
-        GdkPixbuf *bg_pixbuf;
-        GdkPixbuf *fg_pixbuf;
-        GdkPixbuf *composited;
-        int fg_width, fg_height;
-
-        bg_pixbuf = meta_texture_spec_render (bg, widget, mode, 255,
-                                              width, height);
-
-        if (bg_pixbuf == NULL)
-          return;
-
-        fg_pixbuf = meta_texture_spec_render (fg, widget, mode, 255,
-                                              width, height);
-
-        if (fg_pixbuf == NULL)
-          {
-            g_object_unref (G_OBJECT (bg_pixbuf));
-            return;
-          }
-
-        /* gradients always fill the entire target area */
-        g_assert (gdk_pixbuf_get_width (bg_pixbuf) == width);
-        g_assert (gdk_pixbuf_get_height (bg_pixbuf) == height);
-
-        composited = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
-                                     gdk_pixbuf_get_has_alpha (bg_pixbuf), 8,
-                                     gdk_pixbuf_get_width (bg_pixbuf),
-                                     gdk_pixbuf_get_height (bg_pixbuf));
-
-        if (composited == NULL)
-          {
-            g_object_unref (G_OBJECT (bg_pixbuf));
-            g_object_unref (G_OBJECT (fg_pixbuf));
-            return;
-          }
-
-        fg_width = gdk_pixbuf_get_width (fg_pixbuf);
-        fg_height = gdk_pixbuf_get_height (fg_pixbuf);
-
-        /* If we wanted to be all cool we could deal with the
-         * offsets and try to composite only in the clip rectangle,
-         * but I just don't care enough to figure it out.
-         */
-
-        gdk_pixbuf_composite (fg_pixbuf,
-                              composited,
-                              x + (width - fg_width) * xalign,
-                              y + (height - fg_height) * yalign,
-                              gdk_pixbuf_get_width (fg_pixbuf),
-                              gdk_pixbuf_get_height (fg_pixbuf),
-                              0.0, 0.0, /* offsets */
-                              1.0, 1.0, /* scale */
-                              GDK_INTERP_BILINEAR,
-                              255 * alpha);
-
-        gdk_cairo_set_source_pixbuf (cr, composited, x, y);
-        cairo_paint (cr);
-
-        g_object_unref (G_OBJECT (bg_pixbuf));
-        g_object_unref (G_OBJECT (fg_pixbuf));
-        g_object_unref (G_OBJECT (composited));
-      }
-      break;
-
-    case META_TEXTURE_BLANK:
-    case META_TEXTURE_SHAPE_LIST:
-    case META_TEXTURE_COMPOSITE:
-      g_assert_not_reached ();
-      break;
-    }
-}
-#endif
-
 /**
  * meta_theme_earliest_version_with_button:
  * @type: the button type



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