Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/png.c
| Show All 32 Lines | |||||
| #include "png.h" | #include "png.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_fileops.h" | #include "BLI_fileops.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_idprop.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "imbuf.h" | #include "imbuf.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| ▲ Show 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | png_set_IHDR(png_ptr, | ||||
| color_type, | color_type, | ||||
| PNG_INTERLACE_NONE, | PNG_INTERLACE_NONE, | ||||
| PNG_COMPRESSION_TYPE_DEFAULT, | PNG_COMPRESSION_TYPE_DEFAULT, | ||||
| PNG_FILTER_TYPE_DEFAULT); | PNG_FILTER_TYPE_DEFAULT); | ||||
| /* image text info */ | /* image text info */ | ||||
| if (ibuf->metadata) { | if (ibuf->metadata) { | ||||
| png_text *metadata; | png_text *metadata; | ||||
| ImMetaData *iptr; | IDProperty *prop; | ||||
| int num_text = 0; | int num_text = 0; | ||||
| iptr = ibuf->metadata; | |||||
| while (iptr) { | for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { | ||||
| if (prop->type == IDP_STRING){ | |||||
sergey: Same as above. | |||||
| num_text++; | num_text++; | ||||
| iptr = iptr->next; | } | ||||
| } | } | ||||
| metadata = MEM_callocN(num_text * sizeof(png_text), "png_metadata"); | metadata = MEM_callocN(num_text * sizeof(png_text), "png_metadata"); | ||||
| iptr = ibuf->metadata; | |||||
| num_text = 0; | num_text = 0; | ||||
| while (iptr) { | for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { | ||||
| if (prop->type == IDP_STRING){ | |||||
sergeyUnsubmitted Not Done Inline ActionsAnd again. sergey: And again. | |||||
| metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; | metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; | ||||
| metadata[num_text].key = iptr->key; | metadata[num_text].key = prop->name; | ||||
| metadata[num_text].text = iptr->value; | metadata[num_text].text = IDP_String(prop); | ||||
| num_text++; | num_text++; | ||||
| iptr = iptr->next; | } | ||||
| } | } | ||||
| png_set_text(png_ptr, info_ptr, metadata, num_text); | png_set_text(png_ptr, info_ptr, metadata, num_text); | ||||
| MEM_freeN(metadata); | MEM_freeN(metadata); | ||||
| } | } | ||||
| if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) { | if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) { | ||||
| ▲ Show 20 Lines • Show All 343 Lines • Show Last 20 Lines | |||||
Same as above.