diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-12-31 18:04:37 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-01-01 02:05:07 +0000 |
commit | 93f9416c3660b87896e8b59a4d952fb851002bb5 (patch) | |
tree | 26109e8503ac6ea7457a5b53f4f8aa398029a593 | |
parent | f7b3bda9b3957d8b479d0d7d5694ea6364ecb1a8 (diff) |
Get rid of the "pixel" member of a color_t.
Now that we're letting GTK+/GDK allocate colors behind the scenes, if it
allocates them at all, there's no reason to save the allocated color in
the toolkit-independent color value.
Change-Id: I99df32bd6b07924f41f3d855d2ddecb3dc8d5201
Reviewed-on: https://code.wireshark.org/review/12983
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/color_filters.h | 7 | ||||
-rw-r--r-- | epan/prefs.c | 22 | ||||
-rw-r--r-- | ui/gtk/color_utils.c | 4 | ||||
-rw-r--r-- | ui/gtk/prefs_font_color.c | 2 | ||||
-rw-r--r-- | ui/qt/color_utils.cpp | 1 | ||||
-rw-r--r-- | ui/qt/coloring_rules_dialog.cpp | 1 |
6 files changed, 7 insertions, 30 deletions
diff --git a/epan/color_filters.h b/epan/color_filters.h index 2fe8b018cb..a240a67862 100644 --- a/epan/color_filters.h +++ b/epan/color_filters.h @@ -32,15 +32,8 @@ struct epan_dissect; /* * Data structure holding RGB value for a color. - * - * XXX - yes, I know, there's a "pixel" value in there as well; for - * now, it's intended to look just like a GdkColor but not to require - * that any GTK+ header files be included in order to use it. - * The way we handle colors needs to be cleaned up somewhat, in order - * to keep toolkit-specific stuff separate from toolkit-independent stuff. */ typedef struct { - guint32 pixel; guint16 red; guint16 green; guint16 blue; diff --git a/epan/prefs.c b/epan/prefs.c index a15232e782..0d8b53fc61 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2980,19 +2980,15 @@ pre_init_prefs(void) /* We try to find the best font in the Qt code */ if (prefs.gui_qt_font_name) g_free(prefs.gui_qt_font_name); prefs.gui_qt_font_name = g_strdup(""); - prefs.gui_marked_fg.pixel = 65535; prefs.gui_marked_fg.red = 65535; prefs.gui_marked_fg.green = 65535; prefs.gui_marked_fg.blue = 65535; - prefs.gui_marked_bg.pixel = 0; prefs.gui_marked_bg.red = 0; prefs.gui_marked_bg.green = 8224; prefs.gui_marked_bg.blue = 10794; - prefs.gui_ignored_fg.pixel = 32767; prefs.gui_ignored_fg.red = 32767; prefs.gui_ignored_fg.green = 32767; prefs.gui_ignored_fg.blue = 32767; - prefs.gui_ignored_bg.pixel = 65535; prefs.gui_ignored_bg.red = 65535; prefs.gui_ignored_bg.green = 65535; prefs.gui_ignored_bg.blue = 65535; @@ -3000,32 +2996,25 @@ pre_init_prefs(void) prefs.gui_colorized_fg = g_strdup("000000,000000,000000,000000,000000,000000,000000,000000,000000,000000"); if (prefs.gui_colorized_bg) g_free(prefs.gui_colorized_bg); prefs.gui_colorized_bg = g_strdup("ffc0c0,ffc0ff,e0c0e0,c0c0ff,c0e0e0,c0ffff,c0ffc0,ffffc0,e0e0c0,e0e0e0"); - prefs.st_client_fg.pixel = 0; prefs.st_client_fg.red = 32767; prefs.st_client_fg.green = 0; prefs.st_client_fg.blue = 0; - prefs.st_client_bg.pixel = 0; prefs.st_client_bg.red = 64507; prefs.st_client_bg.green = 60909; prefs.st_client_bg.blue = 60909; - prefs.st_server_fg.pixel = 0; prefs.st_server_fg.red = 0; prefs.st_server_fg.green = 0; prefs.st_server_fg.blue = 32767; - prefs.st_server_bg.pixel = 0; prefs.st_server_bg.red = 60909; prefs.st_server_bg.green = 60909; prefs.st_server_bg.blue = 64507; - prefs.gui_text_valid.pixel = 0; /* light green */ - prefs.gui_text_valid.red = 0xAFFF; - prefs.gui_text_valid.green = 0xFFFF; - prefs.gui_text_valid.blue = 0xAFFF; - prefs.gui_text_invalid.pixel = 0; /* light red */ - prefs.gui_text_invalid.red = 0xFFFF; + prefs.gui_text_valid.red = 0xAFFF; /* light green */ + prefs.gui_text_valid.green = 0xFFFF; + prefs.gui_text_valid.blue = 0xAFFF; + prefs.gui_text_invalid.red = 0xFFFF; /* light red */ prefs.gui_text_invalid.green = 0xAFFF; prefs.gui_text_invalid.blue = 0xAFFF; - prefs.gui_text_deprecated.pixel = 0; /* light yellow */ - prefs.gui_text_deprecated.red = 0xFFFF; + prefs.gui_text_deprecated.red = 0xFFFF; /* light yellow */ prefs.gui_text_deprecated.green = 0xFFFF; prefs.gui_text_deprecated.blue = 0xAFFF; prefs.gui_geometry_save_position = TRUE; @@ -4438,7 +4427,6 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_, case PREF_COLOR: { cval = strtoul(value, NULL, 16); - pref->varp.colorp->pixel = 0; if ((pref->varp.colorp->red != RED_COMPONENT(cval)) || (pref->varp.colorp->green != GREEN_COMPONENT(cval)) || (pref->varp.colorp->blue != BLUE_COMPONENT(cval))) { diff --git a/ui/gtk/color_utils.c b/ui/gtk/color_utils.c index 9df4f5b4b3..65889a2fbf 100644 --- a/ui/gtk/color_utils.c +++ b/ui/gtk/color_utils.c @@ -50,7 +50,7 @@ initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue) void color_t_to_gdkcolor(GdkColor *target, const color_t *source) { - target->pixel = source->pixel; + target->pixel = 0; target->red = source->red; target->green = source->green; target->blue = source->blue; @@ -67,7 +67,6 @@ color_t_to_gdkRGBAcolor(GdkRGBA *target, const color_t *source) void gdkcolor_to_color_t(color_t *target, const GdkColor *source) { - target->pixel = source->pixel; target->red = source->red; target->green = source->green; target->blue = source->blue; @@ -76,7 +75,6 @@ gdkcolor_to_color_t(color_t *target, const GdkColor *source) void gdkRGBAcolor_to_color_t(color_t *target, const GdkRGBA *source) { - target->pixel = 0; target->red = (guint16)(source->red*65535); target->green = (guint16)(source->green*65535); target->blue = (guint16)(source->blue*65535); diff --git a/ui/gtk/prefs_font_color.c b/ui/gtk/prefs_font_color.c index fafe0f07b9..a2486eeea1 100644 --- a/ui/gtk/prefs_font_color.c +++ b/ui/gtk/prefs_font_color.c @@ -98,7 +98,7 @@ static void update_font(PangoFontDescription *, GtkWidget *, GtkWidget *); static void update_text_color(GObject *obj, GParamSpec *pspec, gpointer data); static void update_current_color(GtkWidget *, gpointer); -static const color_t filter_text_fg_color = {0, 0, 0, 0}; /* black */ +static const color_t filter_text_fg_color = {0, 0, 0}; /* black */ static GdkXxx tcolors[MAX_IDX], filter_text_fg, *curcolor = NULL; #if ! GTK_CHECK_VERSION(3,4,0) diff --git a/ui/qt/color_utils.cpp b/ui/qt/color_utils.cpp index d90d6046f7..e6576b0938 100644 --- a/ui/qt/color_utils.cpp +++ b/ui/qt/color_utils.cpp @@ -67,7 +67,6 @@ QColor ColorUtils::fromColorT(color_t color) const color_t ColorUtils::toColorT(const QColor color) { color_t colort; - colort.pixel = 0; colort.red = (color.red() << 8) | color.red(); colort.green = (color.green() << 8) | color.green(); colort.blue = (color.blue() << 8) | color.blue(); diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp index 846ff13112..264cda04d8 100644 --- a/ui/qt/coloring_rules_dialog.cpp +++ b/ui/qt/coloring_rules_dialog.cpp @@ -454,7 +454,6 @@ initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue) color->red = red; color->green = green; color->blue = blue; - color->pixel = 0; return TRUE; } |