Rename and export rsvg_drawing_ctx_add_clipping_rect() to Rust

parent c73e5412
......@@ -2375,7 +2375,7 @@ rsvg_get_end_marker (RsvgDrawingCtx *ctx)
}
void
rsvg_add_clipping_rect (RsvgDrawingCtx * ctx, double x, double y, double w, double h)
rsvg_drawing_ctx_add_clipping_rect (RsvgDrawingCtx * ctx, double x, double y, double w, double h)
{
ctx->render->add_clipping_rect (ctx, x, y, w, h);
}
......
......@@ -147,7 +147,7 @@ rsvg_node_image_draw (RsvgNode *node, gpointer impl, RsvgDrawingCtx *ctx, int do
rsvg_push_discrete_layer (ctx);
if (!rsvg_current_state (ctx)->overflow && (aspect_ratio & RSVG_ASPECT_RATIO_SLICE)) {
rsvg_add_clipping_rect (ctx, x, y, w, h);
rsvg_drawing_ctx_add_clipping_rect (ctx, x, y, w, h);
}
rsvg_aspect_ratio_compute (aspect_ratio,
......
......@@ -194,12 +194,12 @@ rsvg_marker_render (const char * marker_name, gdouble xpos, gdouble ypos, gdoubl
if (!state->overflow) {
if (self->vbox.active)
rsvg_add_clipping_rect (ctx, self->vbox.rect.x, self->vbox.rect.y,
self->vbox.rect.width, self->vbox.rect.height);
rsvg_drawing_ctx_add_clipping_rect (ctx, self->vbox.rect.x, self->vbox.rect.y,
self->vbox.rect.width, self->vbox.rect.height);
else
rsvg_add_clipping_rect (ctx, 0, 0,
rsvg_length_normalize (&self->width, ctx),
rsvg_length_normalize (&self->height, ctx));
rsvg_drawing_ctx_add_clipping_rect (ctx, 0, 0,
rsvg_length_normalize (&self->width, ctx),
rsvg_length_normalize (&self->height, ctx));
}
rsvg_node_foreach_child (node, draw_child, ctx);
......
......@@ -467,7 +467,7 @@ const char *rsvg_get_end_marker (RsvgDrawingCtx *ctx);
G_GNUC_INTERNAL
void rsvg_render_free (RsvgRender * render);
G_GNUC_INTERNAL
void rsvg_add_clipping_rect (RsvgDrawingCtx * ctx, double x, double y, double w, double h);
void rsvg_drawing_ctx_add_clipping_rect (RsvgDrawingCtx * ctx, double x, double y, double w, double h);
G_GNUC_INTERNAL
cairo_surface_t *rsvg_cairo_surface_from_pixbuf (const GdkPixbuf *pixbuf);
G_GNUC_INTERNAL
......
......@@ -196,7 +196,7 @@ rsvg_node_svg_draw (RsvgNode *node, gpointer impl, RsvgDrawingCtx *ctx, int domi
if (!state->overflow && parent) {
state->affine = affine_old;
rsvg_add_clipping_rect (ctx, nx, ny, nw, nh);
rsvg_drawing_ctx_add_clipping_rect (ctx, nx, ny, nw, nh);
state->affine = affine_new;
}
......@@ -373,8 +373,8 @@ rsvg_node_use_draw (RsvgNode *node, gpointer impl, RsvgDrawingCtx *ctx, int domi
rsvg_drawing_ctx_push_view_box (ctx, symbol->vbox.rect.width, symbol->vbox.rect.height);
rsvg_push_discrete_layer (ctx);
if (!state->overflow || (!state->has_overflow && rsvg_node_get_state (child)->overflow))
rsvg_add_clipping_rect (ctx, symbol->vbox.rect.x, symbol->vbox.rect.y,
symbol->vbox.rect.width, symbol->vbox.rect.height);
rsvg_drawing_ctx_add_clipping_rect (ctx, symbol->vbox.rect.x, symbol->vbox.rect.y,
symbol->vbox.rect.width, symbol->vbox.rect.height);
} else {
cairo_matrix_init_translate (&affine, x, y);
cairo_matrix_multiply (&state->affine, &affine, &state->affine);
......
......@@ -39,7 +39,18 @@ extern "C" {
fn rsvg_drawing_ctx_set_current_state_affine (draw_ctx: *const RsvgDrawingCtx,
affine: *const cairo::Matrix);
fn rsvg_drawing_ctx_add_clipping_rect (draw_ctx: *const RsvgDrawingCtx,
x: f64,
y: f64,
w: f64,
h: f64);
fn rsvg_current_state (draw_ctx: *const RsvgDrawingCtx) -> *mut RsvgState;
fn rsvg_state_new () -> *mut RsvgState;
fn rsvg_state_reinit (state: *mut RsvgState);
fn rsvg_state_reconstruct (state: *mut RsvgState, node: *const RsvgNode);
fn rsvg_state_is_overflow (state: *const RsvgState) -> bool;
fn rsvg_state_push (draw_ctx: *const RsvgDrawingCtx);
fn rsvg_state_pop (draw_ctx: *const RsvgDrawingCtx);
......@@ -47,6 +58,9 @@ extern "C" {
state: *mut RsvgState,
dominate: libc::c_int);
fn rsvg_push_discrete_layer (draw_ctx: *const RsvgDrawingCtx);
fn rsvg_pop_discrete_layer (draw_ctx: *const RsvgDrawingCtx);
fn rsvg_render_path_builder (draw_ctx: *const RsvgDrawingCtx,
builder: *const RsvgPathBuilder);
......@@ -106,6 +120,14 @@ pub fn state_reinherit_top (draw_ctx: *const RsvgDrawingCtx,
unsafe { rsvg_state_reinherit_top (draw_ctx, state, dominate); }
}
pub fn push_discrete_layer (draw_ctx: *const RsvgDrawingCtx) {
unsafe { rsvg_push_discrete_layer (draw_ctx); }
}
pub fn pop_discrete_layer (draw_ctx: *const RsvgDrawingCtx) {
unsafe { rsvg_pop_discrete_layer (draw_ctx); }
}
pub fn render_path_builder (draw_ctx: *const RsvgDrawingCtx,
builder: &RsvgPathBuilder) {
unsafe { rsvg_render_path_builder (draw_ctx, builder); }
......@@ -141,10 +163,34 @@ pub fn set_current_state_affine (draw_ctx: *const RsvgDrawingCtx, affine: cairo:
}
}
pub fn add_clipping_rect (draw_ctx: *const RsvgDrawingCtx,
x: f64,
y: f64,
w: f64,
h: f64) {
unsafe { rsvg_drawing_ctx_add_clipping_rect (draw_ctx, x, y, w, h); }
}
pub fn get_current_state (draw_ctx: *const RsvgDrawingCtx) -> *mut RsvgState {
unsafe { rsvg_current_state (draw_ctx) }
}
pub fn state_new () -> *mut RsvgState {
unsafe { rsvg_state_new () }
}
pub fn state_reinit (state: *mut RsvgState) {
unsafe { rsvg_state_reinit (state); }
}
pub fn state_reconstruct (state: *mut RsvgState, node: *const RsvgNode) {
unsafe { rsvg_state_reconstruct (state, node); }
}
pub fn state_is_overflow (state: *const RsvgState) -> bool {
unsafe { rsvg_state_is_overflow (state) }
}
pub fn state_push (draw_ctx: *const RsvgDrawingCtx) {
unsafe {
rsvg_state_push (draw_ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment