1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 02:42:05 +03:00

only use simd if the region is wide enough

Refs: https://github.com/wez/wezterm/issues/40
This commit is contained in:
Wez Furlong 2019-10-07 07:41:11 -07:00
parent 0579a52f77
commit 378e7b326f

View File

@ -169,7 +169,7 @@ pub trait BitmapImage {
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
{ {
if is_x86_feature_detected!("avx") { if is_x86_feature_detected!("avx") && width >= 8 {
unsafe { unsafe {
avx::fill_pixel(self.pixel_data_mut(), width * 4, width, height, color); avx::fill_pixel(self.pixel_data_mut(), width * 4, width, height, color);
} }
@ -192,7 +192,7 @@ pub trait BitmapImage {
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
{ {
if is_x86_feature_detected!("avx") { if is_x86_feature_detected!("avx") && (max_x - dest_x) > 8 {
unsafe { unsafe {
avx::fill_pixel( avx::fill_pixel(
self.pixel_data_mut() self.pixel_data_mut()