Harmony port: review changes

This commit is contained in:
Jack253-png 2025-06-01 07:41:02 +08:00
parent c99ae6e155
commit 298581d269
No known key found for this signature in database
GPG Key ID: 51EA61206B02D886
3 changed files with 15 additions and 6 deletions

View File

@ -130,6 +130,15 @@ void OHOS_removeWindow(SDL_Window* w)
#endif
}
void OHOS_LockPage()
{
SDL_LockMutex(g_ohosPageMutex);
}
void OHOS_UnlockPage()
{
SDL_UnlockMutex(g_ohosPageMutex);
}
static napi_value minus(napi_env env, napi_callback_info info)
{
size_t argc = 2;

View File

@ -6,10 +6,10 @@
#include "video/SDL_sysvideo.h"
#include <native_window/external_window.h>
extern SDL_Mutex *g_ohosPageMutex;
void OHOS_windowDataFill(SDL_Window* w);
void OHOS_removeWindow(SDL_Window* w);
void OHOS_LockPage();
void OHOS_UnlockPage();
typedef struct SDL_VideoData {
SDL_Rect textRect;

View File

@ -19,11 +19,11 @@ SDL_GLContext OHOS_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window
{
SDL_GLContext result;
SDL_LockMutex(g_ohosPageMutex);
OHOS_LockPage();
result = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
SDL_UnlockMutex(g_ohosPageMutex);
OHOS_UnlockPage();
return result;
}
@ -32,11 +32,11 @@ bool OHOS_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
bool result;
SDL_LockMutex(g_ohosPageMutex);
OHOS_LockPage();
result = SDL_EGL_SwapBuffers(_this, window->internal->egl_surface);
SDL_UnlockMutex(g_ohosPageMutex);
OHOS_UnlockPage();
return result;
}