[gimp] app: allow a NULL "aux" in gimp:mask-components



commit 4cc1084c115b3a119e6222b6c9df64e0c1375b54
Author: Michael Natterer <mitch gimp org>
Date:   Sat Oct 6 23:45:59 2012 +0200

    app: allow a NULL "aux" in gimp:mask-components
    
    and use black transparency instead, so it can be used for implementing
    the image's component visibility.

 app/operations/gimpoperationmaskcomponents.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/app/operations/gimpoperationmaskcomponents.c b/app/operations/gimpoperationmaskcomponents.c
index f74912f..b817f9c 100644
--- a/app/operations/gimpoperationmaskcomponents.c
+++ b/app/operations/gimpoperationmaskcomponents.c
@@ -156,6 +156,10 @@ gimp_operation_mask_components_process (GeglOperation       *operation,
   gfloat                      *aux  = aux_buf;
   gfloat                      *dest = out_buf;
   GimpComponentMask            mask = self->mask;
+  static const gfloat          nothing[] = { 0.0, 0.0, 0.0, 0.0 };
+
+  if (! aux)
+    aux = nothing;
 
   while (samples--)
     {
@@ -164,8 +168,11 @@ gimp_operation_mask_components_process (GeglOperation       *operation,
       dest[BLUE]  = (mask & GIMP_COMPONENT_BLUE)  ? aux[BLUE]  : src[BLUE];
       dest[ALPHA] = (mask & GIMP_COMPONENT_ALPHA) ? aux[ALPHA] : src[ALPHA];
 
-      src  += 4;
-      aux  += 4;
+      src += 4;
+
+      if (aux_buf)
+        aux  += 4;
+
       dest += 4;
     }
 



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