基本信息
源码名称:qt5 旋转(.patch文件源码)
源码大小:1.40KB
文件格式:.zip
开发语言:C/C++
更新时间:2019-02-19
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
qt5 旋转
qt5 旋转
diff --git a/src.orig/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
index a66c9fa..a5b5f13 100644
--- a/src.orig/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
@@ -290,7 290,7 @@ static void blankScreen(int fd, bool on)
}
QLinuxFbScreen::QLinuxFbScreen(const QStringList &args)
- : mArgs(args), mFbFd(-1), mBlitter(0)
: mArgs(args), mFbFd(-1), mBlitter(0), mRotation(90)
{
}
@@ -316,6 316,7 @@ bool QLinuxFbScreen::initialize()
QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d )x(\\d )"));
QRegularExpression sizeRx(QLatin1String("size=(\\d )x(\\d )"));
QRegularExpression offsetRx(QLatin1String("offset=(\\d )x(\\d )"));
QRegularExpression rotationRx(QLatin1String("rotation=(0|90|180|270)"));
QString fbDevice, ttyDevice;
QSize userMmSize;
@@ -337,6 338,8 @@ bool QLinuxFbScreen::initialize()
ttyDevice = match.captured(1);
else if (arg.contains(fbRx, &match))
fbDevice = match.captured(1);
else if (arg.contains(rotationRx, &match))
mRotation = match.captured(1).toInt();
}
if (fbDevice.isEmpty()) {
@@ -375,9 378,17 @@ bool QLinuxFbScreen::initialize()
mDepth = determineDepth(vinfo);
mBytesPerLine = finfo.line_length;
QRect geometry = determineGeometry(vinfo, userGeometry);
QRect originalGeometry = geometry;
if( mRotation == 90 || mRotation == 270 )
{
int tmp = geometry.width();
geometry.setWidth(geometry.height());
geometry.setHeight(tmp);
}
mGeometry = QRect(QPoint(0, 0), geometry.size());
mFormat = determineFormat(vinfo, mDepth);
- mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, geometry.size());
mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, originalGeometry.size());
// mmap the framebuffer
mMmap.size = finfo.smem_len;
@@ -387,11 398,11 @@ bool QLinuxFbScreen::initialize()
return false;
}
- mMmap.offset = geometry.y() * mBytesPerLine geometry.x() * mDepth / 8;
mMmap.offset = originalGeometry.y() * mBytesPerLine originalGeometry.x() * mDepth / 8;
mMmap.data = data mMmap.offset;
QFbScreen::initializeCompositor();
- mFbScreenImage = QImage(mMmap.data, geometry.width(), geometry.height(), mBytesPerLine, mFormat);
mFbScreenImage = QImage(mMmap.data, originalGeometry.width(), originalGeometry.height(), mBytesPerLine, mFormat);
QByteArray hideCursorVal = qgetenv("QT_QPA_FB_HIDECURSOR");
#if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK)
@@ -436,7 447,26 @@ QRegion QLinuxFbScreen::doRedraw()
QVector<QRect> rects = touched.rects();
for (int i = 0; i < rects.size(); i )
{
if( mRotation == 90 || mRotation == 270 )
{
mBlitter->translate(mGeometry.height()/2, mGeometry.width()/2);
}
else if( mRotation == 180 )
{
mBlitter->translate(mGeometry.width()/2, mGeometry.height()/2);
}
if( mRotation != 0 )
{
mBlitter->rotate(mRotation);
mBlitter->translate(-mGeometry.width()/2, -mGeometry.height()/2);
}
mBlitter->drawImage(rects[i], *mScreenImage, rects[i]);
mBlitter->resetTransform();
}
return touched;
}
diff --git a/src.orig/plugins/platforms/linuxfb/qlinuxfbscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h
index 1997d46..a34414f 100644
--- a/src.orig/plugins/platforms/linuxfb/qlinuxfbscreen.h
b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h
@@ -57,6 57,7 @@ private:
QStringList mArgs;
int mFbFd;
int mTtyFd;
int mRotation;
QImage mFbScreenImage;
int mBytesPerLine;