[Xfce4-commits] [apps/xfce4-terminal] 01/01: Fix colors conversion when Vary background color setting is in effect

noreply at xfce.org noreply at xfce.org
Wed Jul 13 15:47:53 CEST 2016


This is an automated email from the git hooks/post-receive script.

f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.

commit bd218f2cbd99e77cc8326fc2ba2c07216e518052
Author: Igor <f2404 at yandex.ru>
Date:   Wed Jul 13 16:47:46 2016 +0300

    Fix colors conversion when Vary background color setting is in effect
---
 terminal/terminal-screen.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 6ab0042..d5d5825 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -54,10 +54,6 @@
 #endif
 #include <glib/gstdio.h>
 
-/* gdkcolor to [0-1] range conversion */
-#define SCALE(i)   (i / 65535.)
-#define UNSCALE(d) ((guint16)(d * 65535 + 0.5))
-
 /* offset of saturation random value */
 #define SATURATION_WINDOW 0.20
 
@@ -78,14 +74,6 @@ enum
 
 enum
 {
-  RGB_RED,
-  RGB_GREEN,
-  RGB_BLUE,
-  N_RGB
-};
-
-enum
-{
   HSV_HUE,
   HSV_SATURATION,
   HSV_VALUE,
@@ -866,7 +854,6 @@ terminal_screen_update_colors (TerminalScreen *screen)
   gchar    **colors;
   gboolean   vary_bg;
   gdouble    hsv[N_HSV];
-  gdouble    rgb[N_RGB];
   gdouble    sat_min, sat_max;
 
   g_object_get (screen->preferences,
@@ -899,7 +886,7 @@ terminal_screen_update_colors (TerminalScreen *screen)
   /* we pick a random hue value to keep readability */
   if (vary_bg && has_bg)
     {
-      gtk_rgb_to_hsv (SCALE (bg.red), SCALE (bg.green), SCALE (bg.blue),
+      gtk_rgb_to_hsv (bg.red, bg.green, bg.blue,
                       NULL, &hsv[HSV_SATURATION], &hsv[HSV_VALUE]);
 
       /* pick random hue */
@@ -926,12 +913,7 @@ terminal_screen_update_colors (TerminalScreen *screen)
 
       /* and back to a rgb color */
       gtk_hsv_to_rgb (hsv[HSV_HUE], hsv[HSV_SATURATION], hsv[HSV_VALUE],
-                      &rgb[RGB_RED], &rgb[RGB_GREEN], &rgb[RGB_BLUE]);
-
-      /* set new gdk color */
-      bg.red = UNSCALE (rgb[RGB_RED]);
-      bg.green = UNSCALE (rgb[RGB_GREEN]);
-      bg.blue = UNSCALE (rgb[RGB_BLUE]);
+                      &bg.red, &bg.green, &bg.blue);
     }
 
   if (G_LIKELY (valid_palette))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list