[vte] widget: Remove pixmap background saturation setting



commit a14008988f755d7d5241bc9086173ebdcdad0b8f
Author: Christian Persch <chpe gnome org>
Date:   Thu Mar 27 15:45:11 2014 +0100

    widget: Remove pixmap background saturation setting

 doc/reference/vte-sections.txt |    1 -
 src/vte-private.h              |    1 -
 src/vte.c                      |  106 ++++++----------------------------------
 src/vteapp.c                   |    2 +-
 src/vtebg.c                    |   25 ++-------
 src/vtebg.h                    |    1 -
 src/vtedeprecated.h            |    2 -
 src/vtedraw.c                  |    5 +-
 src/vtedraw.h                  |    3 +-
 9 files changed, 25 insertions(+), 121 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 38c281a..e58bcf4 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -120,7 +120,6 @@ vte_terminal_get_current_file_uri
 vte_terminal_im_append_menuitems
 vte_terminal_set_background_image
 vte_terminal_set_background_image_file
-vte_terminal_set_background_saturation
 vte_terminal_set_scroll_background
 
 <SUBSECTION Private>
diff --git a/src/vte-private.h b/src/vte-private.h
index 485230e..d1b1a92 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -404,7 +404,6 @@ struct _VteTerminalPrivate {
        GdkPixbuf *bg_pixbuf;
        char *bg_file;
         GdkRGBA bg_tint_color;
-       double bg_saturation; /* 0.0 .. 1.0 */
 
        /* Key modifiers. */
        GdkModifierType modifiers;
diff --git a/src/vte.c b/src/vte.c
index dc1425c..37480a6 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -154,7 +154,6 @@ enum {
         PROP_AUDIBLE_BELL,
         PROP_BACKGROUND_IMAGE_FILE,
         PROP_BACKGROUND_IMAGE_PIXBUF,
-        PROP_BACKGROUND_SATURATION,
         PROP_BACKGROUND_TINT_COLOR,
         PROP_BACKSPACE_BINDING,
         PROP_CURSOR_BLINK_MODE,
@@ -8047,11 +8046,10 @@ vte_terminal_init(VteTerminal *terminal)
        gtk_widget_ensure_style(&terminal->widget);
 
        /* Set up background information. */
-       pvt->bg_tint_color.red = 0.;
-       pvt->bg_tint_color.green = 0.;
-       pvt->bg_tint_color.blue = 0.;
+       pvt->bg_tint_color.red = 1.;
+       pvt->bg_tint_color.green = 1.;
+       pvt->bg_tint_color.blue = 1.;
         pvt->bg_tint_color.alpha = 1.;
-       pvt->bg_saturation = 0.4;
        pvt->selection_block_mode = FALSE;
        pvt->has_fonts = FALSE;
 
@@ -10630,9 +10628,6 @@ vte_terminal_get_property (GObject *object,
                 case PROP_BACKGROUND_IMAGE_PIXBUF:
                         g_value_set_object (value, pvt->bg_pixbuf);
                         break;
-                case PROP_BACKGROUND_SATURATION:
-                        g_value_set_double (value, pvt->bg_saturation);
-                        break;
                 case PROP_BACKGROUND_TINT_COLOR:
                         g_value_set_boxed (value, &pvt->bg_tint_color);
                         break;
@@ -10744,11 +10739,6 @@ vte_terminal_set_property (GObject *object,
                         vte_terminal_set_background_image (terminal, g_value_get_object (value));
                         G_GNUC_END_IGNORE_DEPRECATIONS;
                         break;
-                case PROP_BACKGROUND_SATURATION:
-                        G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-                        vte_terminal_set_background_saturation (terminal, g_value_get_double (value));
-                        G_GNUC_END_IGNORE_DEPRECATIONS;
-                        break;
                 case PROP_BACKGROUND_TINT_COLOR:
                         vte_terminal_set_background_tint_color_rgba (terminal, g_value_get_boxed (value));
                         break;
@@ -11481,7 +11471,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
          * VteTerminal:background-image-file: (type filename):
          *
          * Sets a background image file for the widget.  If specified by
-         * #VteTerminal:background-saturation:, the terminal will tint its
+         * #VteTerminal:background-tint-color:, the terminal will tint its
          * in-memory copy of the image before applying it to the terminal.
          * 
          * Since: 0.20
@@ -11502,7 +11492,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
          * drawn using the default background color will instead be drawn over the
          * specified image.  If necessary, the image will be tiled to cover the
          * widget's entire visible area. If specified by
-         * #VteTerminal:background-saturation:, the terminal will tint its
+         * #VteTerminal:background-tint-color:, the terminal will tint its
          * in-memory copy of the image before applying it to the terminal.
          * 
          * Since: 0.20
@@ -11517,38 +11507,16 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                       G_PARAM_READWRITE | STATIC_PARAMS));
 
         /**
-         * VteTerminal:background-saturation:
-         *
-         * If a background image has been set using #VteTerminal:background-image-file: or
-         * #VteTerminal:background-image-pixbuf:,
-         * and the saturation value is less
-         * than 1.0, the terminal will adjust the colors of the image before drawing
-         * the image.  To do so, the terminal will create a copy of the background
-         * image and modify its pixel values.
-         *
-         * Since: 0.20
-         *
-         * Deprecated: 0.34.8
-         */
-        g_object_class_install_property
-                (gobject_class,
-                 PROP_BACKGROUND_SATURATION,
-                 g_param_spec_double ("background-saturation", NULL, NULL,
-                                      0.0, 1.0,
-                                      0.4,
-                                      G_PARAM_READWRITE | STATIC_PARAMS));
-     
-        /**
          * VteTerminal:background-tint-color:
          *
          * If a background image has been set using #VteTerminal:background-image-file: or
          * #VteTerminal:background-image-pixbuf:, and
-         * and the value set by VteTerminal:background-saturation: is less than 1.0,
+         * and the value set by VteTerminal:background-tint-color: is less than 1.0,
          * the terminal
          * will adjust the color of the image before drawing the image.  To do so,
          * the terminal will create a copy of the background image
          * and modify its pixel values.  The initial tint color
-         * is black.
+         * is white.
          * 
          * Since: 0.20
          *
@@ -12291,7 +12259,6 @@ vte_terminal_im_append_menuitems(VteTerminal *terminal, GtkMenuShell *menushell)
 static gboolean
 vte_terminal_background_update(VteTerminal *terminal)
 {
-        double saturation;
        const PangoColor *entry;
        GdkRGBA color;
 
@@ -12320,29 +12287,25 @@ vte_terminal_background_update(VteTerminal *terminal)
 
         _vte_draw_set_background_solid (terminal->pvt->draw, &color);
 
-       saturation = terminal->pvt->bg_saturation;
        if (terminal->pvt->bg_file) {
                _vte_draw_set_background_image(terminal->pvt->draw,
                                               VTE_BG_SOURCE_FILE,
                                               NULL,
                                               terminal->pvt->bg_file,
-                                              &terminal->pvt->bg_tint_color,
-                                              saturation);
+                                              &terminal->pvt->bg_tint_color);
        } else
        if (GDK_IS_PIXBUF(terminal->pvt->bg_pixbuf)) {
                _vte_draw_set_background_image(terminal->pvt->draw,
                                               VTE_BG_SOURCE_PIXBUF,
                                               terminal->pvt->bg_pixbuf,
                                               NULL,
-                                              &terminal->pvt->bg_tint_color,
-                                              saturation);
+                                              &terminal->pvt->bg_tint_color);
        } else {
                _vte_draw_set_background_image(terminal->pvt->draw,
                                               VTE_BG_SOURCE_NONE,
                                               NULL,
                                               NULL,
-                                              &terminal->pvt->bg_tint_color,
-                                              saturation);
+                                              &terminal->pvt->bg_tint_color);
        }
 
        /* Note that the update has finished. */
@@ -12369,58 +12332,19 @@ vte_terminal_queue_background_update(VteTerminal *terminal)
 }
 
 /**
- * vte_terminal_set_background_saturation:
- * @terminal: a #VteTerminal
- * @saturation: a floating point value between 0.0 and 1.0.
- *
- * If a background image has been set using
- * vte_terminal_set_background_image(),
- * vte_terminal_set_background_image_file(), or
- * and the saturation value is less
- * than 1.0, the terminal will adjust the colors of the image before drawing
- * the image.  To do so, the terminal will create a copy of the background
- * image and modify its pixel values.
- *
- * Deprecated: 0.34.8
- */
-void
-vte_terminal_set_background_saturation(VteTerminal *terminal, double saturation)
-{
-        VteTerminalPrivate *pvt;
-
-       g_return_if_fail(VTE_IS_TERMINAL(terminal));
-        g_return_if_fail(saturation >= 0.0 && saturation <= 1.0);
-
-        pvt = terminal->pvt;
-
-        if (saturation == pvt->bg_saturation)
-                return;
-
-       _vte_debug_print(VTE_DEBUG_MISC,
-                       "Setting background saturation to %.3f\n",
-                       saturation);
-
-        pvt->bg_saturation = saturation;
-        g_object_notify(G_OBJECT (terminal), "background-saturation");
-
-        vte_terminal_queue_background_update(terminal);
-}
-
-/**
  * vte_terminal_set_background_tint_color_rgba:
  * @terminal: a #VteTerminal
- * @rgba: (allow-none): a color which the terminal background should be tinted to if its
- *   saturation is not 1.0.
+ * @rgba: (allow-none): a color which the terminal background should be tinted to if
  *
  * If a background image has been set using
  * vte_terminal_set_background_image(),
  * vte_terminal_set_background_image_file(), or
  * and the value set by
- * vte_terminal_set_background_saturation() is less than one, the terminal
+ * alpha value in @rgba is greater than 0.0, the terminal
  * will adjust the color of the image before drawing the image.  To do so,
  * the terminal will create a copy of the background image
  * and modify its pixel values.  The initial tint color
- * is black.
+ * is white.
  *
  * Since: 0.38
  */
@@ -12457,7 +12381,7 @@ vte_terminal_set_background_tint_color_rgba(VteTerminal *terminal,
  * drawn using the default background color will instead be drawn over the
  * specified image.  If necessary, the image will be tiled to cover the
  * widget's entire visible area. If specified by
- * vte_terminal_set_background_saturation(), the terminal will tint its
+ * vte_terminal_set_background_tint_color_rgba(), the terminal will tint its
  * in-memory copy of the image before applying it to the terminal.
  *
  * Deprecated: 0.34.8
@@ -12518,7 +12442,7 @@ vte_terminal_set_background_image(VteTerminal *terminal, GdkPixbuf *image)
  * @path: (type filename): path to an image file
  *
  * Sets a background image for the widget.  If specified by
- * vte_terminal_set_background_saturation(), the terminal will tint its
+ * vte_terminal_set_background_tint_color_rgba(), the terminal will tint its
  * in-memory copy of the image before applying it to the terminal.
  *
  * Deprecated: 0.34.8
diff --git a/src/vteapp.c b/src/vteapp.c
index 0695fb1..109edb6 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -776,7 +776,7 @@ main(int argc, char **argv)
 
        highlight.red = highlight.green = highlight.blue = 0.75; highlight.alpha = 1.0;
        cursor.red = 1.0; cursor.green = cursor.blue = 0.5; cursor.alpha = 1.0;
-       tint.red = tint.green = tint.blue = 0.; tint.alpha = .875;
+       tint.red = tint.green = tint.blue = 1.; tint.alpha = .875;
 
        gdk_window_set_debug_updates(debug);
 
diff --git a/src/vtebg.c b/src/vtebg.c
index 240895a..5229374 100644
--- a/src/vtebg.c
+++ b/src/vtebg.c
@@ -38,7 +38,6 @@ typedef struct {
        char *source_file;
 
        GdkRGBA tint_color;
-       double saturation;
        cairo_surface_t *surface;
 } VteBgCacheItem;
 
@@ -178,7 +177,6 @@ vte_bg_cache_add(VteBg *bg, VteBgCacheItem *item)
  * @source_pixbuf: a #GdkPixbuf, or %NULL
  * @source_file: path of an image file, or %NULL
  * @tint: a #GdkRGBA to use as tint color
- * @saturation: the saturation as a value between 0.0 and 1.0
  *
  * Returns: a reference to a #cairo_surface_t, or %NULL on if
  *   there is no matching item in the cache
@@ -188,8 +186,7 @@ vte_bg_cache_search(VteBg *bg,
                    VteBgSourceType source_type,
                    const GdkPixbuf *source_pixbuf,
                    const char *source_file,
-                   const GdkRGBA *tint,
-                   double saturation)
+                   const GdkRGBA *tint)
 {
        GList *i;
 
@@ -197,7 +194,6 @@ vte_bg_cache_search(VteBg *bg,
        for (i = bg->pvt->cache; i != NULL; i = g_list_next(i)) {
                VteBgCacheItem *item = i->data;
                if (gdk_rgba_equal (&item->tint_color, tint) &&
-                   (saturation == item->saturation) &&
                    (source_type == item->source_type)) {
                        switch (source_type) {
                        case VTE_BG_SOURCE_PIXBUF:
@@ -228,7 +224,6 @@ vte_bg_cache_search(VteBg *bg,
  * @source_pixbuf: (allow-none): a #GdkPixbuf, or %NULL
  * @source_file: (allow-none): path of an image file, or %NULL
  * @tint: a #PangoColor to use as tint color
- * @saturation: the saturation as a value between 0.0 and 1.0
  * @other: a #cairo_surface_t
  *
  * Returns: a reference to a #cairo_surface_t, or %NULL on failure
@@ -239,7 +234,6 @@ vte_bg_get_surface(VteBg *bg,
                   GdkPixbuf *source_pixbuf,
                   const char *source_file,
                   const GdkRGBA *tint,
-                  double saturation,
                   cairo_surface_t *other)
 {
         VteBgPrivate *pvt;
@@ -248,7 +242,6 @@ vte_bg_get_surface(VteBg *bg,
        cairo_surface_t *cached;
        cairo_t *cr;
        int width, height;
-        double alpha;
 
         g_return_val_if_fail(VTE_IS_BG(bg), NULL);
         pvt = bg->pvt;
@@ -259,16 +252,16 @@ vte_bg_get_surface(VteBg *bg,
 
        cached = vte_bg_cache_search(bg, source_type,
                                     source_pixbuf, source_file,
-                                    tint, saturation);
+                                    tint);
        if (cached != NULL) {
                return cached;
        }
 
         /* FIXME: The above only returned a hit when the source *and*
-         * tint and saturation matched. This means that for VTE_BG_SOURCE_FILE,
+         * tint matched. This means that for VTE_BG_SOURCE_FILE,
          * we will create below *another* #GdkPixbuf for the same source file,
          * wasting memory. We should instead look up the source pixbuf regardless
-         * of tint and saturation, and just create a new #VteBgCacheItem
+         * of tint, and just create a new #VteBgCacheItem
          * with a new surface for it.
          */
 
@@ -277,7 +270,6 @@ vte_bg_get_surface(VteBg *bg,
        item->source_pixbuf = NULL;
        item->source_file = NULL;
        item->tint_color = *tint;
-       item->saturation = saturation;
         item->surface = NULL;
        pixbuf = NULL;
 
@@ -314,13 +306,8 @@ vte_bg_get_surface(VteBg *bg,
                gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
        cairo_paint (cr);
 
-        alpha = (1. - saturation) * tint->alpha;
-       if (alpha > 0.) {
-               cairo_set_source_rgba (cr, 
-                                      tint->red,
-                                      tint->green,
-                                      tint->blue,
-                                      alpha);
+       if (tint->alpha < 1.) {
+                gdk_cairo_set_source_rgba (cr, tint);
                cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
                cairo_paint (cr);
        }
diff --git a/src/vtebg.h b/src/vtebg.h
index 8e2a705..69b09c5 100644
--- a/src/vtebg.h
+++ b/src/vtebg.h
@@ -61,7 +61,6 @@ vte_bg_get_surface(VteBg *bg,
                   GdkPixbuf *source_pixbuf,
                   const char *source_file,
                   const GdkRGBA *tint,
-                  double saturation,
                   cairo_surface_t *other);
 
 G_END_DECLS
diff --git a/src/vtedeprecated.h b/src/vtedeprecated.h
index 9de0a40..a0584ec 100644
--- a/src/vtedeprecated.h
+++ b/src/vtedeprecated.h
@@ -37,8 +37,6 @@ void vte_terminal_set_scroll_background(VteTerminal *terminal, gboolean scroll)
 void vte_terminal_set_background_image(VteTerminal *terminal, GdkPixbuf *image) G_GNUC_DEPRECATED;
 void vte_terminal_set_background_image_file(VteTerminal *terminal,
                                            const char *path) G_GNUC_DEPRECATED;
-void vte_terminal_set_background_saturation(VteTerminal *terminal,
-                                           double saturation) G_GNUC_DEPRECATED;
 void vte_terminal_set_opacity(VteTerminal *terminal, guint16 opacity) G_GNUC_DEPRECATED;
 
 G_END_DECLS
diff --git a/src/vtedraw.c b/src/vtedraw.c
index 87050fa..bbf971c 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -841,8 +841,7 @@ _vte_draw_set_background_image (struct _vte_draw *draw,
                                VteBgSourceType type,
                                GdkPixbuf *pixbuf,
                                const char *filename,
-                               const GdkRGBA *color,
-                               double saturation)
+                               const GdkRGBA *color)
 {
        cairo_surface_t *surface;
 
@@ -851,7 +850,7 @@ _vte_draw_set_background_image (struct _vte_draw *draw,
 
        surface = vte_bg_get_surface (vte_bg_get_for_screen (gtk_widget_get_screen (draw->widget)),
                                     type, pixbuf, filename,
-                                    color, saturation,
+                                    color,
                                     cairo_get_target(draw->cr));
 
        _vte_draw_end (draw);
diff --git a/src/vtedraw.h b/src/vtedraw.h
index 2b20705..fc442e9 100644
--- a/src/vtedraw.h
+++ b/src/vtedraw.h
@@ -83,8 +83,7 @@ void _vte_draw_set_background_image(struct _vte_draw *draw,
                                    VteBgSourceType type,
                                    GdkPixbuf *pixbuf,
                                    const char *file,
-                                   const GdkRGBA *color,
-                                   double saturation);
+                                   const GdkRGBA *color);
 void _vte_draw_set_background_scroll(struct _vte_draw *draw,
                                     gint x, gint y);
 


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