[librsvg] Use the cr.path_extents() from gtk-rs, not an unsafe call.



commit 54b710cb269258589f69929d789c83496baec4d0
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Oct 3 09:03:25 2019 -0500

    Use the cr.path_extents() from gtk-rs, not an unsafe call.

 rsvg_internals/src/drawing_ctx.rs | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index b2c0c4af..0a8acbb9 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -1,6 +1,4 @@
 use cairo;
-use cairo_sys;
-use glib::translate::*;
 use std::cell::RefCell;
 use std::convert::TryFrom;
 use std::rc::{Rc, Weak};
@@ -975,7 +973,7 @@ fn compute_stroke_and_fill_box(cr: &cairo::Context, values: &ComputedValues) ->
 
     // objectBoundingBox
 
-    let ob = BoundingBox::new(&affine).with_extents(path_extents(cr));
+    let ob = BoundingBox::new(&affine).with_extents(cr.path_extents());
     bbox.insert(&ob);
 
     // restore tolerance
@@ -985,19 +983,6 @@ fn compute_stroke_and_fill_box(cr: &cairo::Context, values: &ComputedValues) ->
     bbox
 }
 
-// remove this binding once cairo-rs has Context::path_extents()
-fn path_extents(cr: &cairo::Context) -> (f64, f64, f64, f64) {
-    let mut x1: f64 = 0.0;
-    let mut y1: f64 = 0.0;
-    let mut x2: f64 = 0.0;
-    let mut y2: f64 = 0.0;
-
-    unsafe {
-        cairo_sys::cairo_path_extents(cr.to_glib_none().0, &mut x1, &mut y1, &mut x2, &mut y2);
-    }
-    (x1, y1, x2, y2)
-}
-
 impl From<StrokeLinejoin> for cairo::LineJoin {
     fn from(j: StrokeLinejoin) -> cairo::LineJoin {
         match j {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]