Fix SVG renderer not playing animation due to a regression from the tile cache discarding the context (#4092)

This commit is contained in:
Keavon Chambers 2026-05-01 20:32:53 -07:00 committed by GitHub
parent 485bac89e5
commit 9943af5248
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -334,14 +334,14 @@ pub async fn render_output_cache<'a: 'n>(
let footprint = ctx.footprint(); let footprint = ctx.footprint();
let Some(render_params) = ctx.vararg(0).ok().and_then(|v| v.downcast_ref::<RenderParams>()) else { let Some(render_params) = ctx.vararg(0).ok().and_then(|v| v.downcast_ref::<RenderParams>()) else {
log::warn!("render_output_cache: missing or invalid render params, falling back to direct render"); log::warn!("render_output_cache: missing or invalid render params, falling back to direct render");
let context = OwnedContextImpl::empty().with_footprint(*footprint); let context = OwnedContextImpl::from(ctx.clone()).with_footprint(*footprint);
return data.eval(context.into_context()).await; return data.eval(context.into_context()).await;
}; };
// Fall back to direct render for non-Vello or zero-size viewports // Fall back to direct render for non-Vello or zero-size viewports
let physical_resolution = footprint.resolution; let physical_resolution = footprint.resolution;
if !matches!(render_params.render_output_type, RenderOutputTypeRequest::Vello) || physical_resolution.x == 0 || physical_resolution.y == 0 { if !matches!(render_params.render_output_type, RenderOutputTypeRequest::Vello) || physical_resolution.x == 0 || physical_resolution.y == 0 {
let context = OwnedContextImpl::empty().with_footprint(*footprint).with_vararg(Box::new(render_params.clone())); let context = OwnedContextImpl::from(ctx.clone()).with_footprint(*footprint).with_vararg(Box::new(render_params.clone()));
return data.eval(context.into_context()).await; return data.eval(context.into_context()).await;
} }
@ -396,11 +396,11 @@ pub async fn render_output_cache<'a: 'n>(
tile_cache.store_regions(new_regions.clone()); tile_cache.store_regions(new_regions.clone());
let all_regions: Vec<_> = cache_query.cached_regions.into_iter().chain(new_regions.into_iter()).collect(); let all_regions: Vec<_> = cache_query.cached_regions.into_iter().chain(new_regions).collect();
// If no regions, fall back to direct render // If no regions, fall back to direct render
if all_regions.is_empty() { if all_regions.is_empty() {
let context = OwnedContextImpl::empty().with_footprint(*footprint).with_vararg(Box::new(render_params.clone())); let context = OwnedContextImpl::from(ctx.clone()).with_footprint(*footprint).with_vararg(Box::new(render_params.clone()));
return data.eval(context.into_context()).await; return data.eval(context.into_context()).await;
} }