[gimp/pippin/linear-is-the-new-black: 2/3] app: change histogram, to default to linear
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/pippin/linear-is-the-new-black: 2/3] app: change histogram, to default to linear
- Date: Wed, 14 Dec 2016 13:46:09 +0000 (UTC)
commit ff3eeb82fd92028cbf0d96fc5ebce09d931c90ea
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Dec 14 06:17:41 2016 +0100
app: change histogram, to default to linear
Part of the blunt way to resolve bug #757444
app/core/gimphistogram.c | 50 +++++++++++++++++++++++-----------------------
app/core/gimphistogram.h | 2 +-
2 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c
index a49b386..887f017 100644
--- a/app/core/gimphistogram.c
+++ b/app/core/gimphistogram.c
@@ -44,7 +44,7 @@ enum
struct _GimpHistogramPrivate
{
- gboolean gamma_correct;
+ gboolean linear;
gint n_channels;
gint n_bins;
gdouble *values;
@@ -188,11 +188,11 @@ gimp_histogram_get_memsize (GimpObject *object,
/* public functions */
GimpHistogram *
-gimp_histogram_new (gboolean gamma_correct)
+gimp_histogram_new (gboolean linear)
{
GimpHistogram *histogram = g_object_new (GIMP_TYPE_HISTOGRAM, NULL);
- histogram->priv->gamma_correct = gamma_correct;
+ histogram->priv->linear = linear;
return histogram;
}
@@ -213,7 +213,7 @@ gimp_histogram_duplicate (GimpHistogram *histogram)
g_return_val_if_fail (GIMP_IS_HISTOGRAM (histogram), NULL);
- dup = gimp_histogram_new (histogram->priv->gamma_correct);
+ dup = gimp_histogram_new (histogram->priv->linear);
dup->priv->n_channels = histogram->priv->n_channels;
dup->priv->n_bins = histogram->priv->n_bins;
@@ -254,9 +254,9 @@ gimp_histogram_calculate (GimpHistogram *histogram,
if (babl_format_is_palette (format))
{
if (babl_format_has_alpha (format))
- format = babl_format ("R'G'B'A float");
+ format = priv->linear?babl_format("RGBA float"):babl_format ("R'G'B'A float");
else
- format = babl_format ("R'G'B' float");
+ format = priv->linear?babl_format("RGB float"):babl_format ("R'G'B' float");
}
else
{
@@ -264,47 +264,47 @@ gimp_histogram_calculate (GimpHistogram *histogram,
if (model == babl_model ("Y"))
{
- if (priv->gamma_correct)
- format = babl_format ("Y' float");
- else
- format = babl_format ("Y float");
+ format = babl_format ("Y float");
}
else if (model == babl_model ("Y'"))
{
- format = babl_format ("Y' float");
+ if (priv->linear)
+ format = babl_format ("Y float");
+ else
+ format = babl_format ("Y' float");
}
else if (model == babl_model ("YA"))
{
- if (priv->gamma_correct)
- format = babl_format ("Y'A float");
- else
- format = babl_format ("YA float");
+ format = babl_format ("YA float");
}
else if (model == babl_model ("Y'A"))
{
- format = babl_format ("Y'A float");
+ if (priv->linear)
+ format = babl_format ("YA float");
+ else
+ format = babl_format ("Y'A float");
}
else if (model == babl_model ("RGB"))
{
- if (priv->gamma_correct)
- format = babl_format ("R'G'B' float");
- else
format = babl_format ("RGB float");
}
else if (model == babl_model ("R'G'B'"))
{
- format = babl_format ("R'G'B' float");
+ if (priv->linear)
+ format = babl_format ("RGB float");
+ else
+ format = babl_format ("R'G'B' float");
}
- else if (model == babl_model ("RGBA"))
+ else if (model == babl_model ("R'G'B'A"))
{
- if (priv->gamma_correct)
- format = babl_format ("R'G'B'A float");
- else
+ if (priv->linear)
format = babl_format ("RGBA float");
+ else
+ format = babl_format ("R'G'B'A float");
}
else if (model == babl_model ("R'G'B'A"))
{
- format = babl_format ("R'G'B'A float");
+ format = babl_format ("RGBA float");
}
else
{
diff --git a/app/core/gimphistogram.h b/app/core/gimphistogram.h
index aa4abb7..c511e69 100644
--- a/app/core/gimphistogram.h
+++ b/app/core/gimphistogram.h
@@ -50,7 +50,7 @@ struct _GimpHistogramClass
GType gimp_histogram_get_type (void) G_GNUC_CONST;
-GimpHistogram * gimp_histogram_new (gboolean gamma_correct);
+GimpHistogram * gimp_histogram_new (gboolean linear);
GimpHistogram * gimp_histogram_duplicate (GimpHistogram *histogram);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]