From e9d68a332deee2d751aa99b867464f6c27392f5d Mon Sep 17 00:00:00 2001 From: Tnze Date: Tue, 9 Feb 2021 14:20:22 +0800 Subject: [PATCH] [rs] Use the "max" function to ensure that the swapchain size is not less than 1. For better readability. --- wgpu/examples/framework.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpu/examples/framework.rs b/wgpu/examples/framework.rs index 6dd9e92cbb..69d7ed4c71 100644 --- a/wgpu/examples/framework.rs +++ b/wgpu/examples/framework.rs @@ -255,8 +255,8 @@ fn start( .. } => { log::info!("Resizing to {:?}", size); - sc_desc.width = if size.width == 0 { 1 } else { size.width }; - sc_desc.height = if size.height == 0 { 1 } else { size.height }; + sc_desc.width = size.width.max(1); + sc_desc.height = size.height.max(1); example.resize(&sc_desc, &device, &queue); swap_chain = device.create_swap_chain(&surface, &sc_desc); }