Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building with --no-default-features #29

Closed
wants to merge 1 commit into from
Closed
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
46 changes: 25 additions & 21 deletions src/buffer_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,30 @@ impl<T: 'static> BufferObject<T> {
_userdata: PhantomData,
}
}

fn offsets(&self) -> [u32; 4] {
let num = self
.plane_count()
.expect("GbmDevice does not exist anymore");
[
BufferObject::<T>::offset(self, 0).unwrap(),
if num > 1 {
BufferObject::<T>::offset(self, 1).unwrap()
} else {
0
},
if num > 2 {
BufferObject::<T>::offset(self, 2).unwrap()
} else {
0
},
if num > 3 {
BufferObject::<T>::offset(self, 3).unwrap()
} else {
0
},
]
}
}

impl<T: 'static> AsRaw<ffi::gbm_bo> for BufferObject<T> {
Expand Down Expand Up @@ -610,27 +634,7 @@ impl<T: 'static> DrmPlanarBuffer for BufferObject<T> {
]
}
fn offsets(&self) -> [u32; 4] {
let num = self
.plane_count()
.expect("GbmDevice does not exist anymore");
[
BufferObject::<T>::offset(self, 0).unwrap(),
if num > 1 {
BufferObject::<T>::offset(self, 1).unwrap()
} else {
0
},
if num > 2 {
BufferObject::<T>::offset(self, 2).unwrap()
} else {
0
},
if num > 3 {
BufferObject::<T>::offset(self, 3).unwrap()
} else {
0
},
]
self.offsets()
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/device.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{AsRaw, BufferObject, BufferObjectFlags, Format, Modifier, Ptr, Surface};

use libc::c_void;
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd};

use std::error;
Expand All @@ -15,7 +14,7 @@ use wayland_server::protocol::wl_buffer::WlBuffer;

#[cfg(feature = "import-egl")]
/// An EGLImage handle
pub type EGLImage = *mut c_void;
pub type EGLImage = *mut libc::c_void;

#[cfg(feature = "drm-support")]
use drm::control::Device as DrmControlDevice;
Expand Down
Loading