[librsvg/rustify-rsvg-convert] rsvg-convert: Extract function to compute the natural size of the requested input
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustify-rsvg-convert] rsvg-convert: Extract function to compute the natural size of the requested input
- Date: Mon, 25 Jan 2021 22:11:27 +0000 (UTC)
commit bde810bd093019e0a93225138a008c0bdc102d85
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jan 25 15:46:13 2021 -0600
rsvg-convert: Extract function to compute the natural size of the requested input
src/bin/rsvg-convert.rs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index db7f2c7a..6ce42c32 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -397,8 +397,8 @@ impl Converter {
};
}
- fn create_surface(&self, renderer: &CairoRenderer, input: &Input) -> Surface {
- let (natural_width, natural_height) = renderer
+ fn natural_size(&self, renderer: &CairoRenderer, input: &Input) -> (f64, f64) {
+ renderer
.legacy_layer_size(self.export_id.as_deref())
.unwrap_or_else(|e| match e {
RenderingError::IdNotFound => exit!(
@@ -407,7 +407,11 @@ impl Converter {
self.export_id.as_deref().unwrap()
),
_ => exit!("Error rendering SVG {}: {}", input, e),
- });
+ })
+ }
+
+ fn create_surface(&self, renderer: &CairoRenderer, input: &Input) -> Surface {
+ let (natural_width, natural_height) = self.natural_size(renderer, input);
let strategy = match (self.width, self.height) {
// when w and h are not specified, scale to the requested zoom (if any)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]