From dadae122533ae0916bebd04d6efab3de145263d4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 15 Feb 2020 10:08:27 +0100 Subject: Implement MSAA for `triangle` pipeline in `iced_wgpu` --- src/application.rs | 5 +++++ src/settings.rs | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/application.rs b/src/application.rs index 0a4b6d9e..1b73101a 100644 --- a/src/application.rs +++ b/src/application.rs @@ -178,6 +178,11 @@ pub trait Application: Sized { _settings.into(), iced_wgpu::Settings { default_font: _settings.default_font, + antialiasing: if _settings.antialiasing { + Some(iced_wgpu::settings::MSAA::X4) + } else { + None + }, }, ); diff --git a/src/settings.rs b/src/settings.rs index 77c7e0b9..f70e577f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -16,6 +16,15 @@ pub struct Settings { /// If `None` is provided, a default system font will be chosen. // TODO: Add `name` for web compatibility pub default_font: Option<&'static [u8]>, + + /// If set to true, the renderer will try to use antialiasing for some + /// primitives. + /// + /// Enabling it can produce a smoother result in some widgets, like the + /// `Canvas`, at a performance cost. + /// + /// By default, it is disabled. + pub antialiasing: bool, } #[cfg(not(target_arch = "wasm32"))] -- cgit