From: Arkadiy Illarionov Date: Fri, 16 Feb 2024 20:56:43 +0000 (+0300) Subject: Remove redundant GdkRGBA memcpy X-Git-Tag: v2.3~32 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=6229ff1e44231483e1d1455b86d2a7eb31366cb9 Remove redundant GdkRGBA memcpy --- diff --git a/src/collect-table.cc b/src/collect-table.cc index 12f38f5e..dda4dc76 100644 --- a/src/collect-table.cc +++ b/src/collect-table.cc @@ -2510,9 +2510,7 @@ static void collection_table_cell_data_cb(GtkTreeViewColumn *, GtkCellRenderer * gchar *display_text = nullptr; gchar *star_rating = nullptr; GdkRGBA color_bg; - GdkRGBA color_bg_style; GdkRGBA color_fg; - GdkRGBA color_fg_style; GList *list; GtkStyle *style; @@ -2532,22 +2530,13 @@ static void collection_table_cell_data_cb(GtkTreeViewColumn *, GtkCellRenderer * style = gtk_widget_get_style(ct->listview); if (info && (info->flag_mask & SELECTION_SELECTED) ) { - convert_gdkcolor_to_gdkrgba(&style->text[GTK_STATE_SELECTED], &color_fg_style); - convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_SELECTED], &color_bg_style); - - memcpy(&color_fg, &color_fg_style, sizeof(color_fg)); - memcpy(&color_bg, &color_bg_style, sizeof(color_bg)); + convert_gdkcolor_to_gdkrgba(&style->text[GTK_STATE_SELECTED], &color_fg); + convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_SELECTED], &color_bg); } else { - convert_gdkcolor_to_gdkrgba(&style->text[GTK_STATE_NORMAL], &color_fg_style); - convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color_bg_style); - - memcpy(&color_fg, &color_fg_style, sizeof(color_fg)); - memcpy(&color_bg, &color_bg_style, sizeof(color_bg)); - - memcpy(&color_fg, &color_fg_style, sizeof(color_fg)); - memcpy(&color_bg, &color_bg_style, sizeof(color_bg)); + convert_gdkcolor_to_gdkrgba(&style->text[GTK_STATE_NORMAL], &color_fg); + convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color_bg); } if (info && (info->flag_mask & SELECTION_PRELIGHT)) diff --git a/src/dupe.cc b/src/dupe.cc index 39389782..4eb5b664 100644 --- a/src/dupe.cc +++ b/src/dupe.cc @@ -3997,7 +3997,6 @@ void cell_renderer_height_override(GtkCellRenderer *renderer) static GdkRGBA *dupe_listview_color_shifted(GtkWidget *widget) { static GdkRGBA color; - static GdkRGBA color_style; static GtkWidget *done = nullptr; if (done != widget) @@ -4005,9 +4004,8 @@ static GdkRGBA *dupe_listview_color_shifted(GtkWidget *widget) GtkStyle *style; style = gtk_widget_get_style(widget); - convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color_style); + convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color); - memcpy(&color, &color_style, sizeof(color)); shift_color(&color, -1, 0); done = widget; } diff --git a/src/view-dir.cc b/src/view-dir.cc index 43eb7937..afdd1b61 100644 --- a/src/view-dir.cc +++ b/src/view-dir.cc @@ -1176,7 +1176,6 @@ void vd_activate_cb(GtkTreeView *tview, GtkTreePath *tpath, GtkTreeViewColumn *, static GdkRGBA *vd_color_shifted(GtkWidget *widget) { static GdkRGBA color; - static GdkRGBA color_style; static GtkWidget *done = nullptr; #ifdef HAVE_GTK4 @@ -1187,9 +1186,7 @@ static GdkRGBA *vd_color_shifted(GtkWidget *widget) GtkStyleContext *style_context; style_context = gtk_widget_get_style_context(widget); - gtk_style_context_get_background_color(style_context, GTK_STATE_FLAG_NORMAL, &color_style); - - memcpy(&color, &color_style, sizeof(color_style)); + gtk_style_context_get_background_color(style_context, GTK_STATE_FLAG_NORMAL, &color); shift_color(&color, -1, 0); done = widget; diff --git a/src/view-file/view-file-icon.cc b/src/view-file/view-file-icon.cc index ae27a33d..b22a6463 100644 --- a/src/view-file/view-file-icon.cc +++ b/src/view-file/view-file-icon.cc @@ -2100,8 +2100,6 @@ static void vficon_cell_data_cb(GtkTreeViewColumn *, GtkCellRenderer *cell, gchar *name_sidecars = nullptr; GdkRGBA color_bg; GdkRGBA color_fg; - GdkRGBA color_bg_style; - GdkRGBA color_fg_style; GtkStateType state = GTK_STATE_NORMAL; GtkStyle *style; @@ -2158,11 +2156,8 @@ static void vficon_cell_data_cb(GtkTreeViewColumn *, GtkCellRenderer *cell, state = GTK_STATE_SELECTED; } - convert_gdkcolor_to_gdkrgba(&style->text[state], &color_fg_style); - convert_gdkcolor_to_gdkrgba(&style->base[state], &color_bg_style); - - memcpy(&color_fg, &color_fg_style, sizeof(color_fg)); - memcpy(&color_bg, &color_bg_style, sizeof(color_bg)); + convert_gdkcolor_to_gdkrgba(&style->text[state], &color_fg); + convert_gdkcolor_to_gdkrgba(&style->base[state], &color_bg); if (fd->selected & SELECTION_PRELIGHT) { diff --git a/src/view-file/view-file-list.cc b/src/view-file/view-file-list.cc index bcd1145d..b802a3b2 100644 --- a/src/view-file/view-file-list.cc +++ b/src/view-file/view-file-list.cc @@ -1964,7 +1964,6 @@ static void cell_renderer_height_override(GtkCellRenderer *renderer) static GdkRGBA *vflist_listview_color_shifted(GtkWidget *widget) { static GdkRGBA color; - static GdkRGBA color_style; static GtkWidget *done = nullptr; if (done != widget) @@ -1972,9 +1971,8 @@ static GdkRGBA *vflist_listview_color_shifted(GtkWidget *widget) GtkStyle *style; style = gtk_widget_get_style(widget); - convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color_style); + convert_gdkcolor_to_gdkrgba(&style->base[GTK_STATE_NORMAL], &color); - memcpy(&color, &color_style, sizeof(color)); shift_color(&color, -1, 0); done = widget; }