svg: Handle errors for additional tiles gracefully
Some SVGs run into issues when zooming in due to memory limitations. These errors are now ignored and the existing tiles are used. Issue #358
This commit is contained in:
parent
9feef50c01
commit
c3547f82fc
4 changed files with 43 additions and 24 deletions
|
|
@ -71,6 +71,7 @@ impl Svg {
|
|||
updater.clone().spawn_error_handled(async move {
|
||||
log::trace!("Setting up SVG loader");
|
||||
let mut loader = glycin::Loader::new(file);
|
||||
loader.sandbox_selector(glycin::SandboxSelector::FlatpakSpawn);
|
||||
|
||||
loader.cancellable(cancellable.clone());
|
||||
|
||||
|
|
@ -135,14 +136,19 @@ impl Svg {
|
|||
area.height() as u32,
|
||||
);
|
||||
|
||||
let frame = image.specific_frame(frame_request).await?;
|
||||
match image.specific_frame(frame_request).await {
|
||||
Ok(frame) => {
|
||||
let position = (
|
||||
tile_instructions.area.x() as u32,
|
||||
tile_instructions.area.y() as u32,
|
||||
);
|
||||
|
||||
let position = (
|
||||
tile_instructions.area.x() as u32,
|
||||
tile_instructions.area.y() as u32,
|
||||
);
|
||||
|
||||
tiles.push_tile(tiling, position, frame.texture());
|
||||
tiles.push_tile(tiling, position, frame.texture());
|
||||
}
|
||||
Err(err) => {
|
||||
updater.send_error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue