updateSnapshot method
由 MiuixLayerBackdropCapture 在每帧录制后调用,更新快照与坐标。
旧快照在替换后被释放(Flutter 的 ui.Image 需显式 dispose)。
Implementation
void updateSnapshot(ui.Image image, Offset globalOffset, double pixelRatio) {
final old = _snapshot;
_snapshot = image;
_globalOffset = globalOffset;
_pixelRatio = pixelRatio;
// 先通知再释放旧图,避免正在使用旧图的绘制被拉黑。
notifyListeners();
if (old != null && !identical(old, image)) {
old.dispose();
}
}