netsurf: branch tlsa/gif-api updated. release/3.10-159-g2e9ef8f
Gitweb links: ...log http://git.netsurf-browser.org/netsurf.git/shortlog/2e9ef8feae321d9a8463c816a356eb73d789b6c7 ...commit http://git.netsurf-browser.org/netsurf.git/commit/2e9ef8feae321d9a8463c816a356eb73d789b6c7 ...tree http://git.netsurf-browser.org/netsurf.git/tree/2e9ef8feae321d9a8463c816a356eb73d789b6c7 The branch, tlsa/gif-api has been updated discards e142609e3b1c059ccfd09af5b02be2d59067 (commit) via 2e9ef8feae321d9a8463c816a356eb73d789b6c7 (commit) This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this: * -- * -- B -- O -- O -- O (e142609e3b1c059ccfd09af5b02be2d59067) \ N -- N -- N (2e9ef8feae321d9a8463c816a356eb73d789b6c7) When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B. Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2e9ef8feae321d9a8463c816a356eb73d789b6c7 commit 2e9ef8feae321d9a8463c816a356eb73d789b6c7 Author: Michael Drake Commit: Michael Drake GIF: Update to latest libnsgif API. diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c index e2a0ca5..0d4506a 100644 --- a/content/handlers/image/gif.c +++ b/content/handlers/image/gif.c @@ -34,7 +34,8 @@ #include #include #include -#include + +#include #include "utils/utils.h" #include "utils/messages.h" @@ -51,13 +52,31 @@ #include "image/image.h" #include "image/gif.h" -typedef struct nsgif_content { +typedef struct gif_content { struct content base; - struct gif_animation *gif; /**< GIF animation data */ - int current_frame; /**< current frame to display [0...(max-1)] */ -} nsgif_content; + nsgif_t *gif; /**< GIF animation data */ + uint32_t current_frame; /**< current frame to display [0...(max-1)] */ +} gif_content; + +static inline nserror gif__nsgif_error_to_ns(nsgif_error gif_res) +{ + nserror err; + + switch (gif_res) { + case NSGIF_OK: + err = NSERROR_OK; + break; + case NSGIF_ERR_OOM: + err = NSERROR_NOMEM; + break; + default: + err = NSERROR_GIF_ERROR; + break; + } + return err; +} /** * Callback for libnsgif; forwards the call to bitmap_create() @@ -66,44 +85,42 @@ typedef struct nsgif_content { * \param height width of image in pixels * \return an opaque struct bitmap, or NULL on memory exhaustion */ -static void *nsgif_bitmap_create(int width, int height) +static void *gif_bitmap_create(int width, int height) { return guit->bitmap->create(width, height, BITMAP_NEW); } - -static nserror nsgif_create_gif_data(nsgif_content *c) +static nserror gif_create_gif_data(gif_content *c) { - gif_bitmap_callback_vt gif_bitmap_callbacks = { - .bitmap_create = nsgif_bitmap_create, - .bitmap_destroy = guit->bitmap->destroy, - .bitmap_get_buffer = guit->bitmap->get_buffer, - .bitmap_set_opaque = guit->bitmap->set_opaque, - .bitmap_test_opaque = guit->bitmap->test_opaque, - .bitmap_modified = guit->bitmap->modified + nsgif_error gif_res; + const nsgif_bitmap_cb_vt gif_bitmap_callbacks = { + .create = gif_bitmap_create, + .destroy = guit->bitmap->destroy, + .get_buffer = guit->bitmap->get_buffer, + .set_opaque = guit->bitmap->set_opaque, + .test_opaque = guit->bitmap->test_opaque, + .modified = guit->bitmap->modified }; - /* Initialise our data structure */ - c->gif = calloc(sizeof(gif_animation), 1); - if (c->gif == NULL) { - content_broadcast_error(>base, NSERROR_NOMEM, NULL); - return NSERROR_NOMEM; + gif_res = nsgif_create(_bitmap_callbacks, >gif); + if (gif_res != NSGIF_OK) { + nserror err = gif__nsgif_error_to_ns(gif_res); + content_broadcast_error(>base, err, NULL); + return err; } - gif_create(c->gif, _bitmap_callbacks); + return NSERROR_OK; } - - -static nserror nsgif_create(const content_handler *handler, - lwc_string *imime_type, const struct http_parameter *params, +static nserror gif_create(const content_handler *handler, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char
libnsgif: branch master updated. release/0.2.1-152-g41d8bcf
Gitweb links: ...log http://git.netsurf-browser.org/libnsgif.git/shortlog/41d8bcf828af44c775454e46ce751f9ac1a3684e ...commit http://git.netsurf-browser.org/libnsgif.git/commit/41d8bcf828af44c775454e46ce751f9ac1a3684e ...tree http://git.netsurf-browser.org/libnsgif.git/tree/41d8bcf828af44c775454e46ce751f9ac1a3684e The branch, master has been updated via 41d8bcf828af44c775454e46ce751f9ac1a3684e (commit) via 7ee51c0f6025238640cfa55faa36cd73e12489c7 (commit) via a0025eda79e5f6b7f0ae23e7a85fd947dc847726 (commit) via bc358088b2b074f09e638f101d2a12b3632a0d73 (commit) via 4360a768898cc7a43715926e2e8040cb9748bead (commit) via c800fec625521c9cb791d69933c8084e390c2bd0 (commit) via ba2037410035d5b95e7458576654f8122ec581ac (commit) via 370c2a783b67350143c18a07463835887d2b1847 (commit) via 84a9edb126121cd145295e48a5f0a98de4aab708 (commit) via ff86c40667cdaa2a535c992f908ba15912d93d59 (commit) via a0b9fcb4fa4c53319726044c8278a551293af817 (commit) via dde30d3d4134c46439fb1984eeb88ac2d843fd60 (commit) via d7a746a7af4265825add1d6ecd44d0699c8d238d (commit) via f19985bde06da13b2a1396756b2c82300296f8c8 (commit) via aad22e646509b7393f89b77f59894fba52031b7c (commit) via 3fe60b931a6529a0196d3bf6374a3569c3e7daba (commit) via 45f97add7c916d68c1339245bd55643abda71822 (commit) via 9c08b7c139cb95be8b3fbf21c46c564bfaff8c56 (commit) via 88a078653a15d157b7c6f3ba57211f11f9121dab (commit) via 0526c55f20ee7480533567fad62ea00e6bf31786 (commit) via b5dfaef72b2e2725810320cd2cf703463b3e95e1 (commit) via aec9ee665b18e5929d9af192e13efb5105c52254 (commit) via fedd37d9ce70571f305c8c8e66fd9ec7d837585b (commit) via 87c9a0ce41757c9c0ff2f3f19054edfd8296ef31 (commit) via 2013c162af618e701ba4caf84fa304ac38c92501 (commit) via 958ea3a13e8d5ffd23f2540d7a0eb2926667a206 (commit) via 1e3f649e2b78bf936ac3ca83c0992b0cb9add327 (commit) via 4a384cb88b02fb086e1035971dd142115cf9b377 (commit) via abfffeaad949c9f47bb6058ee17e88c7092ffbe6 (commit) via 0823ded6d3858a4acaaaca57b2a4803a0a5884c8 (commit) via c9703eb11102d27e22f5f5119db111dd1b41f559 (commit) via d15788827c453a1103b926672b7cdb1f1a21f487 (commit) from 6d39a8f70009c43032d96da8ceb8934e6e67a159 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - --- Summary of changes: Makefile |4 +- README | 36 -- README.md | 116 include/libnsgif.h | 194 -- include/nsgif.h| 346 ++ src/Makefile |2 +- src/gif.c | 1766 src/libnsgif.c | 1461 --- test/Makefile |2 +- test/cli.c | 763 +++ test/cli.h | 94 +++ test/decode_gif.c | 243 test/nsgif.c | 301 + test/runtest.sh| 61 +- 14 files changed, 3421 insertions(+), 1968 deletions(-) delete mode 100644 README create mode 100644 README.md delete mode 100644 include/libnsgif.h create mode 100644 include/nsgif.h create mode 100644 src/gif.c delete mode 100644 src/libnsgif.c create mode 100644 test/cli.c create mode 100644 test/cli.h delete mode 100644 test/decode_gif.c create mode 100644 test/nsgif.c diff --git a/Makefile b/Makefile index c348e20..42aba3a 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ include $(NSSHARED)/makefiles/Makefile.tools TESTRUNNER = test/runtest.sh $(BUILDDIR) $(EXEEXT) # Toolchain flags -WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ +WARNFLAGS := -Wall -Wextra -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -pedantic # BeOS/Haiku standard library headers create warnings @@ -44,6 +44,6 @@ include $(NSBUILD)/Makefile.top # Extra installation rules I := /$(INCLUDEDIR) -INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libnsgif.h +INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/nsgif.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) diff --git a/README b/README deleted file mode 100644 index 498ee46..000 --- a/README +++ /dev/null @@ -1,36 +0,0 @@ -libnsgif - Decoding GIF files -= - -The functions provided by this library allow for efficient progressive -GIF decoding. Whilst the initialisation does not ensure that there is -sufficient image data to complete the entire frame, it does ensure -that the information provided is
libnsgif: branch tlsa/gif-api updated. release/0.2.1-152-g41d8bcf
Gitweb links: ...log http://git.netsurf-browser.org/libnsgif.git/shortlog/41d8bcf828af44c775454e46ce751f9ac1a3684e ...commit http://git.netsurf-browser.org/libnsgif.git/commit/41d8bcf828af44c775454e46ce751f9ac1a3684e ...tree http://git.netsurf-browser.org/libnsgif.git/tree/41d8bcf828af44c775454e46ce751f9ac1a3684e The branch, tlsa/gif-api has been updated discards 4a037e58acc229ba133e727b15b3fd3d1d3b0c5b (commit) discards 02b1c6de36df8f4cd0b1eea52dafbd8840756f95 (commit) discards c88d94dfa6b4bb17a2d9855feb686025d1eb5be7 (commit) discards fe85229b8eb2ec6a160e8dd8bf44a3d563b53c1e (commit) via 41d8bcf828af44c775454e46ce751f9ac1a3684e (commit) via 7ee51c0f6025238640cfa55faa36cd73e12489c7 (commit) via a0025eda79e5f6b7f0ae23e7a85fd947dc847726 (commit) via bc358088b2b074f09e638f101d2a12b3632a0d73 (commit) via 4360a768898cc7a43715926e2e8040cb9748bead (commit) via c800fec625521c9cb791d69933c8084e390c2bd0 (commit) via ba2037410035d5b95e7458576654f8122ec581ac (commit) This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this: * -- * -- B -- O -- O -- O (4a037e58acc229ba133e727b15b3fd3d1d3b0c5b) \ N -- N -- N (41d8bcf828af44c775454e46ce751f9ac1a3684e) When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B. Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=41d8bcf828af44c775454e46ce751f9ac1a3684e commit 41d8bcf828af44c775454e46ce751f9ac1a3684e Author: Michael Drake Commit: Michael Drake Docs: Update README for new API. diff --git a/README.md b/README.md index 498ee46..d821ac6 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,116 @@ -libnsgif - Decoding GIF files +LibNSGIF: NetSurf GIF decoder = -The functions provided by this library allow for efficient progressive -GIF decoding. Whilst the initialisation does not ensure that there is -sufficient image data to complete the entire frame, it does ensure -that the information provided is valid. Any subsequent attempts to -decode an initialised GIF are guaranteed to succeed, and any bytes of -the image not present are assumed to be totally transparent. - -To begin decoding a GIF, the 'gif' structure must be initialised with -the 'gif_data' and 'buffer_size' set to their initial values. The -'buffer_position' should initially be 0, and will be internally -updated as the decoding commences. The caller should then repeatedly -call gif_initialise() with the structure until the function returns 1, -or no more data is avaliable. - -Once the initialisation has begun, the decoder completes the variables -'frame_count' and 'frame_count_partial'. The former being the total -number of frames that have been successfully initialised, and the -latter being the number of frames that a partial amount of data is -available for. This assists the caller in managing the animation -whilst decoding is continuing. - -To decode a frame, the caller must use gif_decode_frame() which -updates the current 'frame_image' to reflect the desired frame. The -required 'disposal_method' is also updated to reflect how the frame -should be plotted. The caller must not assume that the current -'frame_image' will be valid between calls if initialisation is still -occuring, and should either always request that the frame is decoded -(no processing will occur if the 'decoded_frame' has not been -invalidated by initialisation) or perform the check itself. - -It should be noted that gif_finalise() should always be called, even -if no frames were initialised. Additionally, it is the responsibility -of the caller to free 'gif_data'. +LibNSGIF is a C library for decoding GIF format images and animations. +It is licenced under the MIT licence. + +This library aims to provide a simple API for robust decoding of GIF files. + +Details +--- + +The GIF source data is scanned prior to decoding, allowing for efficient +decoding. The scanning phase will scan currently available data and will +resume from where it left off when called with additional data. + +Only one frame is ever fully decoded to a bitmap at a time, reducing memory +usage for large GIFs. + +Using +- + +LibNSGIF allows the client to allocate the bitmap into which the GIF is +decoded. The client can have an arbitrary bitmap structure, that is simply +a void pointer to LibNSGIF. The client must provide a callback table for +interacting with bitmaps. This table
netsurf: branch master updated. release/3.10-159-g2e9ef8f
Gitweb links: ...log http://git.netsurf-browser.org/netsurf.git/shortlog/2e9ef8feae321d9a8463c816a356eb73d789b6c7 ...commit http://git.netsurf-browser.org/netsurf.git/commit/2e9ef8feae321d9a8463c816a356eb73d789b6c7 ...tree http://git.netsurf-browser.org/netsurf.git/tree/2e9ef8feae321d9a8463c816a356eb73d789b6c7 The branch, master has been updated via 2e9ef8feae321d9a8463c816a356eb73d789b6c7 (commit) from d92b2696295e18146ff5c8fd15bc6ea198749f28 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - --- Summary of changes: content/handlers/image/gif.c | 366 ++ 1 file changed, 160 insertions(+), 206 deletions(-) diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c index e2a0ca5..0d4506a 100644 --- a/content/handlers/image/gif.c +++ b/content/handlers/image/gif.c @@ -34,7 +34,8 @@ #include #include #include -#include + +#include #include "utils/utils.h" #include "utils/messages.h" @@ -51,13 +52,31 @@ #include "image/image.h" #include "image/gif.h" -typedef struct nsgif_content { +typedef struct gif_content { struct content base; - struct gif_animation *gif; /**< GIF animation data */ - int current_frame; /**< current frame to display [0...(max-1)] */ -} nsgif_content; + nsgif_t *gif; /**< GIF animation data */ + uint32_t current_frame; /**< current frame to display [0...(max-1)] */ +} gif_content; + +static inline nserror gif__nsgif_error_to_ns(nsgif_error gif_res) +{ + nserror err; + + switch (gif_res) { + case NSGIF_OK: + err = NSERROR_OK; + break; + case NSGIF_ERR_OOM: + err = NSERROR_NOMEM; + break; + default: + err = NSERROR_GIF_ERROR; + break; + } + return err; +} /** * Callback for libnsgif; forwards the call to bitmap_create() @@ -66,44 +85,42 @@ typedef struct nsgif_content { * \param height width of image in pixels * \return an opaque struct bitmap, or NULL on memory exhaustion */ -static void *nsgif_bitmap_create(int width, int height) +static void *gif_bitmap_create(int width, int height) { return guit->bitmap->create(width, height, BITMAP_NEW); } - -static nserror nsgif_create_gif_data(nsgif_content *c) +static nserror gif_create_gif_data(gif_content *c) { - gif_bitmap_callback_vt gif_bitmap_callbacks = { - .bitmap_create = nsgif_bitmap_create, - .bitmap_destroy = guit->bitmap->destroy, - .bitmap_get_buffer = guit->bitmap->get_buffer, - .bitmap_set_opaque = guit->bitmap->set_opaque, - .bitmap_test_opaque = guit->bitmap->test_opaque, - .bitmap_modified = guit->bitmap->modified + nsgif_error gif_res; + const nsgif_bitmap_cb_vt gif_bitmap_callbacks = { + .create = gif_bitmap_create, + .destroy = guit->bitmap->destroy, + .get_buffer = guit->bitmap->get_buffer, + .set_opaque = guit->bitmap->set_opaque, + .test_opaque = guit->bitmap->test_opaque, + .modified = guit->bitmap->modified }; - /* Initialise our data structure */ - c->gif = calloc(sizeof(gif_animation), 1); - if (c->gif == NULL) { - content_broadcast_error(>base, NSERROR_NOMEM, NULL); - return NSERROR_NOMEM; + gif_res = nsgif_create(_bitmap_callbacks, >gif); + if (gif_res != NSGIF_OK) { + nserror err = gif__nsgif_error_to_ns(gif_res); + content_broadcast_error(>base, err, NULL); + return err; } - gif_create(c->gif, _bitmap_callbacks); + return NSERROR_OK; } - - -static nserror nsgif_create(const content_handler *handler, - lwc_string *imime_type, const struct http_parameter *params, +static nserror gif_create(const content_handler *handler, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) { - nsgif_content *result; + gif_content *result; nserror error; - result = calloc(1, sizeof(nsgif_content)); + result = calloc(1, sizeof(gif_content)); if (result == NULL) return NSERROR_NOMEM; @@ -114,7 +131,7 @@ static nserror nsgif_create(const content_handler *handler, return error; } - error = nsgif_create_gif_data(result); + error = gif_create_gif_data(result); if (error != NSERROR_OK) { free(result);
libnsgif: branch tlsa/gif-api deleted. release/0.2.1-152-g41d8bcf
Gitweb links: ...log http://git.netsurf-browser.org/libnsgif.git/shortlog/ ...commit http://git.netsurf-browser.org/libnsgif.git/commit/ ...tree http://git.netsurf-browser.org/libnsgif.git/tree/ The branch, tlsa/gif-api has been deleted was 41d8bcf828af44c775454e46ce751f9ac1a3684e --- 41d8bcf828af44c775454e46ce751f9ac1a3684e Docs: Update README for new API. --- -- NetSurf GIF Decoder ___ netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org
netsurf: branch tlsa/gif-api deleted. release/3.10-159-g2e9ef8f
Gitweb links: ...log http://git.netsurf-browser.org/netsurf.git/shortlog/ ...commit http://git.netsurf-browser.org/netsurf.git/commit/ ...tree http://git.netsurf-browser.org/netsurf.git/tree/ The branch, tlsa/gif-api has been deleted was 2e9ef8feae321d9a8463c816a356eb73d789b6c7 --- 2e9ef8feae321d9a8463c816a356eb73d789b6c7 GIF: Update to latest libnsgif API. --- -- NetSurf Browser ___ netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org