NetSurf
|
implementation of content handler for image/svg using librsvg 2.46 API. More...
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <librsvg/rsvg.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/image_cache.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 (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 struct bitmap * | rsvg_cache_convert (struct content *c) |
create a bitmap from jpeg content for the image cache. More... | |
static void | rsvg__get_demensions (const rsvg_content *svgc, int *width, int *height) |
static bool | rsvg_convert (struct content *c) |
static nserror | rsvg_clone (const struct content *old, struct content **newc) |
static void | rsvg_destroy (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 2.46 API.
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 rsvg246.c.
typedef struct rsvg_content rsvg_content |
CONTENT_FACTORY_REGISTER_TYPES | ( | nsrsvg | , |
rsvg_types | , | ||
rsvg_content_handler | |||
) |
|
static |
Definition at line 147 of file rsvg246.c.
References height, NSLOG, rsvg_content::rsvgh, and width.
Referenced by rsvg_convert().
create a bitmap from jpeg content for the image cache.
Definition at line 98 of file rsvg246.c.
References netsurf_table::bitmap, bitmap(), bitmap_format_to_client(), BITMAP_LAYOUT_ARGB8888, BITMAP_NONE, gui_bitmap_table::create, gui_bitmap_table::destroy, gui_bitmap_table::get_buffer, gui_bitmap_table::get_rowstride, guit, content::height, gui_bitmap_table::modified, NSLOG, rsvg_content::rsvgh, and content::width.
Referenced by rsvg_convert().
Definition at line 220 of file rsvg246.c.
References rsvg_content::base, content__clone(), content_destroy(), CONTENT_STATUS_DONE, CONTENT_STATUS_READY, NSERROR_CLONE_FAILED, NSERROR_NOMEM, NSERROR_OK, rsvg_convert(), and content::status.
|
static |
Definition at line 182 of file rsvg246.c.
References content__get_source_data(), content_set_done(), content_set_ready(), content_set_status(), content::height, image_cache_add(), NSLOG, rsvg__get_demensions(), rsvg_cache_convert(), rsvg_content::rsvgh, content::size, bitmap::size, and content::width.
Referenced by rsvg_clone().
|
static |
Definition at line 66 of file rsvg246.c.
References rsvg_content::base, content__init(), content::fallback_charset, content::handler, llcache, NSERROR_NOMEM, NSERROR_OK, and content::quirks.
|
static |
Definition at line 250 of file rsvg246.c.
References image_cache_destroy(), and rsvg_content::rsvgh.
|
static |