don't use SkImageInfo::new() to fix a Linker error under LInux an use mem::zeroed() instead of mem::uninitialized for safety reasons
use crate::prelude::*;
-use skia_bindings::{
- SkAlphaType,
- SkImageInfo,
- SkColorType,
- SkYUVColorSpace,
- C_SkImageInfo_Construct
-};
+use skia_bindings::{SkAlphaType, SkImageInfo, SkColorType, SkYUVColorSpace, C_SkImageInfo_Construct, C_SkImageInfo_Copy};
use crate::core::{
ColorSpace,
IRect,
ISize,
IPoint
};
+use std::mem;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[repr(i32)]
@@ -108,18 +103,21 @@ impl NativeDrop for SkImageInfo {
impl NativeClone for SkImageInfo {
fn clone(&self) -> Self {
- let mut image_info = unsafe { SkImageInfo::new() };
unsafe {
- skia_bindings::C_SkImageInfo_Copy(self, &mut image_info);
- }
+ let mut image_info = mem::zeroed();
+ // note SkImageInfo::new() does not link under Linux.
+ C_SkImageInfo_Construct(&mut image_info);
+ C_SkImageInfo_Copy(self, &mut image_info);
image_info
}
}
+}
// TODO: NativePartialEq
impl Default for Handle<SkImageInfo> {
fn default() -> Self {
+ // note SkImageInfo::new() does not link under Linux.
Self::construct_c(C_SkImageInfo_Construct)
}
}
