[gimp] plug-ins: in file-psd, read blend mode info of lsct layer records



commit e8f6a3888b984f22a9f60b2219abaea45d40ae33
Author: Ell <ell_se yahoo com>
Date:   Wed Aug 9 08:18:59 2017 -0400

    plug-ins: in file-psd, read blend mode info of lsct layer records
    
    The section-divider (lsct) layer resource may contain blend mode
    information, which apparently overrides the blend mode specified in
    the layer record.  When reading such a resource, replace the layer's
    blend mode with the one specified by the resource.
    
    It seems like pass-through group layers specify normal mode in their
    layer record, but pass-through in their section-divider resource, so
    this commit allows correctly loading such layers.

 plug-ins/file-psd/psd-layer-res-load.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-layer-res-load.c b/plug-ins/file-psd/psd-layer-res-load.c
index 156c4bf..c63d6c9 100644
--- a/plug-ins/file-psd/psd-layer-res-load.c
+++ b/plug-ins/file-psd/psd-layer-res-load.c
@@ -551,6 +551,31 @@ load_resource_lsct (const PSDlayerres  *res_a,
   IFDBG(3) g_debug ("Section divider type: %i", type);
 
   lyr_a->group_type = type;
+
+  if (res_a->data_len >= 12)
+    {
+      gchar signature[4];
+      gchar blend_mode[4];
+
+      if (fread (signature,  4, 1, f) < 1 ||
+          fread (blend_mode, 4, 1, f) < 1)
+
+        {
+          psd_set_error (feof (f), errno, error);
+          return -1;
+        }
+      if (memcmp (signature, "8BIM", 4) == 0)
+        {
+          memcpy (lyr_a->blend_mode, blend_mode, 4);
+          IFDBG(2) g_debug ("Section divider layer mode sig: %.4s, blend mode: %.4s",
+                            signature, blend_mode);
+        }
+      else
+        {
+          IFDBG(1) g_debug ("Incorrect layer mode signature %.4s", signature);
+        }
+    }
+
   return 0;
 }
 


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