38#include <nsutils/assert.h>
114 const nsgif_bitmap_cb_vt gif_bitmap_callbacks = {
123 gif_res = nsgif_create(&gif_bitmap_callbacks,
125 if (gif_res != NSGIF_OK) {
183 gif_res = nsgif_frame_prepare(gif->
gif, &
rect, &delay, &f);
184 if (gif_res != NSGIF_OK) {
191 if (
nsoption_bool(animate_images) && delay != NSGIF_INFINITE) {
220 const nsgif_info_t *gif_info;
231 gif_err = nsgif_data_scan(gif->
gif, size, data);
232 if (gif_err != NSGIF_OK) {
233 NSLOG(netsurf, INFO,
"nsgif scan: %s", nsgif_strerror(gif_err));
237 nsgif_data_complete(gif->
gif);
239 gif_info = nsgif_get_info(gif->
gif);
240 assert(gif_info != NULL);
243 if (gif_info->frame_count == 0) {
247 }
else if (gif_info->width == 0 || gif_info->height == 0) {
254 c->
width = gif_info->width;
255 c->
height = gif_info->height;
256 c->
size += (gif_info->width * gif_info->height * 4) + 16 + 44;
296 return nsgif_frame_decode(gif->
gif, current_frame,
bitmap);
318 nsgif_destroy(gif->
gif);
351 *newc = (
struct content *) gif;
362 if (gif->
gif == NULL)
return;
366 if (nsgif_reset(gif->
gif) == NSGIF_OK) {
Content handling interface.
bool image_bitmap_plot(struct bitmap *bitmap, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
Common image content handler bitmap plot call.
Initialisation/finalisation of image handlers.
void content_destroy(struct content *c)
Destroy and free a content.
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
void content_set_done(struct content *c)
Put a content in status CONTENT_STATUS_DONE.
uint32_t content_count_users(struct content *c)
Count users for the content.
bool content__set_title(struct content *c, const char *title)
Set title associated with content.
nserror content__init(struct content *c, const content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks)
const uint8_t * content__get_source_data(struct content *c, size_t *size)
Retrieve source of content.
nserror content__clone(const struct content *c, struct content *nc)
Clone a content's data members.
void content_set_ready(struct content *c)
Put a content in status CONTENT_STATUS_READY and unlock the content.
void content_set_status(struct content *c, const char *status_message)
Updates content with new status.
void content_broadcast_error(struct content *c, nserror errorcode, const char *msg)
Send an error message to all users.
Protected interface to Content handling.
@ CONTENT_STATUS_READY
Some parts of content still being loaded, but can be displayed.
@ CONTENT_STATUS_DONE
Content has completed all processing.
content_type
The type of a content.
@ CONTENT_IMAGE
All images.
@ CONTENT_MSG_REDRAW
needs redraw (eg.
Internal core bitmap interface.
nserror
Enumeration of error codes.
@ NSERROR_GIF_ERROR
A GIF error occurred.
@ NSERROR_NOMEM
Memory exhaustion.
@ NSERROR_CLONE_FAILED
Failed to clone handle.
CONTENT_FACTORY_REGISTER_TYPES(nsgif, gif_types, gif_content_handler)
static const content_handler gif_content_handler
static void gif_remove_user(struct content *c)
static nserror gif__animate(gif_content *gif, bool redraw)
Performs any necessary animation.
static bool gif_convert(struct content *c)
static void * gif_bitmap_create(int width, int height)
Callback for libnsgif; forwards the call to bitmap_create()
static content_type gif_content_type(void)
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_destroy(struct content *c)
static const char * gif_types[]
static void gif_animate_cb(void *p)
Scheduler callback.
struct gif_content gif_content
static nsgif_bitmap_t * gif_get_bitmap(const struct content *c, void *context)
static void gif_add_user(struct content *c)
static nserror gif_create_gif_data(gif_content *c)
static nsgif_error gif_get_frame(gif_content *gif, nsgif_bitmap_t **bitmap)
Updates the GIF bitmap to display the current frame.
static nserror gif__nsgif_error_to_ns(nsgif_error gif_res)
static bool gif_redraw(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
static bool gif_content_is_opaque(struct content *c)
static nsgif_bitmap_fmt_t nsgif__get_bitmap_format(void)
Convert client bitmap format to a LibNSGIF format specifier.
static nserror gif_clone(const struct content *old, struct content **newc)
Content for image/gif (interface).
struct netsurf_table * guit
The global interface table.
Interface to core interface table.
Generic bitmap handling interface.
bool bitmap_test_opaque(void *bitmap)
Test whether a bitmap is completely opaque (no transparency).
@ BITMAP_LAYOUT_ABGR8888
32-bit BGRA (0xAABBGGRR).
@ BITMAP_LAYOUT_BGRA8888
32-bit BGRA (0xBBGGRRAA).
@ BITMAP_LAYOUT_ARGB8888
32-bit ARGB (0xAARRGGBB).
@ BITMAP_LAYOUT_B8G8R8A8
Bite-wise BGRA: Byte order: 0xBB, 0xGG, 0xRR, 0xAA.
@ BITMAP_LAYOUT_R8G8B8A8
Bite-wise RGBA: Byte order: 0xRR, 0xGG, 0xBB, 0xAA.
@ BITMAP_LAYOUT_A8B8G8R8
Bite-wise ABGR: Byte order: 0xAA, 0xBB, 0xGG, 0xRR.
@ BITMAP_LAYOUT_A8R8G8B8
Bite-wise ARGB: Byte order: 0xAA, 0xRR, 0xGG, 0xBB.
@ BITMAP_LAYOUT_RGBA8888
32-bit RGBA (0xRRGGBBAA).
Public content interface.
Interface to platform-specific miscellaneous browser operation table.
static struct llcache_s * llcache
low level cache state
nsurl * llcache_handle_get_url(const llcache_handle *handle)
Retrieve the post-redirect URL of a low-level cache object.
Low-level resource cache (interface)
#define NSLOG(catname, level, logmsg, args...)
char * messages_get_buff(const char *key,...)
Formatted message from a key in the global message hash.
Localised message support (interface).
const char * nsurl_access_leaf(const nsurl *url)
Access a URL's path leaf as a string.
Interface to utility string handling.
enum bitmap_layout layout
Colour component layout.
RISC OS wimp toolkit bitmap.
Content operation function table.
nserror(* create)(const struct content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, struct llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c)
parameters to content redraw
Content which corresponds to a single URL.
bool quirks
Content is in quirks mode.
int height
Height dimension, if applicable.
char * fallback_charset
Fallback charset, or NULL.
int width
Width dimension, if applicable.
const struct content_handler * handler
Handler for content.
struct llcache_handle * llcache
Low-level cache object.
struct textsearch_context * context
content_status status
Current status.
unsigned int size
Estimated size of all data associated with this content.
nsgif_t * gif
GIF animation data.
uint32_t current_frame
current frame to display [0...(max-1)]
void(* set_opaque)(void *bitmap, bool opaque)
Set the opacity of a bitmap.
void(* destroy)(void *bitmap)
Destroy a bitmap.
void *(* create)(int width, int height, enum gui_bitmap_flags flags)
Create a new bitmap.
bool(* get_opaque)(void *bitmap)
Get the opacity of a bitmap.
void(* modified)(void *bitmap)
Marks a bitmap as modified.
unsigned char *(* get_buffer)(void *bitmap)
Get the image buffer from a bitmap.
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Representation of an HTTP parameter.
Handle to low-level cache object.
struct gui_misc_table * misc
Browser table.
struct gui_bitmap_table * bitmap
Bitmap table.
struct rect rect
Rectangle coordinates.
Extra data for some content_msg messages.
void * ctx
context passed to browser_window_search()
struct content_msg_data::@101 redraw
CONTENT_MSG_REDRAW - Area of content which needs redrawing.
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Interface to a number of general purpose functionality.
static nserror bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.