1
0
Fork 0
forked from wry/wry

all: use let chains

This commit is contained in:
Julian Orth 2025-07-01 11:20:48 +02:00
parent 3d5d146d65
commit 286857971a
89 changed files with 1516 additions and 1574 deletions

View file

@ -102,13 +102,12 @@ impl ExtImageCopyCaptureFrameV1 {
let mut shm_staging = self.session.shm_staging.take();
match storage {
WlBufferStorage::Shm { mem, stride } => {
if let Some(b) = &shm_bridge {
if b.physical_size() != buffer.rect.size()
if let Some(b) = &shm_bridge
&& (b.physical_size() != buffer.rect.size()
|| b.format() != buffer.format
|| b.stride() != *stride
{
shm_bridge = None;
}
|| b.stride() != *stride)
{
shm_bridge = None;
}
let bridge = match shm_bridge {
Some(b) => b,
@ -129,10 +128,10 @@ impl ExtImageCopyCaptureFrameV1 {
}
}
};
if let Some(s) = &shm_staging {
if s.size() != bridge.staging_size() {
shm_staging = None;
}
if let Some(s) = &shm_staging
&& s.size() != bridge.staging_size()
{
shm_staging = None;
}
let staging = match shm_staging {
Some(s) => s,

View file

@ -125,10 +125,10 @@ impl ExtImageCopyCaptureSessionV1 {
}
fn stop_pending_frame(&self) {
if let Some(frame) = self.frame.get() {
if let FrameStatus::Capturing | FrameStatus::Captured = self.status.get() {
frame.fail(FrameFailureReason::Stopped);
}
if let Some(frame) = self.frame.get()
&& let FrameStatus::Capturing | FrameStatus::Captured = self.status.get()
{
frame.fail(FrameFailureReason::Stopped);
}
}
@ -223,22 +223,22 @@ impl ExtImageCopyCaptureSessionV1 {
y_off: i32,
size: Option<(i32, i32)>,
) {
if self.status.get() == FrameStatus::Capturing {
if let Some(frame) = self.frame.get() {
frame.copy_texture(
on,
texture,
cd,
resv,
acquire_sync,
release_sync,
render_hardware_cursors,
x_off,
y_off,
size,
);
return;
}
if self.status.get() == FrameStatus::Capturing
&& let Some(frame) = self.frame.get()
{
frame.copy_texture(
on,
texture,
cd,
resv,
acquire_sync,
release_sync,
render_hardware_cursors,
x_off,
y_off,
size,
);
return;
}
self.force_capture.set(true);
}