diff options
| author | 2024-03-25 21:36:44 +0100 | |
|---|---|---|
| committer | 2024-03-25 21:36:44 +0100 | |
| commit | a2a8381a49ac2dd1cd65eb382b9ee02bbfa17286 (patch) | |
| tree | e6c24928a42e23ff91eea0fc30b4fbbcb6da024b /wgpu/src/settings.rs | |
| parent | 3013463baa71504488a20436beb3db87ecb66df0 (diff) | |
| parent | 6a4f5ac2081699f7cf20c917b367366ab49eeef1 (diff) | |
| download | iced-a2a8381a49ac2dd1cd65eb382b9ee02bbfa17286.tar.gz iced-a2a8381a49ac2dd1cd65eb382b9ee02bbfa17286.tar.bz2 iced-a2a8381a49ac2dd1cd65eb382b9ee02bbfa17286.zip | |
Merge pull request #2351 from iced-rs/custom-renderer-injection
Type-Driven Renderer Fallback
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() +        } +    } +} | 
