image: Limit SVG zoom to RSVG limits
See <https://gitlab.gnome.org/GNOME/librsvg/-/issues/938> for details about the problem. Closes #88
This commit is contained in:
parent
dfebfb7470
commit
a0ce234946
4 changed files with 38 additions and 12 deletions
|
|
@ -4,6 +4,6 @@ mod svg;
|
|||
|
||||
pub use heif::Heif;
|
||||
pub use image_rs_other::ImageRsOther;
|
||||
pub use svg::Svg;
|
||||
pub use svg::{Svg, RSVG_MAX_SIZE};
|
||||
|
||||
use super::{Decoder, UpdateSender};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ use gtk::prelude::*;
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Current librsvg limit on maximum dimensions. See
|
||||
/// <https://gitlab.gnome.org/GNOME/librsvg/-/issues/938>
|
||||
pub const RSVG_MAX_SIZE: u32 = 32_767;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Svg {
|
||||
thread_handle: std::thread::JoinHandle<()>,
|
||||
|
|
@ -106,9 +110,7 @@ impl Svg {
|
|||
tile_instructions.tiling.scaled_dimensions();
|
||||
|
||||
// librsvg does not currently support larger images
|
||||
//
|
||||
// TODO: We are only creating tiles, maybe this check in librsvg is wrong?
|
||||
if total_height > 32_767 || total_width > 32_767 {
|
||||
if total_height > RSVG_MAX_SIZE || total_width > RSVG_MAX_SIZE {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue