Start fixing up gpui2

This commit is contained in:
Piotr Osiewicz
2024-01-02 00:04:51 +01:00
parent 86facbbe4a
commit 7d420edb84
3 changed files with 97 additions and 98 deletions
+7 -2
View File
@@ -1896,7 +1896,6 @@ impl Into<Corners<Pixels>> for Pixels {
Div,
DivAssign,
PartialEq,
PartialOrd,
Serialize,
Deserialize,
)]
@@ -2039,9 +2038,15 @@ impl Mul<Pixels> for Pixels {
impl Eq for Pixels {}
impl PartialOrd for Pixels {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.0.partial_cmp(&other.0)
}
}
impl Ord for Pixels {
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.0.partial_cmp(&other.0).unwrap()
self.partial_cmp(other).unwrap()
}
}
+25 -23
View File
@@ -174,7 +174,7 @@ impl MetalRenderer {
unit_vertices,
instances,
sprite_atlas,
core_video_texture_cache: CVMetalTextureCache::new(device.as_ptr()).unwrap(),
core_video_texture_cache: unsafe { CVMetalTextureCache::new(device.as_ptr()).unwrap() },
}
}
@@ -849,28 +849,30 @@ impl MetalRenderer {
media::core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
);
let y_texture = self
.core_video_texture_cache
.create_texture_from_image(
surface.image_buffer.as_concrete_TypeRef(),
ptr::null(),
MTLPixelFormat::R8Unorm,
surface.image_buffer.plane_width(0),
surface.image_buffer.plane_height(0),
0,
)
.unwrap();
let cb_cr_texture = self
.core_video_texture_cache
.create_texture_from_image(
surface.image_buffer.as_concrete_TypeRef(),
ptr::null(),
MTLPixelFormat::RG8Unorm,
surface.image_buffer.plane_width(1),
surface.image_buffer.plane_height(1),
1,
)
.unwrap();
let y_texture = unsafe {
self.core_video_texture_cache
.create_texture_from_image(
surface.image_buffer.as_concrete_TypeRef(),
ptr::null(),
MTLPixelFormat::R8Unorm,
surface.image_buffer.plane_width(0),
surface.image_buffer.plane_height(0),
0,
)
.unwrap()
};
let cb_cr_texture = unsafe {
self.core_video_texture_cache
.create_texture_from_image(
surface.image_buffer.as_concrete_TypeRef(),
ptr::null(),
MTLPixelFormat::RG8Unorm,
surface.image_buffer.plane_width(1),
surface.image_buffer.plane_height(1),
1,
)
.unwrap()
};
align_offset(offset);
let next_offset = *offset + mem::size_of::<Surface>();