简介: CSDN博客专家,专注Android/Linux系统,分享多mic语音方案、音视频、编解码等技术,与大家一起成长!
优质专栏:Audio工程师进阶系列【原创干货持续更新中……】🚀
人生格言: 人生从来没有捷径,只有行动才是治疗恐惧和懒惰的唯一良药.
1.前言
本篇目的:理解Android显示系统之ANativeWindow与Surface关系
2.ANativeWindow与Surface类图
3.ANativeWindow与Surface转换用法实例
<1>.用法一
void render(onst sp<ANativeWindow> &nativeWindow) {
(NativeWindow.get())->perform(NativeWindow.get(), NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,bufWidth, bufHeight, halFormat);
}
sp<SurfaceControl> surfaceControl = client->createSurface(String8("testsurface"),
lcd_width, lcd_height, PIXEL_FORMAT_RGBA_8888, 0);
sp<Surface> surface = surfaceControl->getSurface();
test(surface);
<2>.用法二
ANativeWindow* window = nullptr;
Surface* c = static_cast<Surface*>(window);