Skip to content

Commit 150eaad

Browse files
committed
ndk/native_window: buffers_default_data_space()
1 parent e94cc75 commit 150eaad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ndk/src/native_window.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@ impl NativeWindow {
165165
}
166166
}
167167

168+
/// Get the default dataspace of the buffers in this [`NativeWindow`] as set by the consumer.
169+
#[cfg(all(feature = "nativewindow", feature = "api-level-34"))]
170+
#[doc(alias = "ANativeWindow_getBuffersDefaultDataSpace")]
171+
pub fn buffers_default_data_space(&self) -> io::Result<DataSpace> {
172+
let status = unsafe { ffi::ANativeWindow_getBuffersDefaultDataSpace(self.ptr.as_ptr()) };
173+
if status >= 0 {
174+
Ok(status.into())
175+
} else {
176+
Err(status_to_io_result(status).unwrap_err())
177+
}
178+
}
179+
168180
/// Sets the intended frame rate for this window.
169181
///
170182
/// Same as [`set_frame_rate_with_change_strategy(window, frame_rate, compatibility, ChangeFrameRateStrategy::OnlyIfSeamless)`][`NativeWindow::set_frame_rate_with_change_strategy()`].

0 commit comments

Comments
 (0)