| 1464 | } |
| 1465 | |
| 1466 | static ANativeWindow *Create(const CreateOptions &options = {.name = "AImGui"}) |
| 1467 | { |
| 1468 | auto &surfaceComposerClient = GetComposerInstance(); |
| 1469 | |
| 1470 | int32_t width = options.width; |
| 1471 | int32_t height = options.height; |
| 1472 | while (0 == width || 0 == height) |
| 1473 | { |
| 1474 | anative_window_creator::detail::types::ui::DisplayState displayInfo{}; |
| 1475 | |
| 1476 | if (!surfaceComposerClient.GetDisplayInfo(&displayInfo)) |
| 1477 | break; |
| 1478 | |
| 1479 | width = displayInfo.layerStackSpaceRect.width; |
| 1480 | height = displayInfo.layerStackSpaceRect.height; |
| 1481 | |
| 1482 | break; |
| 1483 | } |
| 1484 | |
| 1485 | auto surfaceControl = surfaceComposerClient.CreateSurface(options.name, width, height, {}, options.skipScreenshot); |
| 1486 | auto nativeWindow = reinterpret_cast<ANativeWindow *>(surfaceControl.GetSurface()); |
| 1487 | |
| 1488 | m_cachedSurfaceControl.emplace(nativeWindow, std::move(surfaceControl)); |
| 1489 | return nativeWindow; |
| 1490 | } |
| 1491 | |
| 1492 | static void Destroy(ANativeWindow *nativeWindow) |
| 1493 | { |
nothing calls this directly
no test coverage detected