[librsvg] draw_in_viewport(): Take in a clip_before_layer_push argument
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] draw_in_viewport(): Take in a clip_before_layer_push argument
- Date: Wed, 27 Sep 2017 16:43:56 +0000 (UTC)
commit c658b84f04df09825a11ef78084b42d404536536
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Sep 27 10:58:49 2017 -0500
draw_in_viewport(): Take in a clip_before_layer_push argument
I'm not sure if this is because adding the clip rect before pushing a
layer is different from pushing after, *OR* if it is because the clip
should be set from the vbox (when it exists) vs. setting it from the
viewport area.
rust/src/structure.rs | 1 +
rust/src/viewport.rs | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/rust/src/structure.rs b/rust/src/structure.rs
index 523e935..d8b7355 100644
--- a/rust/src/structure.rs
+++ b/rust/src/structure.rs
@@ -176,6 +176,7 @@ impl NodeTrait for NodeSvg {
let do_clip = !drawing_ctx::state_is_overflow (state) && node.get_parent ().is_some ();
draw_in_viewport(nx, ny, nw, nh,
+ false,
do_clip,
self.vbox.get(),
self.preserve_aspect_ratio.get(),
diff --git a/rust/src/viewport.rs b/rust/src/viewport.rs
index 63ef312..86113f1 100644
--- a/rust/src/viewport.rs
+++ b/rust/src/viewport.rs
@@ -8,6 +8,7 @@ use util::*;
use viewbox::*;
pub fn draw_in_viewport<F>(vx: f64, vy: f64, vw: f64, vh: f64,
+ clip_before_layer_push: bool,
do_clip: bool,
vbox: Option<ViewBox>,
preserve_aspect_ratio: AspectRatio,
@@ -40,6 +41,10 @@ pub fn draw_in_viewport<F>(vx: f64, vy: f64, vw: f64, vh: f64,
affine.translate(-vbox.0.x, -vbox.0.y);
vbox_size = (vbox.0.width, vbox.0.height);
+
+ if clip_before_layer_push && do_clip {
+ drawing_ctx::add_clipping_rect(draw_ctx, vbox.0.x, vbox.0.y, vbox.0.width, vbox.0.height);
+ }
} else {
affine.translate(vx, vy);
vbox_size = (vw, vh);
@@ -48,7 +53,7 @@ pub fn draw_in_viewport<F>(vx: f64, vy: f64, vw: f64, vh: f64,
drawing_ctx::push_view_box(draw_ctx, vbox_size.0, vbox_size.1);
drawing_ctx::push_discrete_layer(draw_ctx);
- if do_clip {
+ if !clip_before_layer_push && do_clip {
drawing_ctx::add_clipping_rect(draw_ctx, vx, vy, vw, vh);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]