plug-ins: Load more multichannel PSD channels
Multichannel PSD images reuse their first channel as the main grayscale "layer". Our PSD plug-in did not take this into account, resulting in the channels being off-by-one and mislabeled. This patch prevents chn_a[0].data from being freed after it is used to load the layer, and then resets the counts so that it is reused as the first imported channel.
This commit is contained in:
parent
7436b8dcbd
commit
3f17f528d1
1 changed files with 19 additions and 4 deletions
|
|
@ -3153,7 +3153,11 @@ add_merged_image (GimpImage *image,
|
|||
memcpy (&pixels[((i * base_channels) + cidx) * bps],
|
||||
&chn_a[cidx].data[i * bps], bps);
|
||||
}
|
||||
g_free (chn_a[cidx].data);
|
||||
|
||||
/* For multichannel images, the first layer is also
|
||||
* the first channel, so we don't want to free it yet */
|
||||
if (img_a->color_mode != PSD_MULTICHANNEL)
|
||||
g_free (chn_a[cidx].data);
|
||||
}
|
||||
|
||||
/* Add background layer */
|
||||
|
|
@ -3241,9 +3245,12 @@ add_merged_image (GimpImage *image,
|
|||
else
|
||||
{
|
||||
/* Free merged image data for layered image */
|
||||
if (extra_channels)
|
||||
for (cidx = 0; cidx < base_channels; ++cidx)
|
||||
g_free (chn_a[cidx].data);
|
||||
if (extra_channels &&
|
||||
img_a->color_mode != PSD_MULTICHANNEL)
|
||||
{
|
||||
for (cidx = 0; cidx < base_channels; ++cidx)
|
||||
g_free (chn_a[cidx].data);
|
||||
}
|
||||
}
|
||||
|
||||
if (img_a->transparency)
|
||||
|
|
@ -3257,6 +3264,14 @@ add_merged_image (GimpImage *image,
|
|||
}
|
||||
}
|
||||
|
||||
/* Multichannel mode uses the first channel as the grayscale layer,
|
||||
* so we need to reset the index to grab it again */
|
||||
if (img_a->color_mode == PSD_MULTICHANNEL)
|
||||
{
|
||||
base_channels = 0;
|
||||
extra_channels = img_a->alpha_id_count;
|
||||
}
|
||||
|
||||
/* ----- Draw extra alpha channels ----- */
|
||||
if (extra_channels /* Extra alpha channels */
|
||||
&& image)
|
||||
|
|
|
|||
Loading…
Reference in a new issue