summaryrefslogtreecommitdiff
path: root/image/png.c
diff options
context:
space:
mode:
Diffstat (limited to 'image/png.c')
-rw-r--r--image/png.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/image/png.c b/image/png.c
index f68c07cda..5f01b2387 100644
--- a/image/png.c
+++ b/image/png.c
@@ -326,4 +326,28 @@ bool nspng_redraw_tiled(struct content *c, int x, int y, int width, int height,
background_colour, flags);
}
+bool nspng_clone(const struct content *old, struct content *new_content)
+{
+ const char *data;
+ unsigned long size;
+
+ /* Simply replay create/process/convert */
+ if (nspng_create(new_content, NULL) == false)
+ return false;
+
+ data = content__get_source_data(new_content, &size);
+ if (size > 0) {
+ if (nspng_process_data(new_content, data, size) == false)
+ return false;
+ }
+
+ if (old->status == CONTENT_STATUS_READY ||
+ old->status == CONTENT_STATUS_DONE) {
+ if (nspng_convert(new_content) == false)
+ return false;
+ }
+
+ return true;
+}
+
#endif