26 #include "librsvg-2.0/librsvg/rsvg.h"
43 RsvgDimensionData unscaled_dimensions, dimensions;
44 cairo_surface_t *image;
45 cairo_t *crender =
NULL;
57 rsvg_handle_get_dimensions(handle, &dimensions);
58 rsvg_handle_get_dimensions(handle, &unscaled_dimensions);
59 dimensions.width =
s->width ?
s->width : dimensions.width;
60 dimensions.height =
s->height ?
s->height : dimensions.height;
61 if (
s->keep_ar && (
s->width ||
s->height)) {
62 double default_ar = unscaled_dimensions.width/(
double)unscaled_dimensions.height;
64 dimensions.width =
lrintf(dimensions.height * default_ar);
66 dimensions.height =
lrintf(dimensions.width / default_ar);
78 image = cairo_image_surface_create_for_data(
frame->data[0], CAIRO_FORMAT_ARGB32,
81 if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS)
84 crender = cairo_create(image);
87 cairo_set_operator(crender, CAIRO_OPERATOR_CLEAR);
89 cairo_restore(crender);
91 cairo_scale(crender, dimensions.width / (
double)unscaled_dimensions.width,
92 dimensions.height / (
double)unscaled_dimensions.height);
94 rsvg_handle_render_cairo(handle, crender);
96 cairo_destroy(crender);
97 cairo_surface_destroy(image);
98 g_object_unref(handle);
105 #define OFFSET(x) offsetof(LibRSVGContext, x)
106 #define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
128 .p.wrapper_name =
"librsvg",