[gimp] app: in Luminance mode, cache RGBA -> Y fish



commit dbab0b557dfc589b2da7511ef5c2ba02f72a4aa3
Author: Ell <ell_se yahoo com>
Date:   Sat Dec 1 05:35:38 2018 -0500

    app: in Luminance mode, cache RGBA -> Y fish

 app/operations/layer-modes/gimpoperationlayermode-blend.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationlayermode-blend.c 
b/app/operations/layer-modes/gimpoperationlayermode-blend.c
index c3fa09f70c..cb54fcae3c 100644
--- a/app/operations/layer-modes/gimpoperationlayermode-blend.c
+++ b/app/operations/layer-modes/gimpoperationlayermode-blend.c
@@ -868,17 +868,21 @@ gimp_operation_layer_mode_blend_luminance (const gfloat *in,
                                            gfloat       *comp,
                                            gint          samples)
 {
-  gfloat *scratch;
-  gfloat *in_Y;
-  gfloat *layer_Y;
+  static const Babl *fish;
+  gfloat            *scratch;
+  gfloat            *in_Y;
+  gfloat            *layer_Y;
+
+  if (! fish)
+    fish = babl_fish ("RGBA float", "Y float");
 
   scratch = gimp_scratch_new (gfloat, 2 * samples);
 
   in_Y    = scratch;
   layer_Y = scratch + samples;
 
-  babl_process (babl_fish ("RGBA float", "Y float"), in,    in_Y,    samples);
-  babl_process (babl_fish ("RGBA float", "Y float"), layer, layer_Y, samples);
+  babl_process (fish, in,    in_Y,    samples);
+  babl_process (fish, layer, layer_Y, samples);
 
   while (samples--)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]