diff options
author | 2024-03-27 19:47:48 +0900 | |
---|---|---|
committer | 2024-03-27 19:47:48 +0900 | |
commit | 19afc66cadfc7ea230d4d749b0d7b0197e29cf93 (patch) | |
tree | d012dff84003f2d7d18a1e6bc4bdac62df73b322 /wgpu/src/settings.rs | |
parent | 4334e63ba1dd88b367f3b7f2790b7869d11d12c0 (diff) | |
parent | 1df1cf82f4c9485533f2566c8490cfe188b4ae6a (diff) | |
download | iced-19afc66cadfc7ea230d4d749b0d7b0197e29cf93.tar.gz iced-19afc66cadfc7ea230d4d749b0d7b0197e29cf93.tar.bz2 iced-19afc66cadfc7ea230d4d749b0d7b0197e29cf93.zip |
Merge branch 'master' into viewer_content_fit
Diffstat (limited to 'wgpu/src/settings.rs')
-rw-r--r-- | wgpu/src/settings.rs | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/wgpu/src/settings.rs b/wgpu/src/settings.rs index c9338fec..828d9e09 100644 --- a/wgpu/src/settings.rs +++ b/wgpu/src/settings.rs @@ -1,6 +1,6 @@ //! Configure a renderer. use crate::core::{Font, Pixels}; -use crate::graphics::Antialiasing; +use crate::graphics::{self, Antialiasing}; /// The settings of a [`Backend`]. /// @@ -29,30 +29,6 @@ pub struct Settings { pub antialiasing: Option<Antialiasing>, } -impl Settings { - /// Creates new [`Settings`] using environment configuration. - /// - /// Specifically: - /// - /// - The `internal_backend` can be configured using the `WGPU_BACKEND` - /// environment variable. If the variable is not set, the primary backend - /// will be used. The following values are allowed: - /// - `vulkan` - /// - `metal` - /// - `dx12` - /// - `dx11` - /// - `gl` - /// - `webgpu` - /// - `primary` - pub fn from_env() -> Self { - Settings { - internal_backend: wgpu::util::backend_bits_from_env() - .unwrap_or(wgpu::Backends::all()), - ..Self::default() - } - } -} - impl Default for Settings { fn default() -> Settings { Settings { @@ -64,3 +40,14 @@ impl Default for Settings { } } } + +impl From<graphics::Settings> for Settings { + fn from(settings: graphics::Settings) -> Self { + Self { + default_font: settings.default_font, + default_text_size: settings.default_text_size, + antialiasing: settings.antialiasing, + ..Settings::default() + } + } +} |