[gimp/gimp-2-8] Bug 737008 - Curve color always black
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 737008 - Curve color always black
- Date: Sun, 21 Sep 2014 10:37:51 +0000 (UTC)
commit 7dda7a3ceb6ede592926c9400f31ff2c41c6fec3
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 21 12:29:35 2014 +0200
Bug 737008 - Curve color always black
Don't hardcode "black" for the "Value" curve in GimpCurvesTool.
Instead, pass a NULL color to GimpCurveView, which is then interpreted
as the theme's text color (the curve's background is the theme's text
background color). We still hardcode pure red, green and blue for the
other curves.
(cherry picked from commit 90c967a39fc20203274f1f8a1948de3d537bf113)
app/tools/gimpcurvestool.c | 35 +++++++++++++++++++++++------------
app/widgets/gimpcurveview.c | 30 +++++++++++++++++++++++-------
2 files changed, 46 insertions(+), 19 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 334f1d5..de565c5 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -121,20 +121,13 @@ static gboolean curves_menu_sensitivity (gint value,
static void curves_curve_type_callback (GtkWidget *widget,
GimpCurvesTool *tool);
+static const GimpRGB * curves_get_channel_color (GimpHistogramChannel channel);
+
G_DEFINE_TYPE (GimpCurvesTool, gimp_curves_tool, GIMP_TYPE_IMAGE_MAP_TOOL)
#define parent_class gimp_curves_tool_parent_class
-static GimpRGB channel_colors[GIMP_HISTOGRAM_RGB] =
-{
- { 0.0, 0.0, 0.0, 1.0 },
- { 1.0, 0.0, 0.0, 1.0 },
- { 0.0, 1.0, 0.0, 1.0 },
- { 0.0, 0.0, 1.0, 1.0 },
- { 0.5, 0.5, 0.5, 1.0 }
-};
-
/* public functions */
@@ -542,7 +535,7 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
NULL);
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
config->curve[config->channel],
- &channel_colors[config->channel]);
+ curves_get_channel_color (config->channel));
gtk_container_add (GTK_CONTAINER (frame), tool->graph);
gtk_widget_show (tool->graph);
@@ -804,13 +797,13 @@ gimp_curves_tool_config_notify (GObject *object,
if (channel == config->channel)
{
gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), curve,
- &channel_colors[channel]);
+ curves_get_channel_color (channel));
}
else
{
gimp_curve_view_add_background (GIMP_CURVE_VIEW (tool->graph),
config->curve[channel],
- &channel_colors[channel]);
+ curves_get_channel_color (channel));
}
}
@@ -891,3 +884,21 @@ curves_curve_type_callback (GtkWidget *widget,
gimp_curve_set_curve_type (config->curve[config->channel], curve_type);
}
}
+
+static const GimpRGB *
+curves_get_channel_color (GimpHistogramChannel channel)
+{
+ static const GimpRGB channel_colors[GIMP_HISTOGRAM_RGB] =
+ {
+ { 0.0, 0.0, 0.0, 1.0 },
+ { 1.0, 0.0, 0.0, 1.0 },
+ { 0.0, 1.0, 0.0, 1.0 },
+ { 0.0, 0.0, 1.0, 1.0 },
+ { 0.5, 0.5, 0.5, 1.0 }
+ };
+
+ if (channel == GIMP_HISTOGRAM_VALUE)
+ return NULL;
+
+ return &channel_colors[channel];
+}
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 487e1f7..51f38c6 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -62,6 +62,7 @@ typedef struct
{
GimpCurve *curve;
GimpRGB color;
+ gboolean color_set;
} BGCurve;
@@ -585,11 +586,22 @@ gimp_curve_view_expose (GtkWidget *widget,
{
BGCurve *bg = list->data;
- cairo_set_source_rgba (cr,
- bg->color.r,
- bg->color.g,
- bg->color.b,
- 0.5);
+ if (bg->color_set)
+ {
+ cairo_set_source_rgba (cr,
+ bg->color.r,
+ bg->color.g,
+ bg->color.b,
+ 0.5);
+ }
+ else
+ {
+ cairo_set_source_rgba (cr,
+ style->text[GTK_STATE_NORMAL].red / 65535.0,
+ style->text[GTK_STATE_NORMAL].green / 65535.0,
+ style->text[GTK_STATE_NORMAL].blue / 65535.0,
+ 0.5);
+ }
gimp_curve_view_draw_curve (view, cr, bg->curve,
width, height, border);
@@ -1232,7 +1244,6 @@ gimp_curve_view_add_background (GimpCurveView *view,
g_return_if_fail (GIMP_IS_CURVE_VIEW (view));
g_return_if_fail (GIMP_IS_CURVE (curve));
- g_return_if_fail (color != NULL);
for (list = view->bg_curves; list; list = g_list_next (list))
{
@@ -1244,7 +1255,12 @@ gimp_curve_view_add_background (GimpCurveView *view,
bg = g_slice_new0 (BGCurve);
bg->curve = g_object_ref (curve);
- bg->color = *color;
+
+ if (color)
+ {
+ bg->color = *color;
+ bg->color_set = TRUE;
+ }
g_signal_connect (bg->curve, "dirty",
G_CALLBACK (gimp_curve_view_curve_dirty),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]