Blame view

buildroot/buildroot-2016.08.1/package/qt5/qt5base/0008-linuxfb-rotation.patch 3.59 KB
31b810400   김태훈   Qt5 Linuxfb 화면 회전 패치
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  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;