From b30b303934cdc0dc38e37273da14a49fd90b7210 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 7 Nov 2024 17:33:35 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A4=96=E6=8E=A5=E7=BA=B9=E7=90=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4,=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=9C=BA=E6=99=AF=E9=BB=91=E5=B1=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- .../ohos/ohos_external_texture_gl.cpp | 48 +++++++------------ .../platform/ohos/ohos_external_texture_gl.h | 2 - shell/platform/ohos/platform_view_ohos.cpp | 2 + 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 374e63a1d0..58f774a9c7 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -122,6 +122,8 @@ OHOSExternalTextureGL::~OHOSExternalTextureGL() void OHOSExternalTextureGL::Attach() { + FML_DLOG(INFO) << "Attach, texture_name_=" << texture_name_ + << ", Id()=" << Id(); if (state_ != AttachmentState::uninitialized) { FML_LOG(ERROR) << "OHOSExternalTextureGL::Attach, the current status is not uninitialized"; return; @@ -164,16 +166,23 @@ void OHOSExternalTextureGL::Paint(PaintContext& context, const SkSamplingOptions& sampling) { if (state_ == AttachmentState::detached) { - FML_LOG(ERROR) << "OHOSExternalTextureGL::Paint, the current status is detached"; + FML_LOG(ERROR) << "Paint, the current status is detached"; return; } - if (!freeze && texture_update_ && pixelMap_ == nullptr) { - // 多引擎场景(multi_flutters_ohos)需要在这里执行Update + if (state_ == AttachmentState::uninitialized) { + Attach(); + if (pixelMap_ != nullptr) { + // 外接纹理图片场景 + ProducePixelMapToNativeImage(); + new_frame_ready_ = true; + } + } + if (!freeze && new_frame_ready_) { Update(); + new_frame_ready_ = false; } GrGLTextureInfo textureInfo; - if (!freeze && !first_update_ && !isEmulator_ && !new_frame_ready_ && pixelMap_ == nullptr) { setBackground(bounds.width(), bounds.height()); textureInfo = {GL_TEXTURE_EXTERNAL_OES, backGroundTextureName_, GL_RGBA8_OES}; @@ -227,22 +236,16 @@ void OHOSExternalTextureGL::OnGrContextDestroyed() << ", Id()=" << Id(); if (state_ == AttachmentState::attached) { Detach(); - state_ = AttachmentState::detached; + glDeleteTextures(1, &texture_name_); + glDeleteTextures(1, &backGroundTextureName_); } + state_ = AttachmentState::detached; } void OHOSExternalTextureGL::MarkNewFrameAvailable() { FML_DLOG(INFO) << " OHOSExternalTextureGL::MarkNewFrameAvailable"; new_frame_ready_ = true; - texture_update_ = true; - if (texture_name_ == 0) { - Attach(); - } - if (pixelMap_ != nullptr) { // 外接纹理图片场景 - ProducePixelMapToNativeImage(); - } - Update(); } void OHOSExternalTextureGL::OnTextureUnregistered() @@ -266,7 +269,6 @@ void OHOSExternalTextureGL::Update() return; } int32_t ret = OH_NativeImage_UpdateSurfaceImage(nativeImage_); - texture_update_ = false; if (ret != 0) { FML_LOG(ERROR) << "OHOSExternalTextureGL OH_NativeImage_UpdateSurfaceImage err code:" << ret; return; @@ -282,7 +284,6 @@ void OHOSExternalTextureGL::Detach() FML_LOG(ERROR) << "OHOSExternalTextureGL::Detach, the current status is not attached"; return; } - if (nativeImage_ != nullptr) { OH_NativeImage_DetachContext(nativeImage_); OH_NativeImage_UnsetOnFrameAvailableListener(nativeImage_); @@ -303,15 +304,6 @@ void OHOSExternalTextureGL::Detach() OH_NativeWindow_DestroyNativeWindow(backGroundNativeWindow_); backGroundNativeWindow_ = nullptr; } - - if (texture_name_ != 0) { - glDeleteTextures(1, &texture_name_); - texture_name_ = 0; - } - if (backGroundTextureName_ != 0) { - glDeleteTextures(1, &backGroundTextureName_); - backGroundTextureName_ = 0; - } } void OHOSExternalTextureGL::UpdateTransform(OH_NativeImage *image) @@ -487,10 +479,6 @@ void OHOSExternalTextureGL::ProducePixelMapToBackGroundImage() usage |= NATIVEBUFFER_USAGE_CPU_READ | (BUFFER_USAGE_HW_COMPOSER); OH_NativeWindow_NativeWindowHandleOpt(backGroundNativeWindow_, SET_USAGE, usage); - if (backGroundBuffer_ != nullptr) { - OH_NativeWindow_NativeWindowAbortBuffer(backGroundNativeWindow_, backGroundBuffer_); - backGroundBuffer_ = nullptr; - } ret = OH_NativeWindow_NativeWindowRequestBuffer(backGroundNativeWindow_, &backGroundBuffer_, &backGroundFenceFd); if (ret != 0) { FML_LOG(ERROR) @@ -613,10 +601,6 @@ void OHOSExternalTextureGL::ProducePixelMapToNativeImage() usage |= NATIVEBUFFER_USAGE_CPU_READ | (BUFFER_USAGE_HW_COMPOSER); OH_NativeWindow_NativeWindowHandleOpt(nativeWindow_, SET_USAGE, usage); - if (buffer_ != nullptr) { - OH_NativeWindow_NativeWindowAbortBuffer(nativeWindow_, buffer_); - buffer_ = nullptr; - } ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow_, &buffer_, &fenceFd); if (ret != 0) { FML_LOG(ERROR) << "OHOSExternalTextureGL OH_NativeWindow_NativeWindowRequestBuffer err:" << ret; diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index 26847c228b..2458ac9c54 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.h +++ b/shell/platform/ohos/ohos_external_texture_gl.h @@ -97,8 +97,6 @@ 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 956e8c03a9..f4cfb6ef02 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -439,6 +439,7 @@ void PlatformViewOHOS::RegisterExternalTextureByImage( RegisterTexture(ohos_external_gl); ohos_external_gl->DispatchImage(image); } + MarkTextureFrameAvailable(texture_id); } } @@ -478,6 +479,7 @@ uint64_t PlatformViewOHOS::RegisterExternalTexture(int64_t texture_id) } external_texture_gl_[texture_id] = ohos_external_gl; RegisterTexture(ohos_external_gl); + MarkTextureFrameAvailable(texture_id); } return surface_id; } -- Gitee From 430d82190683eefff08d56cab045788b87902505 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Sat, 9 Nov 2024 16:35:10 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A4=96=E6=8E=A5=E7=BA=B9=E7=90=86?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- shell/platform/ohos/ohos_external_texture_gl.cpp | 7 +++---- shell/platform/ohos/ohos_external_texture_gl.h | 4 ---- shell/platform/ohos/platform_view_ohos.cpp | 3 +-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 58f774a9c7..785ba786f0 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -92,8 +92,6 @@ OHOSExternalTextureGL::OHOSExternalTextureGL( backGroundNativeWindow_ = nullptr; eglContext_ = EGL_NO_CONTEXT; eglDisplay_ = EGL_NO_DISPLAY; - buffer_ = nullptr; - backGroundBuffer_ = nullptr; pixelMap_ = nullptr; backGroundPixelMap_ = nullptr; lastImage_ = nullptr; @@ -113,8 +111,6 @@ OHOSExternalTextureGL::~OHOSExternalTextureGL() backGroundNativeWindow_ = nullptr; eglContext_ = EGL_NO_CONTEXT; eglDisplay_ = EGL_NO_DISPLAY; - buffer_ = nullptr; - backGroundBuffer_ = nullptr; pixelMap_ = nullptr; backGroundPixelMap_ = nullptr; lastImage_ = nullptr; @@ -407,6 +403,7 @@ void OHOSExternalTextureGL::ProduceColorToBackGroundImage(int32_t width, int32_t usage |= NATIVEBUFFER_USAGE_CPU_READ | (BUFFER_USAGE_HW_COMPOSER); OH_NativeWindow_NativeWindowHandleOpt(backGroundNativeWindow_, SET_USAGE, usage); + OHNativeWindowBuffer *backGroundBuffer_; ret = OH_NativeWindow_NativeWindowRequestBuffer(backGroundNativeWindow_, &backGroundBuffer_, &backGroundFenceFd); if (ret != 0) { FML_LOG(ERROR) << "OHOSExternalTextureGL::setBackground OH_NativeWindow_NativeWindowRequestBuffer err:" << ret; @@ -479,6 +476,7 @@ void OHOSExternalTextureGL::ProducePixelMapToBackGroundImage() usage |= NATIVEBUFFER_USAGE_CPU_READ | (BUFFER_USAGE_HW_COMPOSER); OH_NativeWindow_NativeWindowHandleOpt(backGroundNativeWindow_, SET_USAGE, usage); + OHNativeWindowBuffer *backGroundBuffer_; ret = OH_NativeWindow_NativeWindowRequestBuffer(backGroundNativeWindow_, &backGroundBuffer_, &backGroundFenceFd); if (ret != 0) { FML_LOG(ERROR) @@ -601,6 +599,7 @@ void OHOSExternalTextureGL::ProducePixelMapToNativeImage() usage |= NATIVEBUFFER_USAGE_CPU_READ | (BUFFER_USAGE_HW_COMPOSER); OH_NativeWindow_NativeWindowHandleOpt(nativeWindow_, SET_USAGE, usage); + OHNativeWindowBuffer *buffer_; ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow_, &buffer_, &fenceFd); if (ret != 0) { FML_LOG(ERROR) << "OHOSExternalTextureGL OH_NativeWindow_NativeWindowRequestBuffer err:" << ret; diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index 2458ac9c54..fadf5a9cce 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.h +++ b/shell/platform/ohos/ohos_external_texture_gl.h @@ -109,10 +109,6 @@ class OHOSExternalTextureGL : public flutter::Texture { OHNativeWindow *backGroundNativeWindow_; - OHNativeWindowBuffer *buffer_; - - OHNativeWindowBuffer *backGroundBuffer_; - NativePixelMap* backGroundPixelMap_; NativePixelMap* pixelMap_; diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index f4cfb6ef02..adc8d5ec3d 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -439,7 +439,6 @@ void PlatformViewOHOS::RegisterExternalTextureByImage( RegisterTexture(ohos_external_gl); ohos_external_gl->DispatchImage(image); } - MarkTextureFrameAvailable(texture_id); } } @@ -451,6 +450,7 @@ PointerDataDispatcherMaker PlatformViewOHOS::GetDispatcherMaker() { uint64_t PlatformViewOHOS::RegisterExternalTexture(int64_t texture_id) { + FML_DLOG(INFO) << "PlatformViewOHOS::RegisterExternalTexture, texture_id=" << texture_id; uint64_t surface_id = 0; int ret = -1; if (ohos_context_->RenderingApi() == OHOSRenderingAPI::kOpenGLES) { @@ -479,7 +479,6 @@ uint64_t PlatformViewOHOS::RegisterExternalTexture(int64_t texture_id) } external_texture_gl_[texture_id] = ohos_external_gl; RegisterTexture(ohos_external_gl); - MarkTextureFrameAvailable(texture_id); } return surface_id; } -- Gitee From b8c587770250c52b0adc882a5df8d31dff006303 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 14 Nov 2024 10:26:01 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=A4=96=E6=8E=A5=E7=BA=B9=E7=90=86?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=8E=9F=E7=94=9F=E7=BB=84=E4=BB=B6=E5=9C=BA?= =?UTF-8?q?=E6=99=AF,=E4=BF=AE=E6=94=B9=E6=A8=AA=E7=AB=96=E5=B1=8F?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=B6=E7=95=8C=E9=9D=A2=E5=8F=98=E5=BD=A2?= =?UTF-8?q?=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_external_texture_gl.cpp | 6 ++++-- shell/platform/ohos/ohos_external_texture_gl.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 785ba786f0..8e789862d3 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -170,12 +170,13 @@ void OHOSExternalTextureGL::Paint(PaintContext& context, if (pixelMap_ != nullptr) { // 外接纹理图片场景 ProducePixelMapToNativeImage(); - new_frame_ready_ = true; + new_frame_count++; } } - if (!freeze && new_frame_ready_) { + if (!freeze && new_frame_count > 0) { Update(); new_frame_ready_ = false; + new_frame_count--; } GrGLTextureInfo textureInfo; @@ -242,6 +243,7 @@ void OHOSExternalTextureGL::MarkNewFrameAvailable() { FML_DLOG(INFO) << " OHOSExternalTextureGL::MarkNewFrameAvailable"; new_frame_ready_ = true; + new_frame_count = 2; } void OHOSExternalTextureGL::OnTextureUnregistered() diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index fadf5a9cce..4f503caf7c 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.h +++ b/shell/platform/ohos/ohos_external_texture_gl.h @@ -96,6 +96,7 @@ class OHOSExternalTextureGL : public flutter::Texture { AttachmentState state_; bool new_frame_ready_ = false; + int new_frame_count = 0; GLuint texture_name_ = 0; -- Gitee From 99696a072bb371675908a6f8b8b7b10d424a1756 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 14 Nov 2024 10:29:31 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=A4=96=E6=8E=A5=E7=BA=B9=E7=90=86,?= =?UTF-8?q?=E7=9F=A9=E9=98=B5=E8=BD=AC=E6=8D=A2=E5=A4=B1=E8=B4=A5=E6=97=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E7=9F=A9=E9=98=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- .../ohos/ohos_external_texture_gl.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 8e789862d3..580d45d84d 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -41,6 +41,8 @@ constexpr const char *EGL_KHR_PLATFORM_WAYLAND = "EGL_KHR_platform_wayland"; constexpr const char *EGL_GET_PLATFORM_DISPLAY_EXT = "eglGetPlatformDisplayEXT"; constexpr uint32_t WHITE_COLOR = 0xFFFFFFFF; +const SkScalar DEFAULT_MATRIX[] = {1, 0, 0, 0, -1, 1, 0, 0, 1}; + static int PixelMapToWindowFormat(PIXEL_FORMAT pixel_format) { switch (pixel_format) { @@ -320,7 +322,23 @@ void OHOSExternalTextureGL::UpdateTransform(OH_NativeImage *image) transform.set9(matrix3); SkMatrix inverted; if (!transform.invert(&inverted)) { - FML_LOG(ERROR) << "OHOSExternalTextureGL Invalid SurfaceTexture transformation matrix"; + FML_LOG(ERROR) << "OHOSExternalTextureGL UpdateTransform matrix error"; + + transform.set9(DEFAULT_MATRIX); + if (!transform.invert(&inverted)) { + FML_LOG(ERROR) << "UpdateTransform matrix error again"; + } + + for (int i = 0; i < 3; i++) { + int num = i * 3; + FML_LOG(ERROR) << " " << matrix3[num] << " " << matrix3[num + 1] << " " + << matrix3[num + 2]; + } + for (int i = 0; i < 4; i++) { + int num = i * 4; + FML_LOG(ERROR) << " " << m[num] << " " << m[num + 1] << " " << m[num + 2] + << " " << m[num + 3]; + } } transform = inverted; } -- Gitee From b94c9b6f64422bd20f8c3b0d3dc5498daec1a75d Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 14 Nov 2024 19:12:57 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=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 --- .../ohos/ohos_external_texture_gl.cpp | 20 +++++-------------- .../platform/ohos/ohos_external_texture_gl.h | 2 +- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index 580d45d84d..b7ffeafb0e 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -42,6 +42,7 @@ constexpr const char *EGL_GET_PLATFORM_DISPLAY_EXT = "eglGetPlatformDisplayEXT"; constexpr uint32_t WHITE_COLOR = 0xFFFFFFFF; const SkScalar DEFAULT_MATRIX[] = {1, 0, 0, 0, -1, 1, 0, 0, 1}; +const int UPDATE_FRAME_COUNT = 2; static int PixelMapToWindowFormat(PIXEL_FORMAT pixel_format) { @@ -172,13 +173,13 @@ void OHOSExternalTextureGL::Paint(PaintContext& context, if (pixelMap_ != nullptr) { // 外接纹理图片场景 ProducePixelMapToNativeImage(); - new_frame_count++; + newFrameCount++; } } - if (!freeze && new_frame_count > 0) { + if (!freeze && newFrameCount > 0) { Update(); new_frame_ready_ = false; - new_frame_count--; + newFrameCount--; } GrGLTextureInfo textureInfo; @@ -245,7 +246,7 @@ void OHOSExternalTextureGL::MarkNewFrameAvailable() { FML_DLOG(INFO) << " OHOSExternalTextureGL::MarkNewFrameAvailable"; new_frame_ready_ = true; - new_frame_count = 2; + newFrameCount = UPDATE_FRAME_COUNT; } void OHOSExternalTextureGL::OnTextureUnregistered() @@ -328,17 +329,6 @@ void OHOSExternalTextureGL::UpdateTransform(OH_NativeImage *image) if (!transform.invert(&inverted)) { FML_LOG(ERROR) << "UpdateTransform matrix error again"; } - - for (int i = 0; i < 3; i++) { - int num = i * 3; - FML_LOG(ERROR) << " " << matrix3[num] << " " << matrix3[num + 1] << " " - << matrix3[num + 2]; - } - for (int i = 0; i < 4; i++) { - int num = i * 4; - FML_LOG(ERROR) << " " << m[num] << " " << m[num + 1] << " " << m[num + 2] - << " " << m[num + 3]; - } } transform = inverted; } diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index 4f503caf7c..a8b5de6629 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 { AttachmentState state_; bool new_frame_ready_ = false; - int new_frame_count = 0; + int newFrameCount = 0; GLuint texture_name_ = 0; -- Gitee From 143977cb1483bd2c59ef5d39feb7cc8c60c9e711 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 14 Nov 2024 20:26:06 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A4=96=E6=8E=A5=E7=BA=B9=E7=90=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4glDeleteTextures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- shell/platform/ohos/ohos_external_texture_gl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index b7ffeafb0e..8c8d58f72a 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -236,8 +236,6 @@ void OHOSExternalTextureGL::OnGrContextDestroyed() << ", Id()=" << Id(); if (state_ == AttachmentState::attached) { Detach(); - glDeleteTextures(1, &texture_name_); - glDeleteTextures(1, &backGroundTextureName_); } state_ = AttachmentState::detached; } @@ -305,6 +303,8 @@ void OHOSExternalTextureGL::Detach() OH_NativeWindow_DestroyNativeWindow(backGroundNativeWindow_); backGroundNativeWindow_ = nullptr; } + glDeleteTextures(1, &texture_name_); + glDeleteTextures(1, &backGroundTextureName_); } void OHOSExternalTextureGL::UpdateTransform(OH_NativeImage *image) -- Gitee