app: drop alpha from all fishes in gimpgradient.c

Alpha is calculated separately, ne need to run it through babl.
Also some formatting cleanup.
This commit is contained in:
Michael Natterer 2018-04-14 21:09:01 +02:00
parent 3736bfd189
commit 0c066f311e
1 changed files with 31 additions and 27 deletions

View File

@ -101,7 +101,7 @@ G_DEFINE_TYPE_WITH_CODE (GimpGradient, gimp_gradient, GIMP_TYPE_DATA,
static const Babl *fish_srgb_to_linear_rgb = NULL;
static const Babl *fish_linear_rgb_to_srgb = NULL;
static const Babl *fish_srgb_to_cie_lab = NULL;
static const Babl *fish_cie_lab_a_to_srgb = NULL;
static const Babl *fish_cie_lab_to_srgb = NULL;
static void
@ -128,12 +128,12 @@ gimp_gradient_class_init (GimpGradientClass *klass)
fish_srgb_to_linear_rgb = babl_fish (babl_format ("R'G'B' double"),
babl_format ("RGB double"));
fish_linear_rgb_to_srgb = babl_fish (babl_format ("RGBA double"),
babl_format ("R'G'B'A double"));
fish_linear_rgb_to_srgb = babl_fish (babl_format ("RGB double"),
babl_format ("R'G'B' double"));
fish_srgb_to_cie_lab = babl_fish (babl_format ("R'G'B' double"),
babl_format ("CIE Lab double"));
fish_cie_lab_a_to_srgb = babl_fish (babl_format ("CIE Lab alpha double"),
babl_format ("R'G'B'A double"));
fish_cie_lab_to_srgb = babl_fish (babl_format ("CIE Lab double"),
babl_format ("R'G'B' double"));
}
static void
@ -522,19 +522,21 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
{
switch (blend_color_space)
{
case GIMP_GRADIENT_BLEND_CIE_LAB:
babl_process (fish_srgb_to_cie_lab,
&left_color, &left_color, 1);
babl_process (fish_srgb_to_cie_lab,
&right_color, &right_color, 1);
break;
case GIMP_GRADIENT_BLEND_RGB_LINEAR:
babl_process (fish_srgb_to_linear_rgb,
&left_color, &left_color, 1);
babl_process (fish_srgb_to_linear_rgb,
&right_color, &right_color, 1);
case GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL:
break;
case GIMP_GRADIENT_BLEND_CIE_LAB:
babl_process (fish_srgb_to_cie_lab,
&left_color, &left_color, 1);
babl_process (fish_srgb_to_cie_lab,
&right_color, &right_color, 1);
break;
case GIMP_GRADIENT_BLEND_RGB_LINEAR:
babl_process (fish_srgb_to_linear_rgb,
&left_color, &left_color, 1);
babl_process (fish_srgb_to_linear_rgb,
&right_color, &right_color, 1);
case GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL:
break;
}
rgb.r = left_color.r + (right_color.r - left_color.r) * factor;
@ -543,15 +545,17 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
switch (blend_color_space)
{
case GIMP_GRADIENT_BLEND_CIE_LAB:
babl_process (fish_cie_lab_a_to_srgb,
&rgb, &rgb, 1);
break;
case GIMP_GRADIENT_BLEND_RGB_LINEAR:
babl_process (fish_linear_rgb_to_srgb,
&rgb, &rgb, 1);
case GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL:
break;
case GIMP_GRADIENT_BLEND_CIE_LAB:
babl_process (fish_cie_lab_to_srgb,
&rgb, &rgb, 1);
break;
case GIMP_GRADIENT_BLEND_RGB_LINEAR:
babl_process (fish_linear_rgb_to_srgb,
&rgb, &rgb, 1);
case GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL:
break;
}
}
else