From 79ce683b4e6d34fe327b00f1e427e476016cfab0 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 4 Apr 2010 12:41:19 +0000 Subject: Most of a stop implementation. Remaining work: 1) Clone content_html_data 2) Cloning content_css_data requires the charset of the old content 3) Calling hlcache_handle_abort() before a content has been created must clean up the retrieval context. svn path=/trunk/netsurf/; revision=10236 --- image/png.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'image/png.c') 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 -- cgit v1.2.3