35 QRegularExpression sizeRx(
"size=(\\d+)x(\\d+)"_L1);
36 QRegularExpression mmSizeRx(
"mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)"_L1);
37 QRegularExpression depthRx(
"depth=(\\d+)"_L1);
39 mGeometry = QRect(0, 0, 1024, 768);
40 mFormat = QImage::Format_ARGB32_Premultiplied;
42 mPhysicalSize = QSizeF(mGeometry.width()/96.*25.4, mGeometry.height()/96.*25.4);
44 for (
const QString &arg : std::as_const(mArgs)) {
45 QRegularExpressionMatch match;
46 if (arg.contains(mmSizeRx, &match)) {
47 mPhysicalSize = QSizeF(match.captured(
"width").toDouble(), match.captured(
"height").toDouble());
48 }
else if (arg.contains(sizeRx, &match)) {
49 mGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt()));
50 }
else if (arg.contains(depthRx, &match)) {
51 mDepth = match.captured(1).toInt();
57 dirty =
new QVncDirtyMapOptimized<quint32>(
this);
60 dirty =
new QVncDirtyMapOptimized<quint16>(
this);
61 mFormat = QImage::Format_RGB16;
64 dirty =
new QVncDirtyMapOptimized<quint8>(
this);
67 qWarning(
"QVNCScreen::initDevice: No support for screen depth %d",
73 QFbScreen::initializeCompositor();
75 setPowerState(PowerStateOff);
140 width = mScreenImage.width() - x;
142 height = mScreenImage.height() - y;
143 return QPixmap::fromImage(mScreenImage).copy(x, y, width, height);
146 QFbWindow *window = windowForId(wid);
148 const QRect geom = window->geometry();
150 width = geom.width() - x;
152 height = geom.height() - y;
153 QRect rect(geom.topLeft() + QPoint(x, y), QSize(width, height));
154 rect &= window->geometry();
155 return QPixmap::fromImage(mScreenImage).copy(rect);
QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override
This function is called when Qt needs to be able to grab the content of a window.