From 1e16e7dfc96836f506fa0458142c19bd81987077 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 31 Oct 2024 11:57:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AA=97=E5=8F=A3=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E5=BA=94=E7=94=A8=E7=95=8C=E9=9D=A2=E5=8F=98?= =?UTF-8?q?=E5=BD=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- shell/platform/ohos/ohos_surface_gl_skia.cpp | 23 ++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/shell/platform/ohos/ohos_surface_gl_skia.cpp b/shell/platform/ohos/ohos_surface_gl_skia.cpp index dcd4a06481..6c8d5ea57e 100755 --- a/shell/platform/ohos/ohos_surface_gl_skia.cpp +++ b/shell/platform/ohos/ohos_surface_gl_skia.cpp @@ -16,10 +16,12 @@ #include "flutter/shell/platform/ohos/ohos_surface_gl_skia.h" #include +#include #include "flutter/fml/logging.h" #include "flutter/fml/memory/ref_ptr.h" #include "flutter/shell/platform/ohos/ohos_egl_surface.h" +#include "flutter/shell/platform/ohos/ohos_logging.h" #include "flutter/shell/platform/ohos/ohos_shell_holder.h" namespace flutter { @@ -89,17 +91,20 @@ bool OhosSurfaceGLSkia::OnScreenSurfaceResize(const SkISize& size) { return true; } - GLContextPtr()->ClearCurrent(); - - // Ensure the destructor is called since it destroys the `EGLSurface` before - // creating a new onscreen surface. - onscreen_surface_ = nullptr; - onscreen_surface_ = GLContextPtr()->CreateOnscreenSurface(native_window_); - if (!onscreen_surface_->IsValid()) { - FML_LOG(ERROR) << "Unable to create EGL window surface on resize."; + int code = SET_BUFFER_GEOMETRY; + int32_t width = size.fWidth; + int32_t height = size.fHeight; + int32_t ret = OH_NativeWindow_NativeWindowHandleOpt(native_window_->handle(), + code, width, height); + if (ret != 0) { + LOGE( + "OhosSurfaceGLSkia::OnScreenSurfaceResize, window resize failed, " + "ret=%{public}d, " + "width:%{public}d, " + "height:%{public}d", + ret, width, height); return false; } - onscreen_surface_->MakeCurrent(); return true; } -- Gitee