mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 23:21:05 +00:00
commit
c4357b4a6b
@ -68,16 +68,14 @@ std::shared_future<void> ModelAdapterWrapper::Deinit()
|
||||
}
|
||||
#endif
|
||||
std::shared_ptr<Render3D::WidgetAdapter> widgetAdapter(widgetAdapter_);
|
||||
std::shared_ptr<Render3D::TextureLayer> textureLayer(textureLayer_);
|
||||
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");
|
||||
|
||||
CHECK_NULL_VOID(widgetAdapter);
|
||||
widgetAdapter->DeInitEngine();
|
||||
Render3D::GraphicsManager::GetInstance().UnRegister(key);
|
||||
CHECK_NULL_VOID(textureLayer);
|
||||
textureLayer->DestroyRenderTarget();
|
||||
});
|
||||
}
|
||||
|
||||
@ -88,14 +86,14 @@ void ModelAdapterWrapper::CreateTextureLayer()
|
||||
return;
|
||||
}
|
||||
#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();
|
||||
CHECK_NULL_VOID(adapter);
|
||||
|
||||
auto& gfxManager = Render3D::GraphicsManager::GetInstance();
|
||||
const auto& key = adapter->GetKey();
|
||||
gfxManager.Register(key);
|
||||
adapter->textureLayer_ = std::make_shared<Render3D::TextureLayer>(key);
|
||||
});
|
||||
}
|
||||
|
||||
@ -152,14 +150,14 @@ void ModelAdapterWrapper::OnDirtyLayoutWrapperSwap(const Render3D::WindowChangeI
|
||||
return;
|
||||
}
|
||||
#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();
|
||||
CHECK_NULL_VOID(adapter);
|
||||
CHECK_NULL_VOID(adapter->textureLayer_);
|
||||
CHECK_NULL_VOID(adapter->widgetAdapter_);
|
||||
|
||||
adapter->textureLayer_->OnWindowChange(windowChangeInfo);
|
||||
adapter->widgetAdapter_->OnWindowChange(adapter->textureLayer_->GetTextureInfo());
|
||||
adapter->widgetAdapter_->OnWindowChange(textureInfo);
|
||||
});
|
||||
}
|
||||
|
||||
@ -169,20 +167,7 @@ void ModelAdapterWrapper::OnRebuildFrame(RefPtr<RenderContext>& context)
|
||||
auto rsContext = DynamicCast<NG::RosenRenderContext>(context);
|
||||
CHECK_NULL_VOID(rsContext);
|
||||
auto rsNode = rsContext->GetRSNode();
|
||||
#if defined(KIT_3D_ENABLE)
|
||||
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);
|
||||
});
|
||||
textureLayer_->SetParent(rsNode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user