Skip to content

Commit d6451aa

Browse files
committed
ndk: Add ASurfaceControl bindings
1 parent 8220d8c commit d6451aa

File tree

5 files changed

+1250
-4
lines changed

5 files changed

+1250
-4
lines changed

ndk/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22

33
- image_reader: Add `ImageReader::new_with_data_space()` constructor and `ImageReader::data_space()` getter from API level 34. (#474)
4+
- Add `ASurfaceControl` and `ASurfaceTransaction` bindings. (#TODO)
45

56
# 0.9.0 (2024-04-26)
67

ndk/src/data_space.rs

+12
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ pub enum DataSpace {
236236
__Unknown(i32),
237237
}
238238

239+
impl From<DataSpace> for ffi::ADataSpace {
240+
fn from(val: DataSpace) -> Self {
241+
Self(val.into())
242+
}
243+
}
244+
245+
impl From<ffi::ADataSpace> for DataSpace {
246+
fn from(val: ffi::ADataSpace) -> Self {
247+
Self::from(val.0)
248+
}
249+
}
250+
239251
impl fmt::Display for DataSpace {
240252
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
241253
f.write_str(match self {

ndk/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub mod media_error;
2727
pub mod native_activity;
2828
pub mod native_window;
2929
pub mod shared_memory;
30+
pub mod surface_control;
3031
pub mod surface_texture;
3132
pub mod sync;
3233
pub mod trace;

ndk/src/native_window.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl NativeWindow {
204204
/// may choose a display refresh rate to better match this window's frame rate. Usage of this
205205
/// API won't introduce frame rate throttling, or affect other aspects of the application's
206206
/// frame production pipeline. However, because the system may change the display refresh rate,
207-
/// calls to this function may result in changes to Choreographer callback timings, and changes
207+
/// calls to this function may result in changes to `Choreographer` callback timings, and changes
208208
/// to the time interval at which the system releases buffers back to the application.
209209
///
210210
/// Note that this only has an effect for windows presented on the display. If this
@@ -390,7 +390,7 @@ impl Drop for NativeWindowBufferLockGuard<'_> {
390390
}
391391
}
392392

393-
#[cfg(all(feature = "nativewindow", feature = "api-level-26"))]
393+
#[cfg(feature = "api-level-26")]
394394
bitflags::bitflags! {
395395
/// Transforms that can be applied to buffers as they are displayed to a window.
396396
///
@@ -426,7 +426,7 @@ bitflags::bitflags! {
426426
doc = " and [`NativeWindow::set_frame_rate_with_change_strategy()`]"
427427
)]
428428
/// .
429-
#[cfg(all(feature = "nativewindow", feature = "api-level-30"))]
429+
#[cfg(feature = "api-level-30")]
430430
#[repr(i8)]
431431
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
432432
#[doc(alias = "ANativeWindow_FrameRateCompatibility")]
@@ -453,7 +453,7 @@ pub enum FrameRateCompatibility {
453453
}
454454

455455
/// Change frame rate strategy value for [`NativeWindow::set_frame_rate_with_change_strategy()`].
456-
#[cfg(all(feature = "nativewindow", feature = "api-level-31"))]
456+
#[cfg(feature = "api-level-31")]
457457
#[repr(i8)]
458458
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
459459
#[doc(alias = "ANativeWindow_ChangeFrameRateStrategy")]

0 commit comments

Comments
 (0)