NetSurf
Data Structures | Macros | Typedefs | Functions | Variables
nssprite.c File Reference

librosprite implementation for content image/x-riscos-sprite More...

#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <librosprite.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "content/llcache.h"
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
#include "desktop/bitmap.h"
#include "image/nssprite.h"
Include dependency graph for nssprite.c:

Go to the source code of this file.

Data Structures

struct  nssprite_content
 

Macros

#define ERRCHK(x)
 

Typedefs

typedef struct nssprite_content nssprite_content
 

Functions

static nserror nssprite_create (const 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)
 
static bool nssprite_convert (struct content *c)
 Convert a CONTENT_SPRITE for display. More...
 
static void nssprite_destroy (struct content *c)
 Destroy a CONTENT_SPRITE and free all resources it owns. More...
 
static bool nssprite_redraw (struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
 Redraw a CONTENT_SPRITE. More...
 
static nserror nssprite_clone (const struct content *old, struct content **newc)
 
static void * nssprite_get_internal (const struct content *c, void *context)
 
static content_type nssprite_content_type (void)
 
static bool nssprite_content_is_opaque (struct content *c)
 
 CONTENT_FACTORY_REGISTER_TYPES (nssprite, nssprite_types, nssprite_content_handler)
 

Variables

static const content_handler nssprite_content_handler
 
static const char * nssprite_types []
 

Detailed Description

librosprite implementation for content image/x-riscos-sprite

Definition in file nssprite.c.

Macro Definition Documentation

◆ ERRCHK

#define ERRCHK (   x)
Value:
do { \
rosprite_error err = x; \
if (err == ROSPRITE_EOF) { \
NSLOG(netsurf, INFO, "Got ROSPRITE_EOF when loading sprite file"); \
goto ro_sprite_error; \
} else if (err == ROSPRITE_BADMODE) { \
NSLOG(netsurf, INFO, "Got ROSPRITE_BADMODE when loading sprite file"); \
goto ro_sprite_error; \
} else if (err == ROSPRITE_OK) { \
} else { \
goto ro_sprite_error; \
} \
} while(0)

Definition at line 52 of file nssprite.c.

Typedef Documentation

◆ nssprite_content

Function Documentation

◆ CONTENT_FACTORY_REGISTER_TYPES()

CONTENT_FACTORY_REGISTER_TYPES ( nssprite  ,
nssprite_types  ,
nssprite_content_handler   
)

◆ nssprite_clone()

static nserror nssprite_clone ( const struct content old,
struct content **  newc 
)
static

Definition at line 213 of file nssprite.c.

References nssprite_content::base, content__clone(), content_destroy(), CONTENT_STATUS_DONE, CONTENT_STATUS_READY, NSERROR_CLONE_FAILED, NSERROR_NOMEM, NSERROR_OK, nssprite_convert(), and content::status.

Here is the call graph for this function:

◆ nssprite_content_is_opaque()

static bool nssprite_content_is_opaque ( struct content c)
static

◆ nssprite_content_type()

static content_type nssprite_content_type ( void  )
static

Definition at line 249 of file nssprite.c.

References CONTENT_IMAGE.

◆ nssprite_convert()

static bool nssprite_convert ( struct content c)
static

Convert a CONTENT_SPRITE for display.

No conversion is necessary. We merely read the sprite dimensions.

Definition at line 99 of file nssprite.c.

References nssprite_content::bitmap, netsurf_table::bitmap, bitmap_format_to_client(), BITMAP_NONE, content__get_source_data(), content__set_title(), content_broadcast_error(), content_set_done(), content_set_ready(), content_set_status(), gui_bitmap_table::create, ERRCHK, gui_bitmap_table::get_buffer, guit, content::height, content::llcache, llcache_handle_get_url(), messages_get_buff(), gui_bitmap_table::modified, NSERROR_NOMEM, NSERROR_SPRITE_ERROR, nsurl_access_leaf(), nssprite_content::sprite_area, and content::width.

Referenced by nssprite_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nssprite_create()

static nserror nssprite_create ( const 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 
)
static

Definition at line 69 of file nssprite.c.

References nssprite_content::base, content__init(), llcache, NSERROR_NOMEM, and NSERROR_OK.

Here is the call graph for this function:

◆ nssprite_destroy()

static void nssprite_destroy ( struct content c)
static

Destroy a CONTENT_SPRITE and free all resources it owns.

Definition at line 173 of file nssprite.c.

References nssprite_content::bitmap, netsurf_table::bitmap, gui_bitmap_table::destroy, guit, and nssprite_content::sprite_area.

◆ nssprite_get_internal()

static void * nssprite_get_internal ( const struct content c,
void *  context 
)
static

Definition at line 242 of file nssprite.c.

References nssprite_content::bitmap.

◆ nssprite_redraw()

static bool nssprite_redraw ( struct content c,
struct content_redraw_data data,
const struct rect clip,
const struct redraw_context ctx 
)
static

Variable Documentation

◆ nssprite_content_handler

const content_handler nssprite_content_handler
static
Initial value:
= {
.create = nssprite_create,
.data_complete = nssprite_convert,
.destroy = nssprite_destroy,
.redraw = nssprite_redraw,
.clone = nssprite_clone,
.get_internal = nssprite_get_internal,
.no_share = false,
}
static bool nssprite_convert(struct content *c)
Convert a CONTENT_SPRITE for display.
Definition: nssprite.c:99
static void * nssprite_get_internal(const struct content *c, void *context)
Definition: nssprite.c:242
static nserror nssprite_clone(const struct content *old, struct content **newc)
Definition: nssprite.c:213
static bool nssprite_redraw(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
Redraw a CONTENT_SPRITE.
Definition: nssprite.c:189
static void nssprite_destroy(struct content *c)
Destroy a CONTENT_SPRITE and free all resources it owns.
Definition: nssprite.c:173
static nserror nssprite_create(const 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)
Definition: nssprite.c:69
static content_type nssprite_content_type(void)
Definition: nssprite.c:249
static bool nssprite_content_is_opaque(struct content *c)
Definition: nssprite.c:255

Definition at line 266 of file nssprite.c.

◆ nssprite_types

const char* nssprite_types[]
static
Initial value:
= {
"image/x-riscos-sprite"
}

Definition at line 278 of file nssprite.c.