Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions examples/custom-glyphs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,8 @@ impl WindowState {
let scale_x = input.width as f32 / svg_size.width();
let scale_y = input.height as f32 / svg_size.height();

let Some(mut pixmap) =
resvg::tiny_skia::Pixmap::new(input.width as u32, input.height as u32)
else {
return None;
};
let mut pixmap =
resvg::tiny_skia::Pixmap::new(input.width as u32, input.height as u32)?;

let mut transform = resvg::usvg::Transform::from_scale(scale_x, scale_y);

Expand Down Expand Up @@ -211,12 +208,12 @@ impl winit::application::ApplicationHandler for Application {
WindowEvent::Resized(size) => {
surface_config.width = size.width;
surface_config.height = size.height;
surface.configure(&device, &surface_config);
surface.configure(device, surface_config);
window.request_redraw();
}
WindowEvent::RedrawRequested => {
viewport.update(
&queue,
queue,
Resolution {
width: surface_config.width,
height: surface_config.height,
Expand All @@ -231,7 +228,7 @@ impl winit::application::ApplicationHandler for Application {
atlas,
viewport,
[TextArea {
buffer: &text_buffer,
buffer: text_buffer,
left: 10.0,
top: 10.0,
scale: 1.0,
Expand Down Expand Up @@ -316,7 +313,7 @@ impl winit::application::ApplicationHandler for Application {
occlusion_query_set: None,
});

text_renderer.render(&atlas, &viewport, &mut pass).unwrap();
text_renderer.render(atlas, viewport, &mut pass).unwrap();
}

queue.submit(Some(encoder.finish()));
Expand Down
6 changes: 3 additions & 3 deletions examples/hello-world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ impl winit::application::ApplicationHandler for Application {
WindowEvent::Resized(size) => {
surface_config.width = size.width;
surface_config.height = size.height;
surface.configure(&device, &surface_config);
surface.configure(device, surface_config);
window.request_redraw();
}
WindowEvent::RedrawRequested => {
viewport.update(
&queue,
queue,
Resolution {
width: surface_config.width,
height: surface_config.height,
Expand Down Expand Up @@ -213,7 +213,7 @@ impl winit::application::ApplicationHandler for Application {
occlusion_query_set: None,
});

text_renderer.render(&atlas, &viewport, &mut pass).unwrap();
text_renderer.render(atlas, viewport, &mut pass).unwrap();
}

queue.submit(Some(encoder.finish()));
Expand Down
8 changes: 4 additions & 4 deletions examples/text-sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl WindowState {
surface,
surface_config,
physical_size: physical_size.cast(),
scale_factor: scale_factor as f32,
scale_factor,
font_system,
swash_cache,
viewport,
Expand Down Expand Up @@ -199,7 +199,7 @@ impl winit::application::ApplicationHandler for Application {
WindowEvent::Resized(size) => {
surface_config.width = size.width;
surface_config.height = size.height;
surface.configure(&device, &surface_config);
surface.configure(device, surface_config);
window.request_redraw();

*scale_factor = window.scale_factor() as f32;
Expand All @@ -214,7 +214,7 @@ impl winit::application::ApplicationHandler for Application {
}
WindowEvent::RedrawRequested => {
viewport.update(
&queue,
queue,
Resolution {
width: surface_config.width,
height: surface_config.height,
Expand Down Expand Up @@ -290,7 +290,7 @@ impl winit::application::ApplicationHandler for Application {
occlusion_query_set: None,
});

text_renderer.render(&atlas, &viewport, &mut pass).unwrap();
text_renderer.render(atlas, viewport, &mut pass).unwrap();
}

queue.submit(Some(encoder.finish()));
Expand Down