Commit 31b810400e247b83b03850fef4ab6f5f3e4f6323
1 parent
c598b01b22
Exists in
master
and in
2 other branches
Qt5 Linuxfb 화면 회전 패치
Showing
1 changed file
with
102 additions
and
0 deletions
Show diff stats
buildroot/buildroot-2016.08.1/package/qt5/qt5base/0008-linuxfb-rotate.patch
| ... | ... | @@ -0,0 +1,102 @@ |
| 1 | +diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp | |
| 2 | +--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp 2017-03-06 15:43:16.205457343 +0900 | |
| 3 | ++++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp 2017-03-06 13:38:20.857076470 +0900 | |
| 4 | +@@ -280,7 +280,7 @@ | |
| 5 | + } | |
| 6 | + | |
| 7 | + QLinuxFbScreen::QLinuxFbScreen(const QStringList &args) | |
| 8 | +- : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0) | |
| 9 | ++ : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0), mRotation(0) | |
| 10 | + { | |
| 11 | + mMmap.data = 0; | |
| 12 | + } | |
| 13 | +@@ -306,6 +306,7 @@ | |
| 14 | + QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); | |
| 15 | + QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); | |
| 16 | + QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); | |
| 17 | ++ QRegularExpression rotationRx(QLatin1String("rotation=(0|90|180|270)")); | |
| 18 | + | |
| 19 | + QString fbDevice, ttyDevice; | |
| 20 | + QSize userMmSize; | |
| 21 | +@@ -327,6 +328,8 @@ | |
| 22 | + ttyDevice = match.captured(1); | |
| 23 | + else if (arg.contains(fbRx, &match)) | |
| 24 | + fbDevice = match.captured(1); | |
| 25 | ++ else if (arg.contains(rotationRx, &match)) | |
| 26 | ++ mRotation = match.captured(1).toInt(); | |
| 27 | + } | |
| 28 | + | |
| 29 | + if (fbDevice.isEmpty()) { | |
| 30 | +@@ -365,9 +368,17 @@ | |
| 31 | + mDepth = determineDepth(vinfo); | |
| 32 | + mBytesPerLine = finfo.line_length; | |
| 33 | + QRect geometry = determineGeometry(vinfo, userGeometry); | |
| 34 | ++ QRect originalGeometry = geometry; | |
| 35 | ++ if( mRotation == 90 || mRotation == 270 ) | |
| 36 | ++ { | |
| 37 | ++ int tmp = geometry.width(); | |
| 38 | ++ geometry.setWidth(geometry.height()); | |
| 39 | ++ geometry.setHeight(tmp); | |
| 40 | ++ } | |
| 41 | ++ | |
| 42 | + mGeometry = QRect(QPoint(0, 0), geometry.size()); | |
| 43 | + mFormat = determineFormat(vinfo, mDepth); | |
| 44 | +- mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, geometry.size()); | |
| 45 | ++ mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, originalGeometry.size()); | |
| 46 | + | |
| 47 | + // mmap the framebuffer | |
| 48 | + mMmap.size = finfo.smem_len; | |
| 49 | +@@ -377,11 +388,11 @@ | |
| 50 | + return false; | |
| 51 | + } | |
| 52 | + | |
| 53 | +- mMmap.offset = geometry.y() * mBytesPerLine + geometry.x() * mDepth / 8; | |
| 54 | ++ mMmap.offset = originalGeometry.y() * mBytesPerLine + originalGeometry.x() * mDepth / 8; | |
| 55 | + mMmap.data = data + mMmap.offset; | |
| 56 | + | |
| 57 | + QFbScreen::initializeCompositor(); | |
| 58 | +- mFbScreenImage = QImage(mMmap.data, geometry.width(), geometry.height(), mBytesPerLine, mFormat); | |
| 59 | ++ mFbScreenImage = QImage(mMmap.data, originalGeometry.width(), originalGeometry.height(), mBytesPerLine, mFormat); | |
| 60 | + | |
| 61 | + mCursor = new QFbCursor(this); | |
| 62 | + | |
| 63 | +@@ -409,8 +420,27 @@ | |
| 64 | + mBlitter->setCompositionMode(QPainter::CompositionMode_Source); | |
| 65 | + | |
| 66 | + for (int i = 0; i < rects.size(); ++i) | |
| 67 | ++ { | |
| 68 | ++ if( mRotation == 90 || mRotation == 270 ) | |
| 69 | ++ { | |
| 70 | ++ mBlitter->translate(mGeometry.height()/2, mGeometry.width()/2); | |
| 71 | ++ } | |
| 72 | ++ else if( mRotation == 180 ) | |
| 73 | ++ { | |
| 74 | ++ mBlitter->translate(mGeometry.width()/2, mGeometry.height()/2); | |
| 75 | ++ } | |
| 76 | ++ | |
| 77 | ++ if( mRotation != 0 ) | |
| 78 | ++ { | |
| 79 | ++ mBlitter->rotate(mRotation); | |
| 80 | ++ mBlitter->translate(-mGeometry.width()/2, -mGeometry.height()/2); | |
| 81 | ++ } | |
| 82 | ++ | |
| 83 | + mBlitter->drawImage(rects[i], *mScreenImage, rects[i]); | |
| 84 | + | |
| 85 | ++ mBlitter->resetTransform(); | |
| 86 | ++ } | |
| 87 | ++ | |
| 88 | + return touched; | |
| 89 | + } | |
| 90 | + | |
| 91 | +diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h | |
| 92 | +--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h 2016-05-26 00:46:17.000000000 +0900 | |
| 93 | ++++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h 2017-03-06 13:38:20.857076470 +0900 | |
| 94 | +@@ -58,6 +58,7 @@ | |
| 95 | + QStringList mArgs; | |
| 96 | + int mFbFd; | |
| 97 | + int mTtyFd; | |
| 98 | ++ int mRotation; | |
| 99 | + | |
| 100 | + QImage mFbScreenImage; | |
| 101 | + int mBytesPerLine; | |
| 102 | + | ... | ... |