mirror of https://github.com/GNOME/gimp.git
operations: Revert legacy modes for performance
This patch temporarily reverts 02546da7
,
due to performance issues with our use
of Babl. After 3.0, we'll try to improve
these operations so they can be more
color correct.
However, GimpRGB, GimpHSV, and GimpHSL are
replaced with double arrays.
This commit is contained in:
parent
8138b1eaee
commit
c8694485db
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "../operations-types.h"
|
#include "../operations-types.h"
|
||||||
|
|
||||||
|
#include "gimpcolor-legacy.h"
|
||||||
#include "gimpoperationhslcolorlegacy.h"
|
#include "gimpoperationhslcolorlegacy.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,8 +85,9 @@ gimp_operation_hsl_color_legacy_process (GeglOperation *op,
|
||||||
|
|
||||||
while (samples--)
|
while (samples--)
|
||||||
{
|
{
|
||||||
gfloat layer_hsl[3], out_hsl[3];
|
gdouble layer_hsl[4], out_hsl[4];
|
||||||
gfloat out_rgb[3];
|
gdouble layer_rgb[4] = {layer[0], layer[1], layer[2], 1.0};
|
||||||
|
gdouble out_rgb[4] = {in[0], in[1], in[2], 1.0};
|
||||||
gfloat comp_alpha, new_alpha;
|
gfloat comp_alpha, new_alpha;
|
||||||
|
|
||||||
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
||||||
|
@ -99,18 +101,13 @@ gimp_operation_hsl_color_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
gfloat ratio = comp_alpha / new_alpha;
|
gfloat ratio = comp_alpha / new_alpha;
|
||||||
|
|
||||||
/* TODO: shouldn't these conversions be processed in image space, or
|
gimp_rgb_to_hsl_legacy (layer_rgb, layer_hsl);
|
||||||
* doesn't it matter?
|
gimp_rgb_to_hsl_legacy (out_rgb, out_hsl);
|
||||||
*/
|
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSL float")),
|
|
||||||
layer, layer_hsl, 1);
|
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSL float")),
|
|
||||||
in, out_hsl, 1);
|
|
||||||
|
|
||||||
out_hsl[0] = layer_hsl[0];
|
out_hsl[0] = layer_hsl[0];
|
||||||
out_hsl[1] = layer_hsl[1];
|
out_hsl[1] = layer_hsl[1];
|
||||||
babl_process (babl_fish (babl_format ("HSL float"), babl_format ("R'G'B' float")),
|
gimp_hsl_to_rgb_legacy (out_hsl, out_rgb);
|
||||||
out_hsl, out_rgb, 1);
|
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
||||||
|
@ -120,10 +117,8 @@ gimp_operation_hsl_color_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
|
||||||
out[b] = in[b];
|
out[b] = in[b];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
out[ALPHA] = in[ALPHA];
|
out[ALPHA] = in[ALPHA];
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "../operations-types.h"
|
#include "../operations-types.h"
|
||||||
|
|
||||||
|
#include "gimpcolor-legacy.h"
|
||||||
#include "gimpoperationhsvhuelegacy.h"
|
#include "gimpoperationhsvhuelegacy.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,8 +85,9 @@ gimp_operation_hsv_hue_legacy_process (GeglOperation *op,
|
||||||
|
|
||||||
while (samples--)
|
while (samples--)
|
||||||
{
|
{
|
||||||
gfloat layer_hsv[3], out_hsv[3];
|
gdouble layer_hsv[4], out_hsv[4];
|
||||||
gfloat out_rgb[3];
|
gdouble layer_rgb[4] = {layer[0], layer[1], layer[2], 1.0};
|
||||||
|
gdouble out_rgb[4] = {in[0], in[1], in[2], 1.0};
|
||||||
gfloat comp_alpha, new_alpha;
|
gfloat comp_alpha, new_alpha;
|
||||||
|
|
||||||
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
||||||
|
@ -99,18 +101,16 @@ gimp_operation_hsv_hue_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
gfloat ratio = comp_alpha / new_alpha;
|
gfloat ratio = comp_alpha / new_alpha;
|
||||||
|
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSV float")),
|
gimp_rgb_to_hsv_legacy (layer_rgb, layer_hsv);
|
||||||
layer, layer_hsv, 1);
|
gimp_rgb_to_hsv_legacy (out_rgb, out_hsv);
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSV float")),
|
|
||||||
in, out_hsv, 1);
|
|
||||||
|
|
||||||
/* Composition should have no effect if saturation is zero.
|
/* Composition should have no effect if saturation is zero.
|
||||||
* otherwise, black would be painted red (see bug #123296).
|
* otherwise, black would be painted red (see bug #123296).
|
||||||
*/
|
*/
|
||||||
if (layer_hsv[1])
|
if (layer_hsv[1])
|
||||||
out_hsv[0] = layer_hsv[0];
|
out_hsv[0] = layer_hsv[0];
|
||||||
babl_process (babl_fish (babl_format ("HSV float"), babl_format ("R'G'B' float")),
|
|
||||||
out_hsv, out_rgb, 1);
|
gimp_hsv_to_rgb_legacy (out_hsv, out_rgb);
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
||||||
|
@ -120,10 +120,8 @@ gimp_operation_hsv_hue_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
|
||||||
out[b] = in[b];
|
out[b] = in[b];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
out[ALPHA] = in[ALPHA];
|
out[ALPHA] = in[ALPHA];
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "../operations-types.h"
|
#include "../operations-types.h"
|
||||||
|
|
||||||
|
#include "gimpcolor-legacy.h"
|
||||||
#include "gimpoperationhsvsaturationlegacy.h"
|
#include "gimpoperationhsvsaturationlegacy.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,8 +85,9 @@ gimp_operation_hsv_saturation_legacy_process (GeglOperation *op,
|
||||||
|
|
||||||
while (samples--)
|
while (samples--)
|
||||||
{
|
{
|
||||||
gfloat layer_hsv[3], out_hsv[3];
|
gdouble layer_hsv[4], out_hsv[4];
|
||||||
gfloat out_rgb[3];
|
gdouble layer_rgb[4] = {layer[0], layer[1], layer[2], 1.0};
|
||||||
|
gdouble out_rgb[4] = {in[0], in[1], in[2], 1.0};
|
||||||
gfloat comp_alpha, new_alpha;
|
gfloat comp_alpha, new_alpha;
|
||||||
|
|
||||||
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
||||||
|
@ -99,14 +101,11 @@ gimp_operation_hsv_saturation_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
gfloat ratio = comp_alpha / new_alpha;
|
gfloat ratio = comp_alpha / new_alpha;
|
||||||
|
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSV float")),
|
gimp_rgb_to_hsv_legacy (layer_rgb, layer_hsv);
|
||||||
layer, layer_hsv, 1);
|
gimp_rgb_to_hsv_legacy (out_rgb, out_hsv);
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSV float")),
|
|
||||||
in, out_hsv, 1);
|
|
||||||
|
|
||||||
out_hsv[1] = layer_hsv[1];
|
out_hsv[1] = layer_hsv[1];
|
||||||
babl_process (babl_fish (babl_format ("HSV float"), babl_format ("R'G'B' float")),
|
gimp_hsv_to_rgb_legacy (out_hsv, out_rgb);
|
||||||
out_hsv, out_rgb, 1);
|
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
||||||
|
@ -116,10 +115,8 @@ gimp_operation_hsv_saturation_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
|
||||||
out[b] = in[b];
|
out[b] = in[b];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
out[ALPHA] = in[ALPHA];
|
out[ALPHA] = in[ALPHA];
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "../operations-types.h"
|
#include "../operations-types.h"
|
||||||
|
|
||||||
|
#include "gimpcolor-legacy.h"
|
||||||
#include "gimpoperationhsvvaluelegacy.h"
|
#include "gimpoperationhsvvaluelegacy.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,8 +85,9 @@ gimp_operation_hsv_value_legacy_process (GeglOperation *op,
|
||||||
|
|
||||||
while (samples--)
|
while (samples--)
|
||||||
{
|
{
|
||||||
gfloat layer_hsv[3], out_hsv[3];
|
gdouble layer_hsv[4], out_hsv[4];
|
||||||
gfloat out_rgb[3];
|
gdouble layer_rgb[4] = {layer[0], layer[1], layer[2], 1.0};
|
||||||
|
gdouble out_rgb[4] = {in[0], in[1], in[2], 1.0};
|
||||||
gfloat comp_alpha, new_alpha;
|
gfloat comp_alpha, new_alpha;
|
||||||
|
|
||||||
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
|
||||||
|
@ -99,14 +101,11 @@ gimp_operation_hsv_value_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
gfloat ratio = comp_alpha / new_alpha;
|
gfloat ratio = comp_alpha / new_alpha;
|
||||||
|
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSV float")),
|
gimp_rgb_to_hsv_legacy (layer_rgb, layer_hsv);
|
||||||
layer, layer_hsv, 1);
|
gimp_rgb_to_hsv_legacy (out_rgb, out_hsv);
|
||||||
babl_process (babl_fish (babl_format ("R'G'B' float"), babl_format ("HSV float")),
|
|
||||||
in, out_hsv, 1);
|
|
||||||
|
|
||||||
out_hsv[2] = layer_hsv[2];
|
out_hsv[2] = layer_hsv[2];
|
||||||
babl_process (babl_fish (babl_format ("HSV float"), babl_format ("R'G'B' float")),
|
gimp_hsv_to_rgb_legacy (out_hsv, out_rgb);
|
||||||
out_hsv, out_rgb, 1);
|
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
out[b] = out_rgb[b] * ratio + in[b] * (1.0f - ratio);
|
||||||
|
@ -116,10 +115,8 @@ gimp_operation_hsv_value_legacy_process (GeglOperation *op,
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
|
||||||
out[b] = in[b];
|
out[b] = in[b];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
out[ALPHA] = in[ALPHA];
|
out[ALPHA] = in[ALPHA];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue