Skip to content

Commit 298581d

Browse files
committed
Harmony port: review changes
1 parent c99ae6e commit 298581d

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/core/ohos/SDL_ohos.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ void OHOS_removeWindow(SDL_Window* w)
130130
#endif
131131
}
132132

133+
void OHOS_LockPage()
134+
{
135+
SDL_LockMutex(g_ohosPageMutex);
136+
}
137+
void OHOS_UnlockPage()
138+
{
139+
SDL_UnlockMutex(g_ohosPageMutex);
140+
}
141+
133142
static napi_value minus(napi_env env, napi_callback_info info)
134143
{
135144
size_t argc = 2;

src/core/ohos/SDL_ohos.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include "video/SDL_sysvideo.h"
77
#include <native_window/external_window.h>
88

9-
extern SDL_Mutex *g_ohosPageMutex;
10-
119
void OHOS_windowDataFill(SDL_Window* w);
1210
void OHOS_removeWindow(SDL_Window* w);
11+
void OHOS_LockPage();
12+
void OHOS_UnlockPage();
1313

1414
typedef struct SDL_VideoData {
1515
SDL_Rect textRect;

src/video/ohos/SDL_ohosgl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ SDL_GLContext OHOS_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window
1919
{
2020
SDL_GLContext result;
2121

22-
SDL_LockMutex(g_ohosPageMutex);
22+
OHOS_LockPage();
2323

2424
result = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
2525

26-
SDL_UnlockMutex(g_ohosPageMutex);
26+
OHOS_UnlockPage();
2727

2828
return result;
2929
}
@@ -32,11 +32,11 @@ bool OHOS_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
3232
{
3333
bool result;
3434

35-
SDL_LockMutex(g_ohosPageMutex);
35+
OHOS_LockPage();
3636

3737
result = SDL_EGL_SwapBuffers(_this, window->internal->egl_surface);
3838

39-
SDL_UnlockMutex(g_ohosPageMutex);
39+
OHOS_UnlockPage();
4040

4141
return result;
4242
}

0 commit comments

Comments
 (0)