Screenshot effect: factorize code

icc-effect-master
Méven Car 2020-08-12 15:41:30 +02:00 committed by Méven Car
parent 3450adf5d1
commit c6393a936b
1 changed files with 1 additions and 15 deletions

View File

@ -322,22 +322,8 @@ void ScreenShotEffect::postPaintScreen()
const xcb_pixmap_t xpix = xpixmapFromImage(img);
emit screenshotCreated(xpix);
m_windowMode = WindowMode::NoCapture;
} else if (m_windowMode == WindowMode::File) {
} else if (m_windowMode == WindowMode::File || m_windowMode == WindowMode::FileDescriptor) {
sendReplyImage(img);
} else if (m_windowMode == WindowMode::FileDescriptor) {
QtConcurrent::run(
[] (int fd, const QImage &img) {
QFile file;
if (file.open(fd, QIODevice::WriteOnly, QFileDevice::AutoCloseHandle)) {
QDataStream ds(&file);
ds << img;
file.close();
} else {
close(fd);
}
}, m_fd, img);
m_windowMode = WindowMode::NoCapture;
m_fd = -1;
}
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (xImage) {