Harmony port: surface destroy

This commit is contained in:
Jack253-png 2025-06-02 09:19:33 +08:00
parent 01fed59802
commit a4b48d3e2e
No known key found for this signature in database
GPG Key ID: 51EA61206B02D886
1 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,4 @@
#include "SDL3/SDL_video.h"
#include "SDL_internal.h"
#include <EGL/egl.h>
#include <EGL/eglplatform.h>
@ -328,6 +329,24 @@ static void OnSurfaceChangedCB(OH_NativeXComponent *component, void *window)
}
static void OnSurfaceDestroyedCB(OH_NativeXComponent *component, void *window)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_Window *win = _this->windows;
while (win != NULL)
{
#ifdef SDL_VIDEO_OPENGL_EGL
if (win->flags & SDL_WINDOW_OPENGL) {
if (win->internal->egl_context)
{
SDL_EGL_DestroyContext(_this, win->internal->egl_context);
}
if (win->internal->egl_surface)
{
SDL_EGL_DestroySurface(_this, win->internal->egl_surface);
}
}
#endif
win = win->next;
}
}
static void onKeyEvent(OH_NativeXComponent *component, void *window)
{