SurfaceTexture/Surface mapping with ANativeWindow
SurfaceTexture/Surface mapping with ANativeWindow
给定一个GraphicBufferProduceer,我创建一个Surface,然后检索ANativeWindow。使用ANativeWindow_lock我得到一个指向缓冲区的指针。使用缓冲区,我对缓冲区进行了内存。问题是我在此缓冲区上绘制的任何内容都限制在屏幕的 25% 以下。请记住,buffer.width 和 buffer.height 的尺寸非常接近屏幕本身的分辨率。
我的问题是,为什么缓冲区只覆盖屏幕的一小部分?我如何确保它覆盖大部分(如果不是全部(屏幕?作为参考,以下是代码:
ANativeWindow_Buffer buffer;
// window is created from a "new Surface(sp<IGraphicBufferProducer>)"
if (ANativeWindow_lock(window, &buffer, NULL) == 0) {
// For testing purposes just put grey in the buffer
memcpy(buffer.bits, 0x99, buffer.width * buffer.height);
ANativeWindow_unlockAndPost(window);
}
我有一个猜测,尽管我从未使用过ANativeWindow_Buffer。 Memcpy 复制一定数量的字节。 您的图像每像素多少位? 如果该值大于 8,则不会传输整个缓冲区。 由于它可能每像素 4 个字节 (AARRGGBB(,您可能需要将其乘以 4。
相关文章:
- Problems with std::cin.fail()
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 这对"With a stackless coroutine, only the top-level routine may be suspended."意味着什么
- Boost.TEST with CLion: "Test framework quit unexpectedly"
- 避免碎片化的ClientHellos with OpenSSL (DTLS)
- Issues with Win32 ReadProcessMemory API
- Qt with WinAPI MouseProc
- [[maybe_unused]] with structured_binding?
- Issue with WriteProcessMemory
- OpenCV RTP-Stream with FFMPEG
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- std::adjacent_difference with std::chrono time_point
- DLL Made with CMake 使程序崩溃
- QtCreator with C 库中的链接器问题
- SHBrowseForFolder with BIF_BROWSEFORCOMPUTER and SHGetPathFr
- specialized std::default_delete with QQmlComponent
- VS2019 - Sudo Remote Debugging on Linux with Cmake project
- Inference pytorch C++ with alexnet and cv::imread image
- Pybind11: init<> with lambda
- SurfaceTexture/Surface mapping with ANativeWindow