diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp 2017-03-06 15:43:16.205457343 +0900 +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp 2017-03-06 13:38:20.857076470 +0900 @@ -280,7 +280,7 @@ } QLinuxFbScreen::QLinuxFbScreen(const QStringList &args) - : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0) + : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0), mRotation(0) { mMmap.data = 0; } @@ -306,6 +306,7 @@ 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; @@ -327,6 +328,8 @@ 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()) { @@ -365,9 +368,17 @@ 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; @@ -377,11 +388,11 @@ 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); mCursor = new QFbCursor(this); @@ -409,8 +420,27 @@ mBlitter->setCompositionMode(QPainter::CompositionMode_Source); 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/plugins/platforms/linuxfb/qlinuxfbscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h 2016-05-26 00:46:17.000000000 +0900 +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h 2017-03-06 13:38:20.857076470 +0900 @@ -58,6 +58,7 @@ QStringList mArgs; int mFbFd; int mTtyFd; + int mRotation; QImage mFbScreenImage; int mBytesPerLine;