[gnome-system-monitor] Fixed indentation and warning



commit 9d8ab1a92a91d1d11dd5663243eecf761e9ce237
Author: Robert Roth <robert roth off gmail com>
Date:   Tue Oct 27 10:43:51 2020 +0200

    Fixed indentation and warning

 src/util.cpp | 61 ++++++++++++++++++++++++++++++------------------------------
 src/util.h   |  4 +++-
 2 files changed, 33 insertions(+), 32 deletions(-)
---
diff --git a/src/util.cpp b/src/util.cpp
index 54704ac5..f0c89cff 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -319,41 +319,40 @@ procman_debug_real(const char *file, int line, const char *func,
 }
 
 
-    // h is in [0.0; 1.0] (and not [0°; 360°] )
-    // s is in [0.0; 1.0]
-    // v is in [0.0; 1.0]
-    // https://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV
-    std::tuple<double, double, double> hsv_to_rgb(double h, double s, double v)
-    {
-        const double c = v * s;
-        const double hp = h * 6; // 360° / 60°
-        const double x = c * (1 - std::abs(std::fmod(hp, 2.0) - 1));
-
-        double r1 = 0 , g1 = 0, b1 = 0;
-
-        switch (int(hp)) {
-        case 0: r1 = c; g1 = x; b1 = 0; break;
-        case 1: r1 = x; g1 = c; b1 = 0; break;
-        case 2: r1 = 0; g1 = c; b1 = x; break;
-        case 3: r1 = 0; g1 = x; b1 = c; break;
-        case 4: r1 = x; g1 = 0; b1 = c; break;
-        case 5: r1 = c; g1 = 0; b1 = x; break;
-        }
-
-        const double m = v - c;
-
-        return {r1 + m, g1 + m, b1 + m};
+// h is in [0.0; 1.0] (and not [0°; 360°] )
+// s is in [0.0; 1.0]
+// v is in [0.0; 1.0]
+// https://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV
+std::tuple<double, double, double> hsv_to_rgb(double h, double s, double v)
+{
+    const double c = v * s;
+    const double hp = h * 6; // 360° / 60°
+    const double x = c * (1 - std::abs(std::fmod(hp, 2.0) - 1));
+
+    double r1 = 0 , g1 = 0, b1 = 0;
+
+    switch (int(hp)) {
+    case 0: r1 = c; g1 = x; b1 = 0; break;
+    case 1: r1 = x; g1 = c; b1 = 0; break;
+    case 2: r1 = 0; g1 = c; b1 = x; break;
+    case 3: r1 = 0; g1 = x; b1 = c; break;
+    case 4: r1 = x; g1 = 0; b1 = c; break;
+    case 5: r1 = c; g1 = 0; b1 = x; break;
     }
 
+    const double m = v - c;
+
+    return {r1 + m, g1 + m, b1 + m};
+}
 
-    std::string rgb_to_color_string(const std::tuple<double, double, double> &t)
-    {
-        char b[14];
-        auto c = [](double d) { return (unsigned short)(0xffff * d); };
-        std::snprintf(b, sizeof b, "#%04x%04x%04x", c(std::get<0>(t)), c(std::get<1>(t)), c(std::get<2>(t)));
-        return {b, 13};
-    }
 
+std::string rgb_to_color_string(const std::tuple<double, double, double> &t)
+{
+    char b[14];
+    auto c = [](double d) { return (unsigned short)(0xffff * d); };
+    std::snprintf(b, sizeof b, "#%04x%04x%04x", c(std::get<0>(t)), c(std::get<1>(t)), c(std::get<2>(t)));
+    return {b, 13};
+}
 
 
 namespace procman
diff --git a/src/util.h b/src/util.h
index e596cf88..3db739eb 100644
--- a/src/util.h
+++ b/src/util.h
@@ -22,12 +22,14 @@ format_process_state(guint state);
 void
 procman_debug_real(const char *file, int line, const char *func,
                    const char *format, ...) G_GNUC_PRINTF(4, 5);
-
+                   
 #define procman_debug(FMT, ...) procman_debug_real(__FILE__, __LINE__, __func__, FMT, ##__VA_ARGS__)
 
 Glib::ustring get_monospace_system_font_name (void);
 GtkLabel *make_tnum_label (void);
 PangoAttrList *make_tnum_attr_list (void);
+std::tuple<double, double, double> hsv_to_rgb(double h, double s, double v);
+std::string rgb_to_color_string(const std::tuple<double, double, double> &t);
 
 inline string make_string(char *c_str)
 {


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