-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix footprint transform #4280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix footprint transform #4280
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -345,12 +345,10 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
| return data.eval(context.into_context()).await; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| let device_scale = render_params.scale; | ||||||||||||||||||
| let zoom = footprint.scale_magnitudes().x; | ||||||||||||||||||
| let zoom = footprint.scale_magnitudes().x / render_params.scale; | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Unvalidated Prompt for AI agents
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could the scale be just removed here? |
||||||||||||||||||
| let rotation = footprint.decompose_rotation(); | ||||||||||||||||||
|
|
||||||||||||||||||
| let viewport_origin_offset = footprint.transform.translation; | ||||||||||||||||||
| let device_origin_offset = viewport_origin_offset * device_scale; | ||||||||||||||||||
| let device_origin_offset = footprint.transform.translation; | ||||||||||||||||||
| let viewport_bounds_device = AxisAlignedBbox { | ||||||||||||||||||
| start: -device_origin_offset, | ||||||||||||||||||
| end: footprint.resolution.as_dvec2() - device_origin_offset, | ||||||||||||||||||
|
|
@@ -361,7 +359,7 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
| let cache_key = CacheKey::new( | ||||||||||||||||||
| max_region_area, | ||||||||||||||||||
| render_params.render_mode as u64, | ||||||||||||||||||
| device_scale, | ||||||||||||||||||
| render_params.scale, | ||||||||||||||||||
| zoom, | ||||||||||||||||||
| rotation, | ||||||||||||||||||
| render_params.for_export, | ||||||||||||||||||
|
|
@@ -381,16 +379,7 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
| if missing_region.tiles.is_empty() { | ||||||||||||||||||
| continue; | ||||||||||||||||||
| } | ||||||||||||||||||
| let region = render_missing_region( | ||||||||||||||||||
| missing_region, | ||||||||||||||||||
| |ctx| data.eval(ctx), | ||||||||||||||||||
| ctx.clone(), | ||||||||||||||||||
| render_params, | ||||||||||||||||||
| &footprint.transform, | ||||||||||||||||||
| &viewport_origin_offset, | ||||||||||||||||||
| device_scale, | ||||||||||||||||||
| ) | ||||||||||||||||||
| .await; | ||||||||||||||||||
| let region = render_missing_region(missing_region, |ctx| data.eval(ctx), ctx.clone(), render_params, &footprint.transform, &device_origin_offset).await; | ||||||||||||||||||
| new_regions.push(region); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -406,7 +395,8 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
|
|
||||||||||||||||||
| let executor = executor.expect("GPU executor not available"); | ||||||||||||||||||
| let output_texture = executor.request_texture(physical_resolution).await; | ||||||||||||||||||
| let combined_metadata = composite_cached_regions(&all_regions, &output_texture, &device_origin_offset, &footprint.transform, &executor); | ||||||||||||||||||
|
|
||||||||||||||||||
| let combined_metadata = composite_cached_regions(&all_regions, &output_texture, &device_origin_offset, &footprint.transform, executor); | ||||||||||||||||||
|
|
||||||||||||||||||
| RenderOutput { | ||||||||||||||||||
| data: RenderOutputType::Texture(output_texture.into()), | ||||||||||||||||||
|
|
@@ -421,7 +411,6 @@ async fn render_missing_region<F, Fut>( | |||||||||||||||||
| render_params: &RenderParams, | ||||||||||||||||||
| viewport_transform: &DAffine2, | ||||||||||||||||||
| viewport_origin_offset: &DVec2, | ||||||||||||||||||
| device_scale: f64, | ||||||||||||||||||
| ) -> CachedRegion | ||||||||||||||||||
| where | ||||||||||||||||||
| F: Fn(Context<'static>) -> Fut, | ||||||||||||||||||
|
|
@@ -433,7 +422,7 @@ where | |||||||||||||||||
| let tile_count = (max_tile - min_tile) + IVec2::ONE; | ||||||||||||||||||
| let region_pixel_size = (tile_count * TILE_SIZE as i32).as_uvec2(); | ||||||||||||||||||
|
|
||||||||||||||||||
| let tile_global_offset = min_tile.as_dvec2() * (TILE_SIZE as f64 / device_scale) + *viewport_origin_offset; | ||||||||||||||||||
| let tile_global_offset = min_tile.as_dvec2() * TILE_SIZE as f64 + *viewport_origin_offset; | ||||||||||||||||||
| let region_transform = DAffine2::from_translation(-tile_global_offset) * *viewport_transform; | ||||||||||||||||||
| let region_footprint = Footprint { | ||||||||||||||||||
| transform: region_transform, | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Unconditional
1.0 / render_params.scalecan create non-finite transforms when scale is 0. Guard scale before inversion to avoid invalid SVG transform output.Prompt for AI agents