问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

ANativeWindow是个什么东西

发布网友 发布时间:2022-05-16 03:58

我来回答

1个回答

热心网友 时间:2023-08-03 11:14

代码贴出来,大家参考一下。

struct ANativeWindow
{
#ifdef __cplusplus
ANativeWindow()
: flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0)
{
common.magic = ANDROID_NATIVE_WINDOW_MAGIC;
common.version = sizeof(ANativeWindow);
memset(common.reserved, 0, sizeof(common.reserved));
}

/* Implement the methods that sp<ANativeWindow> expects so that it
can be used to automatically refcount ANativeWindow's. */
void incStrong(const void* id) const {
common.incRef(const_cast<android_native_base_t*>(&common));
}
void decStrong(const void* id) const {
common.decRef(const_cast<android_native_base_t*>(&common));
}
#endif

struct android_native_base_t common;

/* flags describing some attributes of this surface or its updater */
const uint32_t flags;

/* min swap interval supported by this updated */
const int minSwapInterval;

/* max swap interval supported by this updated */
const int maxSwapInterval;

/* horizontal and vertical resolution in DPI */
const float xdpi;
const float ydpi;

/* Some storage reserved for the OEM's driver. */
intptr_t oem[4];

/*
* Set the swap interval for this surface.
*
* Returns 0 on success or -errno on error.
*/
int (*setSwapInterval)(struct ANativeWindow* window,
int interval);

/*
* Hook called by EGL to acquire a buffer. After this call, the buffer
* is not locked, so its content cannot be modified. This call may block if
* no buffers are available.
*
* The window holds a reference to the buffer between dequeueBuffer and
* either queueBuffer or cancelBuffer, so clients only need their own
* reference if they might use the buffer after queueing or canceling it.
* Holding a reference to a buffer after queueing or canceling it is only
* allowed if a specific buffer count has been set.
*
* Returns 0 on success or -errno on error.
*/
int (*dequeueBuffer)(struct ANativeWindow* window,
struct ANativeWindowBuffer** buffer);

/*
* hook called by EGL to lock a buffer. This MUST be called before modifying
* the content of a buffer. The buffer must have been acquired with
* dequeueBuffer first.
*
* Returns 0 on success or -errno on error.
*/
int (*lockBuffer)(struct ANativeWindow* window,
struct ANativeWindowBuffer* buffer);
/*
* Hook called by EGL when modifications to the render buffer are done.
* This unlocks and post the buffer.
*
* The window holds a reference to the buffer between dequeueBuffer and
* either queueBuffer or cancelBuffer, so clients only need their own
* reference if they might use the buffer after queueing or canceling it.
* Holding a reference to a buffer after queueing or canceling it is only
* allowed if a specific buffer count has been set.
*
* Buffers MUST be queued in the same order than they were dequeued.
*
* Returns 0 on success or -errno on error.
*/
int (*queueBuffer)(struct ANativeWindow* window,
struct ANativeWindowBuffer* buffer);

/*
* hook used to retrieve information about the native window.
*
* Returns 0 on success or -errno on error.
*/
int (*query)(const struct ANativeWindow* window,
int what, int* value);

/*
* hook used to perform various operations on the surface.
* (*perform)() is a generic mechanism to add functionality to
* ANativeWindow while keeping backward binary compatibility.
*
* DO NOT CALL THIS HOOK DIRECTLY. Instead, use the helper functions
* defined below.
*
* (*perform)() returns -ENOENT if the 'what' parameter is not supported
* by the surface's implementation.
*
* The valid operations are:
* NATIVE_WINDOW_SET_USAGE
* NATIVE_WINDOW_CONNECT (deprecated)
* NATIVE_WINDOW_DISCONNECT (deprecated)
* NATIVE_WINDOW_SET_CROP
* NATIVE_WINDOW_SET_BUFFER_COUNT
* NATIVE_WINDOW_SET_BUFFERS_GEOMETRY (deprecated)
* NATIVE_WINDOW_SET_BUFFERS_TRANSFORM
* NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP
* NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS
* NATIVE_WINDOW_SET_BUFFERS_FORMAT
* NATIVE_WINDOW_SET_SCALING_MODE
* NATIVE_WINDOW_LOCK (private)
* NATIVE_WINDOW_UNLOCK_AND_POST (private)
* NATIVE_WINDOW_API_CONNECT (private)
* NATIVE_WINDOW_API_DISCONNECT (private)
*
*/

int (*perform)(struct ANativeWindow* window,
int operation, ... );
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
电脑分辨率设置多少合适笔记本电脑分辨率多少最佳 各尺寸笔记本电脑的最佳分辨率 2022年高考480到510分能上山东科技大学吗 朋友借了我一万块钱,现在坐牢了怎么还钱? 天王星和海王星虽然看似一对姊妹星,但还是有区别 ...值得收藏吗?现在分别只都多少钱,照片上有一个铜币的 谁能告诉我这是一枚什么样的铜币,值不值钱? 有谁知道这铜币值不值钱,懂家告诉我一下!谢谢 有谁知道这个铜钱的来历 可以进行异地公积金贷款吗 帮翻译下~~ java中String到底能不能变化?String,StringBuffer的区别是什么? Stencil buffer失效了怎么办 缓冲器的专用语 请问什么是模板缓冲(Stencil Buffer) 日语早上好,下午好,晚上好!还有你好意思 日语中“下午好,晚上好”怎么讲的啊? 日语下午好怎么说 下午好用日文怎么写? 下午好的日语如何翻译? 下午好用日语怎么说? 下午好,用日语怎么写? 下午好,日语怎么说 下午好,日语怎么说? 日语的下午好怎么说? 日语下午好怎么说? JavaScript问题 如何使鼠标移到不同的文字上 另一侧的图片发生相应的变换?求代码!!我菜鸟!初学者 关于企业未设置预付账款的会计分录 可以不用设预付账款的账户,应该把预付款项计入那? 不设置预收预付账款,如何做账? c++ 编辑的.cpp文件如何在matlab中mex编译报错 snort规则 英文翻译摘要 想要的是语法正确得翻译,不要“中式”英语 求大神cdr中如何做裂纹字啊 像图片这样的 求大神指教 求步骤???? 为何有的pdf无法用Apple pen标记 an apple a day keeps the doctor away连读读音标记 怎么去除苹果上的系统提醒标记 丰田18年1.4T智辉版卡罗拉有定速巡航功能吗? 卡罗拉2018自动巡航灯黄色故障怎么解决? 卡罗拉定速巡航时下坡离合器空转发动机空响正常吗? 卡罗拉双擎加装定速巡航有影响吗 卡罗拉上有车标ACC吗? 取环后多久还能上环 为什么腾讯视频不能免流了! 为什么我的腾讯视频不显示免流了,流量没有上限,大王卡也是设置的主卡 为什么我的腾讯视频不能免流了 沣标电子考勤制度 为什么突然,我看腾讯视频不显示免流了,那我要怎么弄 宋江和李逵的关系很好,但是为何宋江在临死前,还要毒死李逵? 宋江临死前为何要把李逵毒死,他是在害怕什么?