[vte] widget: No longer generate bold color automatically



commit e9989360bb3b020c4507562af9385ca7584f0d97
Author: Egmont Koblinger <egmont gmail com>
Date:   Mon Feb 12 20:52:33 2018 +0100

    widget: No longer generate bold color automatically
    
    Use the one explicitly provided via API, or the foreground color.
    This also fixes how OSC 10 affects bold color.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728600
    https://bugzilla.gnome.org/show_bug.cgi?id=793152

 src/vte.cc      |   13 ++++---------
 src/vtetypes.cc |   35 -----------------------------------
 src/vtetypes.hh |    3 ---
 3 files changed, 4 insertions(+), 47 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 02c670a..cef4c24 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2511,10 +2511,8 @@ VteTerminalPrivate::set_colors(vte::color::rgb const* foreground,
                                }
                                break;
                        case VTE_BOLD_FG:
-                                color = vte::color::rgb(get_color(VTE_DEFAULT_FG),
-                                                        get_color(VTE_DEFAULT_BG),
-                                                        1.8);
-                               break;
+                                unset = true;
+                                break;
                        case VTE_HIGHLIGHT_BG:
                                unset = true;
                                break;
@@ -2563,10 +2561,7 @@ VteTerminalPrivate::reset_color_bold()
 {
         _vte_debug_print(VTE_DEBUG_MISC,
                          "Reset %s color.\n", "bold");
-        set_color(VTE_BOLD_FG, VTE_COLOR_SOURCE_API,
-                  vte::color::rgb(get_color(VTE_DEFAULT_FG),
-                                  get_color(VTE_DEFAULT_BG),
-                                  1.8));
+        reset_color(VTE_BOLD_FG, VTE_COLOR_SOURCE_API);
 }
 
 /*
@@ -8871,7 +8866,7 @@ VteTerminalPrivate::determine_colors(VteCellAttr const* attr,
 
        /* Handle bold by using set bold color or brightening */
         if (attr->bold()) {
-                if (fore == VTE_DEFAULT_FG) {
+                if (fore == VTE_DEFAULT_FG && get_color(VTE_BOLD_FG) != NULL) {
                        fore = VTE_BOLD_FG;
                 } else if (m_bold_is_bright &&
                            fore >= VTE_LEGACY_COLORS_OFFSET &&
diff --git a/src/vtetypes.cc b/src/vtetypes.cc
index 119c3b5..92a9db2 100644
--- a/src/vtetypes.cc
+++ b/src/vtetypes.cc
@@ -37,41 +37,6 @@ static_assert(sizeof(vte::color::rgb) == sizeof(PangoColor), "vte::color::rgb si
 
 static_assert(sizeof(vte::util::smart_fd) == sizeof(int), "vte::util::smart_fd size wrong");
 
-/* Colours mix */
-vte::color::rgb::rgb(vte::color::rgb const& foreground,
-                     vte::color::rgb const& background,
-                     double factor)
-{
-        double fy, fcb, fcr, by, bcb, bcr, r, g, b;
-       fy =   0.2990 * foreground.red +
-               0.5870 * foreground.green +
-               0.1140 * foreground.blue;
-        fcb = -0.1687 * foreground.red +
-              -0.3313 * foreground.green +
-               0.5000 * foreground.blue;
-        fcr =  0.5000 * foreground.red +
-              -0.4187 * foreground.green +
-              -0.0813 * foreground.blue;
-        by =   0.2990 * background.red +
-               0.5870 * background.green +
-               0.1140 * background.blue;
-        bcb = -0.1687 * background.red +
-              -0.3313 * background.green +
-               0.5000 * background.blue;
-        bcr =  0.5000 * background.red +
-              -0.4187 * background.green +
-              -0.0813 * background.blue;
-        fy = (factor * fy) + ((1.0 - factor) * by);
-        fcb = (factor * fcb) + ((1.0 - factor) * bcb);
-        fcr = (factor * fcr) + ((1.0 - factor) * bcr);
-        r = fy + 1.402 * fcr;
-        g = fy + 0.34414 * fcb - 0.71414 * fcr;
-        b = fy + 1.722 * fcb;
-        red = CLAMP(r, 0, 0xffff);
-        green = CLAMP(g, 0, 0xffff);
-        blue = CLAMP(b, 0, 0xffff);
-}
-
 vte::color::rgb::rgb(GdkRGBA const* rgba) {
         g_assert(rgba);
         /* FIXME: equal distribution! */
diff --git a/src/vtetypes.hh b/src/vtetypes.hh
index fe8faf7..9551208 100644
--- a/src/vtetypes.hh
+++ b/src/vtetypes.hh
@@ -154,9 +154,6 @@ namespace color {
                 rgb(GdkRGBA const* c);
                 rgb(GdkRGBA const& c) : rgb(&c) { }
 
-                rgb(rgb const& a, rgb const& b, double f);
-                rgb(rgb const* a, rgb const* b, double f) : rgb(*a, *b, f) { }
-
                 bool parse(char const* spec);
 
                 void from_pango(PangoColor const& c) { *static_cast<PangoColor*>(this) = c; }


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