[librsvg/librsvg-2.48] Move the implementation of get_position_sub to c_api
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.48] Move the implementation of get_position_sub to c_api
- Date: Wed, 29 Apr 2020 18:05:57 +0000 (UTC)
commit 1ee309a918485352b59d34469fdd65154a36de92
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Apr 24 20:16:03 2020 -0500
Move the implementation of get_position_sub to c_api
librsvg/c_api.rs | 18 +++++++++++++++++-
rsvg_internals/src/handle.rs | 24 ------------------------
2 files changed, 17 insertions(+), 25 deletions(-)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 69613454..0061925d 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -722,8 +722,24 @@ impl CHandle {
fn get_position_sub(&self, id: Option<&str>) -> Result<RsvgPositionData, RenderingError> {
let handle = self.get_handle_ref()?;
let inner = self.inner.borrow();
+
+ if id.is_none() {
+ return Ok(RsvgPositionData { x: 0, y: 0 });
+ }
+
handle
- .get_position_sub(id, inner.dpi, &inner.size_callback, inner.is_testing)
+ .get_geometry_sub(id, inner.dpi, inner.is_testing)
+ .and_then(|(ink_r, _)| {
+ let width = ink_r.width().round() as libc::c_int;
+ let height = ink_r.height().round() as libc::c_int;
+
+ inner.size_callback.call(width, height);
+
+ Ok(RsvgPositionData {
+ x: ink_r.x0 as libc::c_int,
+ y: ink_r.y0 as libc::c_int,
+ })
+ })
.map_err(warn_on_invalid_id)
}
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index b9f96ea9..1e9dfbaf 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -217,30 +217,6 @@ impl Handle {
}
}
- pub fn get_position_sub(
- &self,
- id: Option<&str>,
- dpi: Dpi,
- size_callback: &SizeCallback,
- is_testing: bool,
- ) -> Result<RsvgPositionData, RenderingError> {
- if id.is_none() {
- return Ok(RsvgPositionData { x: 0, y: 0 });
- }
-
- let (ink_r, _) = self.get_geometry_sub(id, dpi, is_testing)?;
-
- let width = ink_r.width().round() as libc::c_int;
- let height = ink_r.height().round() as libc::c_int;
-
- size_callback.call(width, height);
-
- Ok(RsvgPositionData {
- x: ink_r.x0 as libc::c_int,
- y: ink_r.y0 as libc::c_int,
- })
- }
-
/// Returns (ink_rect, logical_rect)
fn get_node_geometry_with_viewport(
&self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]