NetSurf
|
implementation of content handler for image/svg using librsvg. More...
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
#include <nsutils/endian.h>
#include "utils/log.h"
#include "utils/utils.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/rsvg.h"
Go to the source code of this file.
Data Structures | |
struct | rsvg_content |
Typedefs | |
typedef struct rsvg_content | rsvg_content |
Functions | |
static nserror | rsvg_create_svg_data (rsvg_content *c) |
static nserror | rsvg_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 bool | rsvg_process_data (struct content *c, const char *data, unsigned int size) |
static bool | rsvg_convert (struct content *c) |
static bool | rsvg_redraw (struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx) |
static void | rsvg_destroy (struct content *c) |
static nserror | rsvg_clone (const struct content *old, struct content **newc) |
static void * | rsvg_get_internal (const struct content *c, void *context) |
static content_type | rsvg_content_type (void) |
static bool | rsvg_content_is_opaque (struct content *c) |
CONTENT_FACTORY_REGISTER_TYPES (nsrsvg, rsvg_types, rsvg_content_handler) | |
Variables | |
static const content_handler | rsvg_content_handler |
static const char * | rsvg_types [] |
implementation of content handler for image/svg using librsvg.
SVG files are rendered to a NetSurf bitmap by creating a Cairo rendering surface (content_rsvg_data.cs) over the bitmap's data, creating a Cairo drawing context using that surface, and then passing that drawing context to librsvg which then uses Cairo calls to plot the graphic to the bitmap. We store this in content->bitmap, and then use the usual bitmap plotter function to render it for redraw requests.
Definition in file rsvg.c.
typedef struct rsvg_content rsvg_content |
CONTENT_FACTORY_REGISTER_TYPES | ( | nsrsvg | , |
rsvg_types | , | ||
rsvg_content_handler | |||
) |
Definition at line 228 of file rsvg.c.
References rsvg_content::base, content__clone(), content__get_source_data(), content_destroy(), CONTENT_STATUS_DONE, CONTENT_STATUS_READY, NSERROR_CLONE_FAILED, NSERROR_NOMEM, NSERROR_OK, rsvg_convert(), rsvg_create_svg_data(), rsvg_process_data(), content::size, and content::status.
|
static |
Definition at line 286 of file rsvg.c.
References rsvg_content::bitmap, netsurf_table::bitmap, gui_bitmap_table::get_opaque, and guit.
|
static |
Definition at line 280 of file rsvg.c.
References CONTENT_IMAGE.
|
static |
Definition at line 132 of file rsvg.c.
References rsvg_content::bitmap, netsurf_table::bitmap, bitmap_format_to_client(), BITMAP_NONE, content_broadcast_error(), content_set_done(), content_set_ready(), content_set_status(), gui_bitmap_table::create, rsvg_content::cs, rsvg_content::ct, gui_bitmap_table::get_buffer, gui_bitmap_table::get_rowstride, guit, content::height, gui_bitmap_table::modified, NSERROR_NOMEM, NSERROR_SVG_ERROR, NSLOG, rsvg_content::rsvgh, and content::width.
Referenced by rsvg_clone().
|
static |
Definition at line 84 of file rsvg.c.
References rsvg_content::base, content__init(), llcache, NSERROR_NOMEM, NSERROR_OK, and rsvg_create_svg_data().
|
static |
Definition at line 67 of file rsvg.c.
References rsvg_content::base, rsvg_content::bitmap, content_broadcast_error(), rsvg_content::cs, rsvg_content::ct, NSERROR_NOMEM, NSERROR_OK, NSLOG, and rsvg_content::rsvgh.
Referenced by rsvg_clone(), and rsvg_create().
|
static |
Definition at line 216 of file rsvg.c.
References rsvg_content::bitmap, netsurf_table::bitmap, rsvg_content::cs, rsvg_content::ct, gui_bitmap_table::destroy, guit, and rsvg_content::rsvgh.
|
static |
Definition at line 273 of file rsvg.c.
References rsvg_content::bitmap.
|
static |
Definition at line 115 of file rsvg.c.
References content_broadcast_error(), NSERROR_SVG_ERROR, NSLOG, rsvg_content::rsvgh, and content::size.
Referenced by rsvg_clone().
|
static |
Definition at line 195 of file rsvg.c.
References content_redraw_data::background_colour, rsvg_content::bitmap, plotter_table::bitmap, BITMAPF_NONE, BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, content_redraw_data::height, NSERROR_OK, redraw_context::plot, content_redraw_data::repeat_x, content_redraw_data::repeat_y, content_redraw_data::width, content_redraw_data::x, and content_redraw_data::y.
|
static |