1,修改Qt5源码:
(1) 修改linuxfb/qlinuxfbscreen.h,如下所示:
class QLinuxFbScreen : public QFbScreen
{
Q_OBJECT
public:
QLinuxFbScreen(const QStringList &args);
~QLinuxFbScreen();
bool initialize();
QPixmap grabWindow(WId wid, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
QRegion doRedraw() Q_DECL_OVERRIDE;
private:
QStringList mArgs;
int mFbFd;
int mTtyFd;
// add by immortal start
int mRotation;
// add by immortal end
QImage mFbScreenImage;
int mBytesPerLine;
int mOldTtyMode;
struct {
uchar *data;
int offset, size;
} mMmap;
QPainter *mBlitter;
};
(2) 修改linuxfb/qlinuxfbscreen.cpp,如下所示:
QLinuxFbScreen::QLinuxFbScreen(const QStringList &args)
// : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0) // modify by immortal
: mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0),mRotation(0)
{
mMmap.data = 0;
}
QLinuxFbScreen::~QLinuxFbScreen()
{
if (mFbFd != -1) {
if (mMmap.data)
munmap(mMmap.data - mMmap.offset, mMmap.size);
close(mFbFd);
}
if (mTtyFd != -1)
resetTty(mTtyFd, mOldTtyMode);
delete mBlitter;
}
bool QLinuxFbScreen::initialize()
{
QRegularExpression ttyRx(QLatin1String("tty=(.*)"));
QRegularExpression fbRx(QLatin1String("fb=(.*)"));
QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)"));
QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)"));
// add by immorta start
QRegularExpression rotationRx(QLatin1String("rotation=(0|90|180|270)"))
// add by immorta end
QString fbDevice, ttyDevice;
QSize userMmSize;
QRect userGeometry;
bool doSwitchToGraphicsMode = true;
// Parse arguments
foreach (const QString &arg, mArgs) {
QRegularExpressionMatch match;
if (arg =&#