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,14 +126,16 @@ class _RemotePageState extends State<RemotePage>
} }
// Register texture. // Register texture.
_textureId.value = -1; _textureId.value = -1;
textureRenderer.createTexture(_textureKey).then((id) async { if (useTextureRender) {
debugPrint("id: $id, texture_key: $_textureKey"); textureRenderer.createTexture(_textureKey).then((id) async {
if (id != -1) { debugPrint("id: $id, texture_key: $_textureKey");
final ptr = await textureRenderer.getTexturePtr(_textureKey); if (id != -1) {
platformFFI.registerTexture(widget.id, ptr); final ptr = await textureRenderer.getTexturePtr(_textureKey);
_textureId.value = id; platformFFI.registerTexture(widget.id, ptr);
} _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}");
platformFFI.registerTexture(widget.id, 0); if (useTextureRender) {
textureRenderer.closeTexture(_textureKey); platformFFI.registerTexture(widget.id, 0);
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);