NetSurf
|
Content for image/gif implementation. More...
#include <assert.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <nsutils/assert.h>
#include <nsgif.h>
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "netsurf/misc.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "content/llcache.h"
#include "content/content.h"
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
#include "desktop/bitmap.h"
#include "image/image.h"
#include "image/gif.h"
Go to the source code of this file.
Data Structures | |
struct | gif_content |
Typedefs | |
typedef struct gif_content | gif_content |
Functions | |
static nserror | gif__nsgif_error_to_ns (nsgif_error gif_res) |
static void * | gif_bitmap_create (int width, int height) |
Callback for libnsgif; forwards the call to bitmap_create() More... | |
static nsgif_bitmap_fmt_t | nsgif__get_bitmap_format (void) |
Convert client bitmap format to a LibNSGIF format specifier. More... | |
static nserror | gif_create_gif_data (gif_content *c) |
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) |
static void | gif_animate_cb (void *p) |
Scheduler callback. More... | |
static nserror | gif__animate (gif_content *gif, bool redraw) |
Performs any necessary animation. More... | |
static bool | gif_convert (struct content *c) |
static nsgif_error | gif_get_frame (gif_content *gif, nsgif_bitmap_t **bitmap) |
Updates the GIF bitmap to display the current frame. More... | |
static bool | gif_redraw (struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx) |
static void | gif_destroy (struct content *c) |
static nserror | gif_clone (const struct content *old, struct content **newc) |
static void | gif_add_user (struct content *c) |
static void | gif_remove_user (struct content *c) |
static nsgif_bitmap_t * | gif_get_bitmap (const struct content *c, void *context) |
static content_type | gif_content_type (void) |
static bool | gif_content_is_opaque (struct content *c) |
CONTENT_FACTORY_REGISTER_TYPES (nsgif, gif_types, gif_content_handler) | |
Variables | |
static const content_handler | gif_content_handler |
static const char * | gif_types [] |
Content for image/gif implementation.
All GIFs are dynamically decompressed using the routines that gifread.c provides. Whilst this allows support for progressive decoding, it is not implemented here as NetSurf currently does not provide such support.
[rjw] - Sun 4th April 2004
Definition in file gif.c.
typedef struct gif_content gif_content |
CONTENT_FACTORY_REGISTER_TYPES | ( | nsgif | , |
gif_types | , | ||
gif_content_handler | |||
) |
|
static |
Performs any necessary animation.
p | The content to animate |
Definition at line 176 of file gif.c.
References gif_content::base, content_broadcast(), CONTENT_MSG_REDRAW, gif_content::current_frame, gif_content::gif, gif__nsgif_error_to_ns(), gif_animate_cb(), guit, content_msg_data::height, netsurf_table::misc, NSERROR_OK, nsoption_bool, content_msg_data::redraw, gui_misc_table::schedule, content_msg_data::width, content_msg_data::x, rect::x0, rect::x1, content_msg_data::y, rect::y0, and rect::y1.
Referenced by gif_add_user(), gif_animate_cb(), and gif_convert().
|
inlinestatic |
Definition at line 66 of file gif.c.
References NSERROR_GIF_ERROR, and NSERROR_NOMEM.
Referenced by gif__animate(), gif_convert(), and gif_create_gif_data().
|
static |
Definition at line 356 of file gif.c.
References content_count_users(), gif_content::gif, and gif__animate().
|
static |
Scheduler callback.
Performs any necessary animation.
p | The content to animate |
Definition at line 210 of file gif.c.
References gif__animate().
Referenced by gif__animate(), gif_destroy(), and gif_remove_user().
|
static |
Callback for libnsgif; forwards the call to bitmap_create()
width | width of image in pixels |
height | width of image in pixels |
Definition at line 89 of file gif.c.
References netsurf_table::bitmap, BITMAP_NONE, gui_bitmap_table::create, guit, height, and width.
Referenced by gif_create_gif_data().
Definition at line 321 of file gif.c.
References gif_content::base, content__clone(), content_destroy(), CONTENT_STATUS_DONE, CONTENT_STATUS_READY, gif_convert(), gif_create_gif_data(), NSERROR_CLONE_FAILED, NSERROR_NOMEM, NSERROR_OK, and content::status.
|
static |
Definition at line 398 of file gif.c.
References netsurf_table::bitmap, bitmap(), gui_bitmap_table::get_opaque, gif_get_frame(), and guit.
|
static |
Definition at line 393 of file gif.c.
References CONTENT_IMAGE.
|
static |
Definition at line 217 of file gif.c.
References content__get_source_data(), content__set_title(), content_broadcast_error(), content_set_done(), content_set_ready(), content_set_status(), gif_content::gif, gif__animate(), gif__nsgif_error_to_ns(), content::height, content::llcache, llcache_handle_get_url(), messages_get_buff(), NSERROR_GIF_ERROR, NSERROR_OK, NSLOG, nsurl_access_leaf(), content::size, content_msg_data::title, and content::width.
Referenced by gif_clone().
|
static |
Definition at line 134 of file gif.c.
References content__init(), content::fallback_charset, gif_create_gif_data(), content::handler, llcache, NSERROR_NOMEM, NSERROR_OK, content::quirks, and result.
|
static |
Definition at line 111 of file gif.c.
References gif_content::base, netsurf_table::bitmap, bitmap_test_opaque(), content_broadcast_error(), gui_bitmap_table::destroy, gui_bitmap_table::get_buffer, gif_content::gif, gif__nsgif_error_to_ns(), gif_bitmap_create(), guit, gui_bitmap_table::modified, NSERROR_OK, nsgif__get_bitmap_format(), and gui_bitmap_table::set_opaque.
Referenced by gif_clone(), and gif_create().
|
static |
Definition at line 312 of file gif.c.
References gif_content::gif, gif_animate_cb(), guit, netsurf_table::misc, and gui_misc_table::schedule.
|
static |
Definition at line 380 of file gif.c.
References bitmap(), and gif_get_frame().
|
static |
Updates the GIF bitmap to display the current frame.
gif | The gif context to update. |
Definition at line 288 of file gif.c.
References gif_content::current_frame, gif_content::gif, and nsoption_bool.
Referenced by gif_content_is_opaque(), gif_get_bitmap(), and gif_redraw().
|
static |
Definition at line 299 of file gif.c.
References bitmap(), clip(), content_msg_data::ctx, gif_get_frame(), and image_bitmap_plot().
|
static |
Definition at line 372 of file gif.c.
References content_count_users(), gif_animate_cb(), guit, netsurf_table::misc, and gui_misc_table::schedule.
|
static |
Convert client bitmap format to a LibNSGIF format specifier.
Definition at line 97 of file gif.c.
References BITMAP_LAYOUT_A8B8G8R8, BITMAP_LAYOUT_A8R8G8B8, BITMAP_LAYOUT_ABGR8888, BITMAP_LAYOUT_ARGB8888, BITMAP_LAYOUT_B8G8R8A8, BITMAP_LAYOUT_BGRA8888, BITMAP_LAYOUT_R8G8B8A8, BITMAP_LAYOUT_RGBA8888, and bitmap_fmt::layout.
Referenced by gif_create_gif_data().
|
static |