diff options
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 94914db3a1a..6b31b3e965b 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -38,6 +38,7 @@ #include "BLI_math.h" #include "BKE_global.h" +#include "BKE_idprop.h" #include "MEM_guardedalloc.h" @@ -397,24 +398,25 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) /* image text info */ if (ibuf->metadata) { png_text *metadata; - ImMetaData *iptr; + IDProperty *prop; + int num_text = 0; - iptr = ibuf->metadata; - while (iptr) { - num_text++; - iptr = iptr->next; + + for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { + if (prop->type == IDP_STRING){ + num_text++; + } } metadata = MEM_callocN(num_text * sizeof(png_text), "png_metadata"); - iptr = ibuf->metadata; num_text = 0; - while (iptr) { - - metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; - metadata[num_text].key = iptr->key; - metadata[num_text].text = iptr->value; - num_text++; - iptr = iptr->next; + for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { + if (prop->type == IDP_STRING){ + metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; + metadata[num_text].key = prop->name; + metadata[num_text].text = IDP_String(prop); + num_text++; + } } png_set_text(png_ptr, info_ptr, metadata, num_text); |