do not create texture when texture render is not enabled

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-02-23 16:30:12 +08:00
parent 4cb6e82893
commit 275da850ff

View File

@ -126,6 +126,7 @@ class _RemotePageState extends State<RemotePage>
} }
// Register texture. // Register texture.
_textureId.value = -1; _textureId.value = -1;
if (useTextureRender) {
textureRenderer.createTexture(_textureKey).then((id) async { textureRenderer.createTexture(_textureKey).then((id) async {
debugPrint("id: $id, texture_key: $_textureKey"); debugPrint("id: $id, texture_key: $_textureKey");
if (id != -1) { if (id != -1) {
@ -134,6 +135,7 @@ class _RemotePageState extends State<RemotePage>
_textureId.value = id; _textureId.value = id;
} }
}); });
}
_ffi.ffiModel.updateEventListener(widget.id); _ffi.ffiModel.updateEventListener(widget.id);
_ffi.qualityMonitorModel.checkShowQualityMonitor(widget.id); _ffi.qualityMonitorModel.checkShowQualityMonitor(widget.id);
// Session option should be set after models.dart/FFI.start // Session option should be set after models.dart/FFI.start
@ -198,8 +200,10 @@ class _RemotePageState extends State<RemotePage>
@override @override
void dispose() { void dispose() {
debugPrint("REMOTE PAGE dispose ${widget.id}"); debugPrint("REMOTE PAGE dispose ${widget.id}");
if (useTextureRender) {
platformFFI.registerTexture(widget.id, 0); platformFFI.registerTexture(widget.id, 0);
textureRenderer.closeTexture(_textureKey); textureRenderer.closeTexture(_textureKey);
}
// ensure we leave this session, this is a double check // ensure we leave this session, this is a double check
bind.sessionEnterOrLeave(id: widget.id, enter: false); bind.sessionEnterOrLeave(id: widget.id, enter: false);
DesktopMultiWindow.removeListener(this); DesktopMultiWindow.removeListener(this);