From 02bd8592ed88b55c560444847bf331db886cfdc3 Mon Sep 17 00:00:00 2001 From: liujiake Date: Tue, 10 Dec 2024 14:13:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9=E5=A4=96?= =?UTF-8?q?=E6=8E=A5=E7=BA=B9=E7=90=86Paint=E4=B8=AD()=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84openGL=E8=B5=84=E6=BA=90=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujiake --- shell/platform/ohos/ohos_external_texture_gl.cpp | 2 +- shell/platform/ohos/platform_view_ohos.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index f160e09469..1a5b304ad0 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -343,7 +343,7 @@ bool OHOSExternalTextureGL::IsContextCurrent() void OHOSExternalTextureGL::Update() { FML_DLOG(INFO) << "OHOSExternalTextureGL::Update, texture_name_=" << texture_name_; - if (!IsContextCurrent() && context_) { + if (!IsContextCurrent() && context_ && display_ && draw_surface_ && read_surface_) { if (eglMakeCurrent(display_, draw_surface_, read_surface_, context_) != EGL_TRUE) { FML_LOG(WARNING) << "eglMakeCurrent in update failed"; } diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index b1aca3a69c..7c8cbfd34f 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -117,15 +117,13 @@ PlatformViewOHOS::PlatformViewOHOS( PlatformViewOHOS::~PlatformViewOHOS() { FML_LOG(INFO) << "PlatformViewOHOS::~PlatformViewOHOS"; - for (std::map>::iterator it = external_texture_gl_.begin(); - it != external_texture_gl_.end(); ++it) { - if (it->second != nullptr) { - OH_NativeImage_Destroy(&(it->second->nativeImage_)); - it->second->nativeImage_ = nullptr; + for (auto const &it : external_texture_gl_) { + if (it.second != nullptr) { + OH_NativeImage_Destroy(&(it.second->nativeImage_)); + it.second->nativeImage_ = nullptr; } } external_texture_gl_.clear(); - FML_LOG(INFO) << "PlatformViewOHOS::~PlatformViewOHOS finish"; } void PlatformViewOHOS::NotifyCreate( -- Gitee From d5a0f86d4a14ed9e0750e29d67b4a26cc6a8f792 Mon Sep 17 00:00:00 2001 From: liujiake Date: Wed, 11 Dec 2024 15:50:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9C=A8PlatformViewOHOS=E6=9E=90=E6=9E=84?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=B8=AD=E6=B7=BB=E5=8A=A0=E9=94=80=E6=AF=81?= =?UTF-8?q?nativeImage=E7=9A=84=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujiake --- shell/platform/ohos/platform_view_ohos.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index 7c8cbfd34f..58b1056978 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -119,6 +119,7 @@ PlatformViewOHOS::~PlatformViewOHOS() { FML_LOG(INFO) << "PlatformViewOHOS::~PlatformViewOHOS"; for (auto const &it : external_texture_gl_) { if (it.second != nullptr) { + FML_LOG(INFO) << " nativeImage of textureId " << it.first << " will destroy"; OH_NativeImage_Destroy(&(it.second->nativeImage_)); it.second->nativeImage_ = nullptr; } -- Gitee