From 381ac9e71cbbd177bfc9690b5a4b0f8c029995bd Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Mon, 2 Sep 2024 15:08:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=B7=E5=90=88?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=A8=A1=E5=BC=8F=E4=B8=8B=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=90=8Eplatformview=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laoguanyao <806103474@qq.com> --- shell/platform/ohos/ohos_external_texture_gl.cpp | 6 ++++++ shell/platform/ohos/ohos_external_texture_gl.h | 2 ++ shell/platform/ohos/platform_view_ohos.cpp | 7 ------- shell/platform/ohos/platform_view_ohos.h | 7 +++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 0f63badfde..236e30c1f7 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -139,6 +139,10 @@ void OHOSExternalTextureGL::Paint(PaintContext& context, new_frame_ready_ = false; } + if (!freeze && texture_update && pixelMap_ != nullptr) { + Update(); + } + GrGLTextureInfo textureInfo; if (!freeze && !first_update_ && !isEmulator_ && !new_frame_ready_ && pixelMap_ == nullptr) { @@ -206,6 +210,7 @@ void OHOSExternalTextureGL::MarkNewFrameAvailable() { FML_DLOG(INFO)<<" OHOSExternalTextureGL::MarkNewFrameAvailable"; new_frame_ready_ = true; + texture_update = true; if (pixelMap_ == nullptr) { Update(); } else { @@ -243,6 +248,7 @@ void OHOSExternalTextureGL::Update() FML_LOG(ERROR) << "OHOSExternalTextureGL OH_NativeImage_UpdateSurfaceImage err code:" << ret; return; } + texture_update = false; first_update_ = true; UpdateTransform(nativeImage_); } diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index 5ac18743a6..7001ee27e4 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.h +++ b/shell/platform/ohos/ohos_external_texture_gl.h @@ -96,6 +96,8 @@ class OHOSExternalTextureGL : public flutter::Texture { bool new_frame_ready_ = false; + bool texture_update = false; + GLuint texture_name_ = 0; GLuint backGroundTextureName_ = 0; diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index 5c169bd0b9..f05a36cd31 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -181,21 +181,14 @@ void PlatformViewOHOS::NotifyChanged(const SkISize& size) { } } -pthread_mutex_t PlatformViewOHOS::mutex_; -bool PlatformViewOHOS::isDestroyed_ = false; - bool PlatformViewOHOS::GetDestroyed() { bool ret; - pthread_mutex_lock(&mutex_); ret = isDestroyed_; - pthread_mutex_unlock(&mutex_); return ret; } void PlatformViewOHOS::SetDestroyed(bool isDestroyed) { - pthread_mutex_lock(&mutex_); isDestroyed_ = isDestroyed; - pthread_mutex_unlock(&mutex_); } // |PlatformView| diff --git a/shell/platform/ohos/platform_view_ohos.h b/shell/platform/ohos/platform_view_ohos.h index 2f1ecae4ad..f7cc0778e1 100644 --- a/shell/platform/ohos/platform_view_ohos.h +++ b/shell/platform/ohos/platform_view_ohos.h @@ -141,12 +141,11 @@ class PlatformViewOHOS final : public PlatformView { std::map> external_texture_gl_; std::map contextDatas_; - static bool isDestroyed_; - static pthread_mutex_t mutex_; + bool isDestroyed_; - static bool GetDestroyed(); + bool GetDestroyed(); - static void SetDestroyed(bool isDestroyed_); + void SetDestroyed(bool isDestroyed_); // |PlatformView| void UpdateSemantics( -- Gitee From 4e9268820739c12f6722328f528a21b99f422adb Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Mon, 2 Sep 2024 15:13:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laoguanyao <806103474@qq.com> --- shell/platform/ohos/ohos_external_texture_gl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 236e30c1f7..53296b85fc 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -139,7 +139,7 @@ void OHOSExternalTextureGL::Paint(PaintContext& context, new_frame_ready_ = false; } - if (!freeze && texture_update && pixelMap_ != nullptr) { + if (!freeze && texture_update && pixelMap_ == nullptr) { Update(); } -- Gitee From bf68e0cc4af555e865a0273c8dae3451baa52cab Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Mon, 2 Sep 2024 15:28:46 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laoguanyao <806103474@qq.com> --- shell/platform/ohos/ohos_external_texture_gl.cpp | 6 +++--- shell/platform/ohos/ohos_external_texture_gl.h | 2 +- shell/platform/ohos/platform_view_ohos.cpp | 4 +--- 3 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 53296b85fc..3c4c9f91a2 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -139,7 +139,7 @@ void OHOSExternalTextureGL::Paint(PaintContext& context, new_frame_ready_ = false; } - if (!freeze && texture_update && pixelMap_ == nullptr) { + if (!freeze && texture_update_ && pixelMap_ == nullptr) { Update(); } @@ -210,7 +210,7 @@ void OHOSExternalTextureGL::MarkNewFrameAvailable() { FML_DLOG(INFO)<<" OHOSExternalTextureGL::MarkNewFrameAvailable"; new_frame_ready_ = true; - texture_update = true; + texture_update_ = true; if (pixelMap_ == nullptr) { Update(); } else { @@ -248,7 +248,7 @@ void OHOSExternalTextureGL::Update() FML_LOG(ERROR) << "OHOSExternalTextureGL OH_NativeImage_UpdateSurfaceImage err code:" << ret; return; } - texture_update = false; + texture_update_ = false; first_update_ = true; UpdateTransform(nativeImage_); } diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index 7001ee27e4..3925a4cb33 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.h +++ b/shell/platform/ohos/ohos_external_texture_gl.h @@ -96,7 +96,7 @@ class OHOSExternalTextureGL : public flutter::Texture { bool new_frame_ready_ = false; - bool texture_update = false; + bool texture_update_ = false; GLuint texture_name_ = 0; diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index f05a36cd31..b66be4705f 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -182,9 +182,7 @@ void PlatformViewOHOS::NotifyChanged(const SkISize& size) { } bool PlatformViewOHOS::GetDestroyed() { - bool ret; - ret = isDestroyed_; - return ret; + return isDestroyed_; } void PlatformViewOHOS::SetDestroyed(bool isDestroyed) { -- Gitee