mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Upgrade WGPU and Linebender dependencies (#4154)
This commit is contained in:
@@ -82,6 +82,7 @@ pub async fn export_document(
|
||||
// Encode and write raster image when buffer is already provided
|
||||
write_raster_image(output_path, file_type, data, width, height, transparent)?;
|
||||
}
|
||||
#[cfg(target_family = "wasm")]
|
||||
other => {
|
||||
return Err(format!("Unexpected render output type: {:?}. Expected Texture, Buffer for raster export or Svg for SVG export.", other).into());
|
||||
}
|
||||
|
||||
@@ -113,7 +113,10 @@ impl CanvasSurface for CanvasSurfaceHandle {
|
||||
},
|
||||
);
|
||||
|
||||
let surface_texture = surface.get_current_texture().expect("Failed to get surface texture");
|
||||
let surface_texture = match surface.get_current_texture() {
|
||||
wgpu::CurrentSurfaceTexture::Success(t) | wgpu::CurrentSurfaceTexture::Suboptimal(t) => t,
|
||||
other => panic!("Failed to get surface texture: {other:?}"),
|
||||
};
|
||||
|
||||
encoder.copy_texture_to_texture(
|
||||
wgpu::TexelCopyTextureInfoBase {
|
||||
|
||||
@@ -33,13 +33,13 @@ impl BackgroundCompositor {
|
||||
|
||||
let checker_rect_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("background_checker_rect_pipeline_layout"),
|
||||
bind_group_layouts: &[&checker_bind_group_layout],
|
||||
bind_group_layouts: &[Some(&checker_bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
let checker_viewport_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("background_checker_viewport_pipeline_layout"),
|
||||
bind_group_layouts: &[&checker_bind_group_layout],
|
||||
bind_group_layouts: &[Some(&checker_bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ impl BackgroundCompositor {
|
||||
|
||||
let fullscreen_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("background_fullscreen_pipeline_layout"),
|
||||
bind_group_layouts: &[&fullscreen_bind_group_layout],
|
||||
bind_group_layouts: &[Some(&fullscreen_bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ impl ContextBuilder {
|
||||
}
|
||||
impl ContextBuilder {
|
||||
fn build_instance(&self) -> Instance {
|
||||
Instance::new(&wgpu::InstanceDescriptor {
|
||||
Instance::new(wgpu::InstanceDescriptor {
|
||||
backends: self.backends,
|
||||
..Default::default()
|
||||
..wgpu::InstanceDescriptor::new_without_display_handle()
|
||||
})
|
||||
}
|
||||
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter> {
|
||||
|
||||
@@ -38,7 +38,7 @@ impl Resampler {
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("resample_pipeline_layout"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
||||
@@ -113,10 +113,10 @@ impl PerPixelAdjustGraphicsPipeline {
|
||||
};
|
||||
let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: Some(&format!("PerPixelAdjust {name} PipelineLayout")),
|
||||
bind_group_layouts: &[&device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||
bind_group_layouts: &[Some(&device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||
label: Some(&format!("PerPixelAdjust {name} BindGroupLayout 0")),
|
||||
entries,
|
||||
})],
|
||||
}))],
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ where
|
||||
.draw_image_with_html_image_element_and_dw_and_dh(&image_data, 0., 0., resolution.x as f64, resolution.y as f64)
|
||||
.unwrap();
|
||||
|
||||
let rasterized = context.get_image_data(0., 0., resolution.x as f64, resolution.y as f64).unwrap();
|
||||
let rasterized = context.get_image_data(0, 0, resolution.x as i32, resolution.y as i32).unwrap();
|
||||
|
||||
let image = Image::from_image_data(&rasterized.data().0, resolution.x as u32, resolution.y as u32);
|
||||
List::new_from_item(
|
||||
|
||||
@@ -72,7 +72,9 @@ impl TextContext {
|
||||
|
||||
builder.push_default(StyleProperty::FontSize(typesetting.font_size as f32));
|
||||
builder.push_default(StyleProperty::LetterSpacing(typesetting.character_spacing as f32));
|
||||
builder.push_default(StyleProperty::FontStack(parley::FontStack::Single(parley::FontFamily::Named(std::borrow::Cow::Owned(font_family)))));
|
||||
builder.push_default(StyleProperty::FontFamily(parley::FontFamily::Single(parley::FontFamilyName::Named(std::borrow::Cow::Owned(
|
||||
font_family,
|
||||
)))));
|
||||
builder.push_default(StyleProperty::FontWeight(font_info.weight()));
|
||||
builder.push_default(StyleProperty::FontStyle(font_info.style()));
|
||||
builder.push_default(StyleProperty::FontWidth(font_info.width()));
|
||||
@@ -81,7 +83,7 @@ impl TextContext {
|
||||
let mut layout: Layout<()> = builder.build(text);
|
||||
|
||||
layout.break_all_lines(typesetting.max_width.map(|mw| mw as f32));
|
||||
layout.align(typesetting.max_width.map(|max_w| max_w as f32), typesetting.align.into(), AlignmentOptions::default());
|
||||
layout.align(typesetting.align.into(), AlignmentOptions::default());
|
||||
|
||||
Some(layout)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user