diff --git a/src/core/ohos/SDL_ohos_xcomponent.cpp b/src/core/ohos/SDL_ohos_xcomponent.cpp index 1b1814d560695ace45c6b9c270fe711915823e68..895c2b205b154985ba5f74625553f77edffb2161 100644 --- a/src/core/ohos/SDL_ohos_xcomponent.cpp +++ b/src/core/ohos/SDL_ohos_xcomponent.cpp @@ -64,8 +64,8 @@ static void OnSurfaceCreatedCB(OH_NativeXComponent *component, void *window) uint64_t height; OH_NativeXComponent_GetXComponentSize(component, window, &width, &height); OHOS_SetScreenSize((int)width, (int)height); - if (OHOS_Window) { - SDL_WindowData *data = (SDL_WindowData *)OHOS_Window->driverdata; + if (g_ohosWindow) { + SDL_WindowData *data = (SDL_WindowData *)g_ohosWindow->driverdata; data->native_window = (OHNativeWindow *)(window); if (data->native_window == NULL) { SDL_SetError("Could not fetch native window from UI thread"); @@ -80,10 +80,10 @@ static void OnSurfaceChangedCB(OH_NativeXComponent *component, void *window) uint64_t height; OH_NativeXComponent_GetXComponentSize(component, window, &width, &height); OHOS_SetScreenSize((int)width, (int)height); - if (OHOS_Window) { + if (g_ohosWindow) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_WindowData *data = (SDL_WindowData *)OHOS_Window->driverdata; - OHOS_SendResize(OHOS_Window); + SDL_WindowData *data = (SDL_WindowData *)g_ohosWindow->driverdata; + OHOS_SendResize(g_ohosWindow); /* If the xcomponent has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ if (data->egl_xcomponent == EGL_NO_SURFACE) { @@ -98,9 +98,9 @@ static void OnSurfaceDestroyedCB(OH_NativeXComponent *component, void *window) gNative_window = nullptr; retry: - if (OHOS_Window) { + if (g_ohosWindow) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_WindowData *data = (SDL_WindowData *)OHOS_Window->driverdata; + SDL_WindowData *data = (SDL_WindowData *)g_ohosWindow->driverdata; /* Wait for Main thread being paused and context un-activated to release 'xcomponent' */ if (!data->backup_done) { @@ -168,7 +168,7 @@ void onNativeTouch(OH_NativeXComponent *component, void *window) ohosTouch.x = tiltX; ohosTouch.y = tiltY; ohosTouch.p = touchEvent.force; - OHOS_OnTouch(OHOS_Window, &ohosTouch); + OHOS_OnTouch(g_ohosWindow, &ohosTouch); SDL_UnlockMutex(OHOS_PageMutex); } @@ -186,7 +186,7 @@ void onNativeMouse(OH_NativeXComponent *component, void *window) windowsize.x = mouseEvent.x; windowsize.y = mouseEvent.y; - OHOS_OnMouse(OHOS_Window, &windowsize, SDL_TRUE); + OHOS_OnMouse(g_ohosWindow, &windowsize, SDL_TRUE); SDL_UnlockMutex(OHOS_PageMutex); } @@ -203,7 +203,7 @@ static void OnDispatchTouchEventCB(OH_NativeXComponent *component, void *window) ohosTouch.x = touchEvent.x; ohosTouch.y = touchEvent.y; ohosTouch.p = touchEvent.force; - OHOS_OnTouch(OHOS_Window, &ohosTouch); + OHOS_OnTouch(g_ohosWindow, &ohosTouch); SDL_UnlockMutex(OHOS_PageMutex); } diff --git a/src/video/ohos/SDL_ohosgl.c b/src/video/ohos/SDL_ohosgl.c index eccf100b305fa6a0ec11ba2aad0607a7ab0b6d65..5a5b107996c983c6293e5b106a8a3d0a5b5f75f5 100644 --- a/src/video/ohos/SDL_ohosgl.c +++ b/src/video/ohos/SDL_ohosgl.c @@ -44,7 +44,7 @@ int OHOS_GLES_MakeCurrent(SDL_VideoDevice *thisDevice, SDL_Window * window, SDL_ SDL_GLContext OHOS_GLES_CreateContext(SDL_VideoDevice *thisDevice, SDL_Window * window) { SDL_GLContext ret; - OHOS_PageMutex_Lock_Running(); + OHOS_PAGEMUTEX_LockRunning(); ret = SDL_EGL_CreateContext(thisDevice, ((SDL_WindowData *) window->driverdata)->egl_xcomponent); SDL_UnlockMutex(OHOS_PageMutex); return ret; diff --git a/test/testautomation_video.c b/test/testautomation_video.c index 06fdfdc05b6388fb9b054a074e2a433f59895f99..b7ca93bbf5a1fea8029febd9c8838b635882a630 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -18,6 +18,11 @@ #include "SDL.h" #include "SDL_test.h" +#ifdef __OHOS__ +#define OHOS_MIN_DEVICEWIDTH 320 +#define OHOS_MIN_DEVICEHEIGHT 320 +#endif + /* Private helpers */ /* @@ -34,8 +39,8 @@ SDL_Window *_createVideoSuiteTestWindow(const char *title) y = SDLTest_RandomIntegerInRange(1, 100); #ifdef __OHOS__ #include "../SDL/src/video/ohos/SDL_ohosvideo.h" - w = SDLTest_RandomIntegerInRange(320, OHOS_DeviceWidth); - h = SDLTest_RandomIntegerInRange(320, OHOS_DeviceHeight); + w = SDLTest_RandomIntegerInRange(OHOS_MIN_DEVICEWIDTH, g_ohosDeviceWidth); + h = SDLTest_RandomIntegerInRange(OHOS_MIN_DEVICEHEIGHT, g_ohosDeviceHeight); #else w = SDLTest_RandomIntegerInRange(320, 720); h = SDLTest_RandomIntegerInRange(320, 1136);