Skip to content

Commit c2bdaaf

Browse files
committed
ndk: Extend new flags
1 parent 64bd5d8 commit c2bdaaf

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

ndk/src/hardware_buffer.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,14 @@ bitflags::bitflags! {
128128
#[doc(alias = "AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE")]
129129
const GPU_MIPMAP_COMPLETE = ffi::AHardwareBuffer_UsageFlags::AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE.0;
130130

131-
// TODO: Only available in a newer NDK
132-
// /// Usage: The buffer is used for front-buffer rendering. When front-buffering rendering
133-
// /// is specified, different usages may adjust their behavior as a result. For example, when
134-
// /// used as [`HardwareBufferFormat::GPU_COLOR_OUTPUT`] the buffer will behave similar to a
135-
// /// single-buffered window. When used with [`HardwareBufferFormat::COMPOSER_OVERLAY`], the
136-
// /// system will try to prioritize the buffer receiving an overlay plane & avoid caching it
137-
// /// in intermediate composition buffers.
138-
// #[doc(alias = "AHARDWAREBUFFER_USAGE_FRONT_BUFFER")]
139-
// const USAGE_FRONT_BUFFER = ffi::AHardwareBuffer_UsageFlags::AHARDWAREBUFFER_USAGE_FRONT_BUFFER.0;
131+
/// Usage: The buffer is used for front-buffer rendering. When front-buffering rendering
132+
/// is specified, different usages may adjust their behavior as a result. For example, when
133+
/// used as [`HardwareBufferFormat::GPU_COLOR_OUTPUT`] the buffer will behave similar to a
134+
/// single-buffered window. When used with [`HardwareBufferFormat::COMPOSER_OVERLAY`], the
135+
/// system will try to prioritize the buffer receiving an overlay plane & avoid caching it
136+
/// in intermediate composition buffers.
137+
#[doc(alias = "AHARDWAREBUFFER_USAGE_FRONT_BUFFER")]
138+
const USAGE_FRONT_BUFFER = ffi::AHardwareBuffer_UsageFlags::AHARDWAREBUFFER_USAGE_FRONT_BUFFER.0;
140139

141140
#[doc(alias = "AHARDWAREBUFFER_USAGE_VENDOR_0")]
142141
const VENDOR_0 = ffi::AHardwareBuffer_UsageFlags::AHARDWAREBUFFER_USAGE_VENDOR_0.0;

ndk/src/media/image_reader.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ impl ImageReader {
184184
Ok(Self::from_ptr(inner))
185185
}
186186

187+
/// [`ImageReader`] constructor similar to [`ImageReader::new_with_usage()`] that takes two
188+
/// additional parameters to build the format of the [`Image`]. All other parameters and the
189+
/// return values are identical to those passed to [`ImageReader::new_with_usage()`].
190+
///
191+
/// Instead of passing an [`ImageFormat`] parameter, this constructor accepts the combination
192+
/// of [`HardwareBufferFormat`] and [`DataSpace`] for the format of the Image that the reader
193+
/// will produce.
187194
#[cfg(feature = "api-level-34")]
188195
#[doc(alias = "AImageReader_newWithDataSpace")]
189196
pub fn new_with_data_space(
@@ -482,6 +489,7 @@ impl Image {
482489
std::mem::forget(self);
483490
}
484491

492+
/// Query the [`DataSpace`] of the input [`Image`].
485493
#[cfg(feature = "api-level-34")]
486494
#[doc(alias = "AImage_getDataSpace")]
487495
pub fn data_space(&self) -> Result<DataSpace> {

0 commit comments

Comments
 (0)