From 418bef4baefea45fa28f897636e825d029d7b033 Mon Sep 17 00:00:00 2001 From: halx99 Date: Sat, 11 Mar 2023 23:14:04 +0800 Subject: [PATCH] Fix ci --- core/platform/desktop/CCGLViewImpl-desktop.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/platform/desktop/CCGLViewImpl-desktop.cpp b/core/platform/desktop/CCGLViewImpl-desktop.cpp index f012daa97a..818a7e573c 100644 --- a/core/platform/desktop/CCGLViewImpl-desktop.cpp +++ b/core/platform/desktop/CCGLViewImpl-desktop.cpp @@ -433,6 +433,8 @@ bool GLViewImpl::initWithRect(std::string_view viewName, const ax::Rect& rect, f _frameZoomFactor = frameZoomFactor; + Vec2 frameSize = rect.size; + #if defined(AX_USE_GLES) glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); @@ -458,14 +460,15 @@ bool GLViewImpl::initWithRect(std::string_view viewName, const ax::Rect& rect, f glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); #endif - int neededWidth = (int)(rect.size.width * _frameZoomFactor); - int neededHeight = (int)(rect.size.height * _frameZoomFactor); + int neededWidth = static_cast(frameSize.width * _frameZoomFactor); + int neededHeight = static_cast(frameSize.height * _frameZoomFactor); #if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) glfwxSetParent((HWND)_glContextAttrs.viewParent); #endif - _mainWindow = glfwCreateWindow(neededWidth, neededHeight, _viewName.c_str(), _monitor, nullptr); + _mainWindow = glfwCreateWindow(neededWidth, neededHeight, _viewName.c_str(), + _monitor, nullptr); if (_mainWindow == nullptr) { @@ -526,11 +529,11 @@ bool GLViewImpl::initWithRect(std::string_view viewName, const ax::Rect& rect, f glfwGetWindowSize(_mainWindow, &realW, &realH); if (realW != neededWidth) { - rect.size.width = realW / _frameZoomFactor; + frameSize.width = realW / _frameZoomFactor; } if (realH != neededHeight) { - rect.size.height = realH / _frameZoomFactor; + frameSize.height = realH / _frameZoomFactor; } glfwSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBack); @@ -543,7 +546,7 @@ bool GLViewImpl::initWithRect(std::string_view viewName, const ax::Rect& rect, f glfwSetWindowIconifyCallback(_mainWindow, GLFWEventHandler::onGLFWWindowIconifyCallback); glfwSetWindowFocusCallback(_mainWindow, GLFWEventHandler::onGLFWWindowFocusCallback); - setFrameSize(rect.size.width, rect.size.height); + setFrameSize(frameSize.width, frameSize.height); #if (AX_TARGET_PLATFORM != AX_PLATFORM_MAC) loadGL();