wait for image

This commit is contained in:
open-trade 2020-11-19 00:53:10 +08:00
parent b594c8836e
commit 0bb1c71b87

View File

@ -26,6 +26,7 @@ class FfiModel with ChangeNotifier {
PeerInfo _pi = PeerInfo(); PeerInfo _pi = PeerInfo();
Display _display = Display(); Display _display = Display();
bool _decoding = false; bool _decoding = false;
bool _waitForImage = false;
FfiModel() { FfiModel() {
init(); init();
@ -61,6 +62,10 @@ class FfiModel with ChangeNotifier {
if (!_decoding) { if (!_decoding) {
var rgba = FFI.getRgba(); var rgba = FFI.getRgba();
if (rgba != null) { if (rgba != null) {
if (_waitForImage) {
_waitForImage = false;
dismissLoading();
}
_decoding = true; _decoding = true;
ui.decodeImageFromPixels( ui.decodeImageFromPixels(
rgba, _display.width, _display.height, ui.PixelFormat.bgra8888, rgba, _display.width, _display.height, ui.PixelFormat.bgra8888,
@ -120,6 +125,10 @@ class FfiModel with ChangeNotifier {
_display = _pi.displays[_pi.currentDisplay]; _display = _pi.displays[_pi.currentDisplay];
FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y); FFI.cursorModel.updateDisplayOrigin(_display.x, _display.y);
} }
if (displays.length > 1) {
showLoading('Waiting for image...');
_waitForImage = true;
}
} }
} }