refact: texture render as an option (#8168)

* refact: texture render as an option

Signed-off-by: fufesou <linlong1266@gmail.com>

* refact: texture render, translation

Signed-off-by: fufesou <linlong1266@gmail.com>

* refact: texture render as option

Signed-off-by: fufesou <linlong1266@gmail.com>

* Update ui_interface.rs

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
fufesou
2024-05-28 16:42:30 +08:00
committed by GitHub
parent 010b17509a
commit 72ec86b58d
66 changed files with 481 additions and 282 deletions

View File

@@ -169,6 +169,26 @@ pub fn get_option<T: AsRef<str>>(key: T) -> String {
}
}
#[inline]
#[cfg(target_os = "macos")]
pub fn use_texture_render() -> bool {
cfg!(feature = "flutter")
&& LocalConfig::get_option(config::keys::OPTION_TEXTURE_RENDER) == "Y"
}
#[inline]
#[cfg(any(target_os = "windows", target_os = "linux"))]
pub fn use_texture_render() -> bool {
cfg!(feature = "flutter")
&& LocalConfig::get_option(config::keys::OPTION_TEXTURE_RENDER) != "N"
}
#[inline]
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn use_texture_render() -> bool {
false
}
#[inline]
pub fn get_local_option(key: String) -> String {
LocalConfig::get_option(&key)
@@ -898,7 +918,8 @@ pub fn has_vram() -> bool {
#[cfg(feature = "flutter")]
#[inline]
pub fn supported_hwdecodings() -> (bool, bool) {
let decoding = scrap::codec::Decoder::supported_decodings(None, true, None, &vec![]);
let decoding =
scrap::codec::Decoder::supported_decodings(None, use_texture_render(), None, &vec![]);
#[allow(unused_mut)]
let (mut h264, mut h265) = (decoding.ability_h264 > 0, decoding.ability_h265 > 0);
#[cfg(feature = "vram")]