diff --git a/gpu_display/src/gpu_display_android.rs b/gpu_display/src/gpu_display_android.rs index 27753ff887..4d418373f0 100644 --- a/gpu_display/src/gpu_display_android.rs +++ b/gpu_display/src/gpu_display_android.rs @@ -35,7 +35,7 @@ pub(crate) struct AndroidDisplayContext { // Opaque blob #[repr(C)] -pub(crate) struct ANativeWindow { +pub(crate) struct AndroidDisplaySurface { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } @@ -79,11 +79,14 @@ extern "C" { width: u32, height: u32, for_cursor: bool, - ) -> *mut ANativeWindow; + ) -> *mut AndroidDisplaySurface; /// Destroys the Android surface created from `create_android_surface`. #[allow(dead_code)] - fn destroy_android_surface(ctx: *mut AndroidDisplayContext, surface: *mut ANativeWindow); + fn destroy_android_surface( + ctx: *mut AndroidDisplayContext, + surface: *mut AndroidDisplaySurface, + ); /// Obtains one buffer from the given Android Surface. The information about the buffer (buffer /// address, size, stride, etc) is reported via the `ANativeWindow_Buffer` struct. It shouldn't @@ -94,7 +97,7 @@ extern "C" { /// returned), then the caller shouldn't try to read `out_buffer` or use the buffer in any way. fn get_android_surface_buffer( ctx: *mut AndroidDisplayContext, - surface: *mut ANativeWindow, + surface: *mut AndroidDisplaySurface, out_buffer: *mut ANativeWindow_Buffer, ) -> bool; @@ -103,7 +106,10 @@ extern "C" { /// Posts the buffer obtained from `get_android_surface_buffer` to the Android display system /// so that it can be displayed on the screen. Once this is called, the caller shouldn't use /// the buffer any more. - fn post_android_surface_buffer(ctx: *mut AndroidDisplayContext, surface: *mut ANativeWindow); + fn post_android_surface_buffer( + ctx: *mut AndroidDisplayContext, + surface: *mut AndroidDisplaySurface, + ); } unsafe extern "C" fn error_callback(message: *const c_char) { @@ -156,7 +162,7 @@ impl From for GpuDisplayFramebuffer<'_> { struct AndroidSurface { context: Rc, - surface: NonNull, + surface: NonNull, } impl GpuDisplaySurface for AndroidSurface { diff --git a/gpu_display/src/gpu_display_android_stub.rs b/gpu_display/src/gpu_display_android_stub.rs index ff1889a3ce..100eef26dc 100644 --- a/gpu_display/src/gpu_display_android_stub.rs +++ b/gpu_display/src/gpu_display_android_stub.rs @@ -10,9 +10,9 @@ use std::ffi::c_char; -use crate::gpu_display_android::ANativeWindow; use crate::gpu_display_android::ANativeWindow_Buffer; use crate::gpu_display_android::AndroidDisplayContext; +use crate::gpu_display_android::AndroidDisplaySurface; use crate::gpu_display_android::ErrorCallback; #[no_mangle] @@ -34,14 +34,14 @@ extern "C" fn create_android_surface( _width: u32, _height: u32, _for_cursor: bool, -) -> *mut ANativeWindow { +) -> *mut AndroidDisplaySurface { unimplemented!(); } #[no_mangle] extern "C" fn destroy_android_surface( _ctx: *mut AndroidDisplayContext, - _surface: *mut ANativeWindow, + _surface: *mut AndroidDisplaySurface, ) { unimplemented!(); } @@ -54,7 +54,7 @@ extern "C" fn set_android_surface_position(_ctx: *mut AndroidDisplayContext, _x: #[no_mangle] extern "C" fn get_android_surface_buffer( _ctx: *mut AndroidDisplayContext, - _surface: *mut ANativeWindow, + _surface: *mut AndroidDisplaySurface, _out_buffer: *mut ANativeWindow_Buffer, ) -> u32 { unimplemented!(); @@ -63,7 +63,7 @@ extern "C" fn get_android_surface_buffer( #[no_mangle] extern "C" fn post_android_surface_buffer( _ctx: *mut AndroidDisplayContext, - _surface: *mut ANativeWindow, + _surface: *mut AndroidDisplaySurface, ) { unimplemented!(); }