!47551 解决Component3D旋转黑边问题

Merge pull request !47551 from 何浩/master
This commit is contained in:
openharmony_ci 2024-11-05 04:19:05 +00:00 committed by Gitee
commit c4357b4a6b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -68,16 +68,14 @@ std::shared_future<void> ModelAdapterWrapper::Deinit()
} }
#endif #endif
std::shared_ptr<Render3D::WidgetAdapter> widgetAdapter(widgetAdapter_); std::shared_ptr<Render3D::WidgetAdapter> widgetAdapter(widgetAdapter_);
std::shared_ptr<Render3D::TextureLayer> textureLayer(textureLayer_);
auto key = key_; auto key = key_;
return Render3D::GraphicsTask::GetInstance().PushAsyncMessage([widgetAdapter, textureLayer, key] { textureLayer_->DestroyRenderTarget();
return Render3D::GraphicsTask::GetInstance().PushAsyncMessage([widgetAdapter, key] {
ACE_SCOPED_TRACE("ModelAdapterWrapper::Deinit render"); ACE_SCOPED_TRACE("ModelAdapterWrapper::Deinit render");
CHECK_NULL_VOID(widgetAdapter); CHECK_NULL_VOID(widgetAdapter);
widgetAdapter->DeInitEngine(); widgetAdapter->DeInitEngine();
Render3D::GraphicsManager::GetInstance().UnRegister(key); Render3D::GraphicsManager::GetInstance().UnRegister(key);
CHECK_NULL_VOID(textureLayer);
textureLayer->DestroyRenderTarget();
}); });
} }
@ -88,14 +86,14 @@ void ModelAdapterWrapper::CreateTextureLayer()
return; return;
} }
#endif #endif
Render3D::GraphicsTask::GetInstance().PushAsyncMessage([weak = WeakClaim(this)] { const auto& key = GetKey();
textureLayer_ = std::make_shared<Render3D::TextureLayer>(key);
Render3D::GraphicsTask::GetInstance().PushAsyncMessage([weak = WeakClaim(this), key] {
auto adapter = weak.Upgrade(); auto adapter = weak.Upgrade();
CHECK_NULL_VOID(adapter); CHECK_NULL_VOID(adapter);
auto& gfxManager = Render3D::GraphicsManager::GetInstance(); auto& gfxManager = Render3D::GraphicsManager::GetInstance();
const auto& key = adapter->GetKey();
gfxManager.Register(key); gfxManager.Register(key);
adapter->textureLayer_ = std::make_shared<Render3D::TextureLayer>(key);
}); });
} }
@ -152,14 +150,14 @@ void ModelAdapterWrapper::OnDirtyLayoutWrapperSwap(const Render3D::WindowChangeI
return; return;
} }
#endif #endif
Render3D::GraphicsTask::GetInstance().PushAsyncMessage([weak = WeakClaim(this), windowChangeInfo] { textureLayer_->OnWindowChange(windowChangeInfo);
const auto textureInfo = textureLayer_->GetTextureInfo();
Render3D::GraphicsTask::GetInstance().PushAsyncMessage([weak = WeakClaim(this), textureInfo] {
auto adapter = weak.Upgrade(); auto adapter = weak.Upgrade();
CHECK_NULL_VOID(adapter); CHECK_NULL_VOID(adapter);
CHECK_NULL_VOID(adapter->textureLayer_);
CHECK_NULL_VOID(adapter->widgetAdapter_); CHECK_NULL_VOID(adapter->widgetAdapter_);
adapter->textureLayer_->OnWindowChange(windowChangeInfo); adapter->widgetAdapter_->OnWindowChange(textureInfo);
adapter->widgetAdapter_->OnWindowChange(adapter->textureLayer_->GetTextureInfo());
}); });
} }
@ -169,20 +167,7 @@ void ModelAdapterWrapper::OnRebuildFrame(RefPtr<RenderContext>& context)
auto rsContext = DynamicCast<NG::RosenRenderContext>(context); auto rsContext = DynamicCast<NG::RosenRenderContext>(context);
CHECK_NULL_VOID(rsContext); CHECK_NULL_VOID(rsContext);
auto rsNode = rsContext->GetRSNode(); auto rsNode = rsContext->GetRSNode();
#if defined(KIT_3D_ENABLE) textureLayer_->SetParent(rsNode);
if (sceneAdapter_) {
CHECK_NULL_VOID(textureLayer_);
textureLayer_->SetParent(rsNode);
return;
}
#endif
Render3D::GraphicsTask::GetInstance().PushAsyncMessage([weak = WeakClaim(this), rsNode]() mutable {
auto adapter = weak.Upgrade();
CHECK_NULL_VOID(adapter);
CHECK_NULL_VOID(adapter->textureLayer_);
adapter->textureLayer_->SetParent(rsNode);
});
#endif #endif
} }