Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/backends/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ pub struct BufferImpl<'surface> {
buffer: util::PixelBuffer,
}

// TODO: Move to NativeWindowBufferLockGuard?
unsafe impl Send for BufferImpl<'_> {}

impl BufferInterface for BufferImpl<'_> {
fn byte_stride(&self) -> NonZeroU32 {
NonZeroU32::new(self.native_window_buffer.stride() as u32 * 4).unwrap()
Expand Down
2 changes: 1 addition & 1 deletion src/backends/kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl SharedBuffer {
let (width, height) = self.db.size();

NonZeroU32::new(width)
.and_then(|width| NonZeroU32::new(height).map(|height| (width, height)))
.zip(NonZeroU32::new(height))
.expect("buffer size is zero")
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod util;
use std::cell::Cell;
use std::marker::PhantomData;
use std::num::NonZeroU32;
use std::rc::Rc;
use std::sync::Arc;

use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle};
Expand Down Expand Up @@ -294,7 +295,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> HasWindowHandle for Surface<D, W>
pub struct Buffer<'surface> {
buffer_impl: BufferDispatch<'surface>,
alpha_mode: AlphaMode,
_marker: PhantomData<Cell<()>>,
_marker: PhantomData<Rc<()>>,
}

impl Buffer<'_> {
Expand Down Expand Up @@ -840,7 +841,6 @@ fn __assert_send() {
is_send::<Context<()>>();
is_sync::<Context<()>>();
is_send::<Surface<(), ()>>();
is_send::<Buffer<'static>>();

/// ```compile_fail
/// use softbuffer::Surface;
Expand All @@ -852,8 +852,8 @@ fn __assert_send() {
/// ```compile_fail
/// use softbuffer::Buffer;
///
/// fn __is_sync<T: Sync>() {}
/// __is_sync::<Buffer<'static>>();
/// fn __is_send<T: Send>() {}
/// __is_send::<Buffer<'static>>();
/// ```
fn __buffer_not_sync() {}
fn __buffer_not_send() {}
}