Introduce text_multithreading to Settings
This commit is contained in:
parent
217f5be827
commit
357a8a95c9
4 changed files with 24 additions and 5 deletions
|
|
@ -18,9 +18,13 @@ pub struct Settings {
|
|||
|
||||
/// If enabled, spread text workload in multiple threads when multiple cores
|
||||
/// are available.
|
||||
///
|
||||
/// By default, it is disabled.
|
||||
pub text_multithreading: bool,
|
||||
|
||||
/// The antialiasing strategy that will be used for triangle primitives.
|
||||
///
|
||||
/// By default, it is `None`.
|
||||
pub antialiasing: Option<Antialiasing>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,13 @@ pub struct Settings {
|
|||
|
||||
/// If enabled, spread text workload in multiple threads when multiple cores
|
||||
/// are available.
|
||||
///
|
||||
/// By default, it is disabled.
|
||||
pub text_multithreading: bool,
|
||||
|
||||
/// The antialiasing strategy that will be used for triangle primitives.
|
||||
///
|
||||
/// By default, it is `None`.
|
||||
pub antialiasing: Option<Antialiasing>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue