Add Linux platform, gate usage of CVImageBuffer by macOS
This commit is contained in:
parent
ef4ef5f0e8
commit
d675abf70c
7 changed files with 265 additions and 5 deletions
|
@ -7,6 +7,7 @@ use crate::{
|
|||
StyleRefinement, Styled, UriOrPath,
|
||||
};
|
||||
use futures::FutureExt;
|
||||
#[cfg(target_os = "macos")]
|
||||
use media::core_video::CVImageBuffer;
|
||||
use util::ResultExt;
|
||||
|
||||
|
@ -21,6 +22,7 @@ pub enum ImageSource {
|
|||
Data(Arc<ImageData>),
|
||||
// TODO: move surface definitions into mac platform module
|
||||
/// A CoreVideo image buffer
|
||||
#[cfg(target_os = "macos")]
|
||||
Surface(CVImageBuffer),
|
||||
}
|
||||
|
||||
|
@ -54,6 +56,7 @@ impl From<Arc<ImageData>> for ImageSource {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
impl From<CVImageBuffer> for ImageSource {
|
||||
fn from(value: CVImageBuffer) -> Self {
|
||||
Self::Surface(value)
|
||||
|
@ -144,6 +147,7 @@ impl Element for Img {
|
|||
.log_err();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
ImageSource::Surface(surface) => {
|
||||
let size = size(surface.width().into(), surface.height().into());
|
||||
let new_bounds = preserve_aspect_ratio(bounds, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue