diff --git a/include/SDL_config_ohos.h b/include/SDL_config_ohos.h index 7497eb2e2901f8b1fe1bcd9882983508e0f0ace2..63002279bf6eefa38ed12cd6c22bfaf050e06db7 100644 --- a/include/SDL_config_ohos.h +++ b/include/SDL_config_ohos.h @@ -13,9 +13,9 @@ * limitations under the License. */ -#ifndef SDL_config_ohos_h_ -#define SDL_config_ohos_h_ -#define SDL_config_h_ +#ifndef SDL_CONFIG_OHOS_H +#define SDL_CONFIG_OHOS_H +#define SDL_CONFIG_H #include "SDL_platform.h" @@ -160,7 +160,6 @@ #define SDL_VIDEO_RENDER_OGL_ES2 0 /* Enable Vulkan support */ -/* Android does not support Vulkan in native code using the "armeabi" ABI. */ #if defined(__ARM_ARCH) && __ARM_ARCH < 7 #define SDL_VIDEO_VULKAN 0 #else @@ -173,4 +172,4 @@ /* Enable the filesystem driver */ #define SDL_FILESYSTEM_OHOS 1 -#endif /* SDL_config_ohos_h_ */ +#endif /* SDL_CONFIG_OHOS_H */ diff --git a/ohos-project/entry/src/main/cpp/application/main.c b/ohos-project/entry/src/main/cpp/application/main.c index 8ff0f47307aa7b5df501f4a32be6f0cc2e761a97..0360eea24cdc39dcfdba29eda7d08fef6b07900b 100644 --- a/ohos-project/entry/src/main/cpp/application/main.c +++ b/ohos-project/entry/src/main/cpp/application/main.c @@ -14,9 +14,8 @@ */ #include "SDL.h" -int -main(int argc, char **argv) +int main(int argc, char **argv) { - SDL_Log("entry.."); + SDL_Log("entry.."); return 0; } \ No newline at end of file diff --git a/src/core/ohos/SDL_ohos.cpp b/src/core/ohos/SDL_ohos.cpp index 4203da4abfd081e3948753d7b30b6b50fb3e422b..b1d28e15748a499379d09d2af7fe3b4a7b12c066 100644 --- a/src/core/ohos/SDL_ohos.cpp +++ b/src/core/ohos/SDL_ohos.cpp @@ -96,8 +96,7 @@ OHOS_SetDisplayOrientation(int orientation) displayOrientation = (SDL_DisplayOrientation)orientation; } -SDL_DisplayOrientation -OHOS_GetDisplayOrientation() +SDL_DisplayOrientation OHOS_GetDisplayOrientation() { return displayOrientation; } @@ -246,8 +245,7 @@ OHOS_NAPI_ShowTextInputKeyboard(SDL_bool isshow) } } -void -OHOS_NAPI_SetOrientation(int w, int h, int resizable, const char *hint) +void OHOS_NAPI_SetOrientation(int w, int h, int resizable, const char *hint) { cJSON *root = cJSON_CreateObject(); if (root == NULL) { @@ -265,8 +263,7 @@ OHOS_NAPI_SetOrientation(int w, int h, int resizable, const char *hint) } } -int -OHOS_CreateCustomCursor(SDL_Surface *xcomponent, int hotX, int hotY) +int OHOS_CreateCustomCursor(SDL_Surface *xcomponent, int hotX, int hotY) { cJSON *root = cJSON_CreateObject(); if (root == NULL) { @@ -337,8 +334,7 @@ OHOS_SupportsRelativeMouse(void) return SDL_TRUE; } -SDL_bool -OHOS_SetRelativeMouseEnabled(SDL_bool enabled) +SDL_bool OHOS_SetRelativeMouseEnabled(SDL_bool enabled) { return SDL_TRUE; } @@ -435,7 +431,7 @@ SDLNapi::OHOS_TextInput(napi_env env, napi_callback_info info) SDL_memset(&event, 0, sizeof(SDL_Event)); // 清空event结构体 event.type = SDL_TEXTINPUT; - SDL_strlcpy(event.text.text, inputBuffer, sizeof(inputBuffer)); + SDL_strlcpy(event.text.text, inputBuffer, sizeof(inputBuffer)); SDL_PushEvent(&event); // 推送事件到事件队列 @@ -578,8 +574,7 @@ SDLNapi::OHOS_OnNativeFocusChanged(napi_env env, napi_callback_info info) return nullptr; } -static void -OHOS_NAPI_NativeSetup(void) +static void OHOS_NAPI_NativeSetup(void) { SDL_setenv("SDL_VIDEO_GL_DRIVER", "libGLESv3.so", 1); SDL_setenv("SDL_VIDEO_EGL_DRIVER", "libEGL.so", 1); @@ -645,8 +640,7 @@ OHOS_NAPI_GetInfo(napi_env &env, napi_callback_info &info, napi_value *argv, cha return argc; } -static int -OHOS_NAPI_SetArgs(napi_env& env, char **argvs, int &argcs, size_t &argc, napi_value* argv) +static int OHOS_NAPI_SetArgs(napi_env& env, char **argvs, int &argcs, size_t &argc, napi_value* argv) { napi_status status; napi_valuetype valuetype; @@ -674,8 +668,7 @@ OHOS_NAPI_SetArgs(napi_env& env, char **argvs, int &argcs, size_t &argc, napi_va return i; } -static napi_value -OHOS_NAPI_SDLAppEntry(napi_env env, napi_callback_info info) +static napi_value OHOS_NAPI_SDLAppEntry(napi_env env, napi_callback_info info) { char *library_file; char *function_name; @@ -732,8 +725,7 @@ OHOS_NAPI_SDLAppEntry(napi_env env, napi_callback_info info) } -napi_value -SDLNapi::Init(napi_env env, napi_value exports) +napi_value SDLNapi::Init(napi_env env, napi_value exports) { napi_property_descriptor desc[] = { {"sdlAppEntry", nullptr, OHOS_NAPI_SDLAppEntry, nullptr, nullptr, nullptr, napi_default, nullptr}, diff --git a/src/core/ohos/SDL_ohos.h b/src/core/ohos/SDL_ohos.h index eebb525432fc0d78e5f7d9e47a681b6f5eac8ce6..08098ec7c8d1a4934b46624a569b927a4d5ee313 100644 --- a/src/core/ohos/SDL_ohos.h +++ b/src/core/ohos/SDL_ohos.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef SDL_OHOS_H_ -#define SDL_OHOS_H_ +#ifndef SDL_OHOS_H +#define SDL_OHOS_H #include "../../SDL_internal.h" @@ -70,6 +70,6 @@ extern void OHOS_NAPI_SetWindowResize(int x, int y, int w, int h); /* *INDENT-ON* */ #endif -#endif /* SDL_ohos_h_ */ +#endif /* SDL_OHOS_H */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/testyuv.c b/test/testyuv.c index 04a98f1fb16a0d2bd1af462a5779ffe512d5e06d..32f0e7725f293800a7b5a44b396dafaf06894800 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -21,6 +21,9 @@ /* 422 (YUY2, etc) formats are the largest */ #define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2) +#ifdef __OHOS__ +#define OHOS_NUM_TWO 2 +#endif /* Return true if the YUV format is packed pixels */ static SDL_bool is_packed_yuv_format(Uint32 format) @@ -431,8 +434,8 @@ main(int argc, char **argv) int width = event.window.data1; int height = event.window.data2; SDL_RenderSetLogicalSize(renderer, width, height); - current = 2; - SDL_Log("SDL_WINDOWEVENT_SIZE_CHANGED: %d, %d",width,height); + current = OHOS_NUM_TWO; + SDL_Log("SDL_WINDOWEVENT_SIZE_CHANGED: %d, %d", width, height); } } #endif