diff options
author | 2021-07-22 18:27:33 +0700 | |
---|---|---|
committer | 2021-07-22 18:27:33 +0700 | |
commit | 357a8a95c9820651110fe4d80d8d33a2678827c0 (patch) | |
tree | 54f81a25537b793f6a83cda58549a6cb1e1d9eb9 /src | |
parent | 217f5be8272f48a5b043d066ed1788cc127e1164 (diff) | |
download | iced-357a8a95c9820651110fe4d80d8d33a2678827c0.tar.gz iced-357a8a95c9820651110fe4d80d8d33a2678827c0.tar.bz2 iced-357a8a95c9820651110fe4d80d8d33a2678827c0.zip |
Introduce `text_multithreading` to `Settings`
Diffstat (limited to 'src')
-rw-r--r-- | src/application.rs | 1 | ||||
-rw-r--r-- | src/settings.rs | 20 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/application.rs b/src/application.rs index ee532e0b..14bed2cb 100644 --- a/src/application.rs +++ b/src/application.rs @@ -208,6 +208,7 @@ pub trait Application: Sized { let renderer_settings = crate::renderer::Settings { default_font: settings.default_font, default_text_size: settings.default_text_size, + text_multithreading: settings.text_multithreading, antialiasing: if settings.antialiasing { Some(crate::renderer::settings::Antialiasing::MSAAx4) } else { diff --git a/src/settings.rs b/src/settings.rs index 2b32258d..480bf813 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -25,9 +25,11 @@ pub struct Settings<Flags> { /// The default value is 20. pub default_text_size: u16, - /// Whether the [`Application`] should exit when the user requests the - /// window to close (e.g. the user presses the close button). - pub exit_on_close_request: bool, + /// If enabled, spread text workload in multiple threads when multiple cores + /// are available. + /// + /// By default, it is disabled. + pub text_multithreading: bool, /// If set to true, the renderer will try to perform antialiasing for some /// primitives. @@ -39,6 +41,12 @@ pub struct Settings<Flags> { /// /// [`Canvas`]: crate::widget::Canvas pub antialiasing: bool, + + /// Whether the [`Application`] should exit when the user requests the + /// window to close (e.g. the user presses the close button). + /// + /// By default, it is enabled. + pub exit_on_close_request: bool, } impl<Flags> Settings<Flags> { @@ -53,8 +61,9 @@ impl<Flags> Settings<Flags> { window: default_settings.window, default_font: default_settings.default_font, default_text_size: default_settings.default_text_size, - exit_on_close_request: default_settings.exit_on_close_request, + text_multithreading: default_settings.text_multithreading, antialiasing: default_settings.antialiasing, + exit_on_close_request: default_settings.exit_on_close_request, } } } @@ -69,8 +78,9 @@ where window: Default::default(), default_font: Default::default(), default_text_size: 20, - exit_on_close_request: true, + text_multithreading: false, antialiasing: false, + exit_on_close_request: true, } } } |