qfbscreen.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/fbconvenience/qfbscreen.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QFbScreen::QFbScreen() : mUpdatePending(false), mCursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), mCompositePainter(0), mIsUpToDate(false)-
8{-
9}
never executed: end of block
0
10-
11QFbScreen::~QFbScreen()-
12{-
13 delete mCompositePainter;-
14 delete mScreenImage;-
15}
never executed: end of block
0
16-
17void QFbScreen::initializeCompositor()-
18{-
19 mScreenImage = new QImage(mGeometry.size(), mFormat);-
20 scheduleUpdate();-
21}
never executed: end of block
0
22-
23bool QFbScreen::event(QEvent *event)-
24{-
25 if (event->type() == QEvent::UpdateRequest
event->type() ...:UpdateRequestDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
26 doRedraw();-
27 mUpdatePending = false;-
28 return
never executed: return true;
true;
never executed: return true;
0
29 }-
30 return
never executed: return QObject::event(event);
QObject::event(event);
never executed: return QObject::event(event);
0
31}-
32-
33void QFbScreen::addWindow(QFbWindow *window)-
34{-
35 mWindowStack.prepend(window);-
36 if (!mPendingBackingStores.isEmpty()
!mPendingBacki...ores.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
37-
38 for (int i = 0; i < mPendingBackingStores.size()
i < mPendingBa...gStores.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
39 QFbBackingStore *bs = mPendingBackingStores.at(i);-
40-
41-
42 if (bs->window() == window->window()
bs->window() =...ndow->window()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
43 window->setBackingStore(bs);-
44 mPendingBackingStores.removeAt(i);-
45 break;
never executed: break;
0
46 }-
47 }
never executed: end of block
0
48 }
never executed: end of block
0
49 invalidateRectCache();-
50 setDirty(window->geometry());-
51 QWindow *w = topWindow();-
52 QWindowSystemInterface::handleWindowActivated(w);-
53 topWindowChanged(w);-
54}
never executed: end of block
0
55-
56void QFbScreen::removeWindow(QFbWindow *window)-
57{-
58 mWindowStack.removeOne(window);-
59 invalidateRectCache();-
60 setDirty(window->geometry());-
61 QWindow *w = topWindow();-
62 QWindowSystemInterface::handleWindowActivated(w);-
63 topWindowChanged(w);-
64}
never executed: end of block
0
65-
66void QFbScreen::raise(QFbWindow *window)-
67{-
68 int index = mWindowStack.indexOf(window);-
69 if (index <= 0
index <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
70 return;
never executed: return;
0
71 mWindowStack.move(index, 0);-
72 invalidateRectCache();-
73 setDirty(window->geometry());-
74 QWindow *w = topWindow();-
75 QWindowSystemInterface::handleWindowActivated(w);-
76 topWindowChanged(w);-
77}
never executed: end of block
0
78-
79void QFbScreen::lower(QFbWindow *window)-
80{-
81 int index = mWindowStack.indexOf(window);-
82 if (index == -1
index == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| index == (mWindowStack.size() - 1)
index == (mWin...ck.size() - 1)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
83 return;
never executed: return;
0
84 mWindowStack.move(index, mWindowStack.size() - 1);-
85 invalidateRectCache();-
86 setDirty(window->geometry());-
87 QWindow *w = topWindow();-
88 QWindowSystemInterface::handleWindowActivated(w);-
89 topWindowChanged(w);-
90}
never executed: end of block
0
91-
92QWindow *QFbScreen::topWindow() const-
93{-
94 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(mWindowStack)>::type> _container_((mWindowStack)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QFbWindow *fbw = *_container_.i; _container_.control; _container_.control = 0)-
95 if (fbw->window()->type() == Qt::Window
fbw->window()-... == Qt::WindowDescription
TRUEnever evaluated
FALSEnever evaluated
|| fbw->window()->type() == Qt::Dialog
fbw->window()-... == Qt::DialogDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
96 return
never executed: return fbw->window();
fbw->window();
never executed: return fbw->window();
0
97 return
never executed: return 0;
0;
never executed: return 0;
0
98}-
99-
100QWindow *QFbScreen::topLevelAt(const QPoint & p) const-
101{-
102 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(mWindowStack)>::type> _container_((mWindowStack)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QFbWindow *fbw = *_container_.i; _container_.control; _container_.control = 0) {-
103 if (fbw->geometry().contains(p, false)
fbw->geometry(...ains(p, false)Description
TRUEnever evaluated
FALSEnever evaluated
&& fbw->window()->isVisible()
fbw->window()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
104 return
never executed: return fbw->window();
fbw->window();
never executed: return fbw->window();
0
105 }
never executed: end of block
0
106 return
never executed: return 0;
0;
never executed: return 0;
0
107}-
108-
109void QFbScreen::setDirty(const QRect &rect)-
110{-
111 QRect intersection = rect.intersected(mGeometry);-
112 QPoint screenOffset = mGeometry.topLeft();-
113 mRepaintRegion += intersection.translated(-screenOffset);-
114 scheduleUpdate();-
115}
never executed: end of block
0
116-
117void QFbScreen::scheduleUpdate()-
118{-
119 if (!mUpdatePending
!mUpdatePendingDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
120 mUpdatePending = true;-
121 QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));-
122 }
never executed: end of block
0
123}
never executed: end of block
0
124-
125void QFbScreen::setPhysicalSize(const QSize &size)-
126{-
127 mPhysicalSize = size;-
128}
never executed: end of block
0
129-
130void QFbScreen::setGeometry(const QRect &rect)-
131{-
132 delete mCompositePainter;-
133 mCompositePainter = 0;-
134 delete mScreenImage;-
135 mGeometry = rect;-
136 mScreenImage = new QImage(mGeometry.size(), mFormat);-
137 invalidateRectCache();-
138 QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry());-
139 resizeMaximizedWindows();-
140}
never executed: end of block
0
141-
142void QFbScreen::generateRects()-
143{-
144 mCachedRects.clear();-
145 QPoint screenOffset = mGeometry.topLeft();-
146 QRegion remainingScreen(mGeometry.translated(-screenOffset));-
147-
148 for (int i = 0; i < mWindowStack.length()
i < mWindowStack.length()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
149 if (remainingScreen.isEmpty()
remainingScreen.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
150 break;
never executed: break;
0
151 }
never executed: end of block
0
152 const QVector<QRect> remainingScreenRects = remainingScreen.rects();-
153 mCachedRects.reserve(mCachedRects.count() + remainingScreenRects.count());-
154 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(remainingScreenRects)>::type> _container_((remainingScreenRects)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0)-
155 mCachedRects += QPair<QRect, int>(rect, -1);
never executed: mCachedRects += QPair<QRect, int>(rect, -1);
0
156 mIsUpToDate = true;-
157}
never executed: end of block
0
158-
159QRegion QFbScreen::doRedraw()-
160{-
161 QPoint screenOffset = mGeometry.topLeft();-
162-
163 QRegion touchedRegion;-
164 if (mCursor
mCursorDescription
TRUEnever evaluated
FALSEnever evaluated
&& mCursor->isDirty()
mCursor->isDirty()Description
TRUEnever evaluated
FALSEnever evaluated
&& mCursor->isOnScreen()
mCursor->isOnScreen()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
165 QRect lastCursor = mCursor->dirtyRect();-
166 mRepaintRegion += lastCursor;-
167 }
never executed: end of block
0
168 if (mRepaintRegion.isEmpty()
mRepaintRegion.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& (!mCursor
!mCursorDescription
TRUEnever evaluated
FALSEnever evaluated
|| !mCursor->isDirty()
!mCursor->isDirty()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
169 return
never executed: return touchedRegion;
touchedRegion;
never executed: return touchedRegion;
0
170 }-
171-
172 QVector<QRect> rects = mRepaintRegion.rects();-
173-
174 if (!mIsUpToDate
!mIsUpToDateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
175 generateRects();
never executed: generateRects();
0
176-
177 if (!mCompositePainter
!mCompositePainterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
178 mCompositePainter = new QPainter(mScreenImage);
never executed: mCompositePainter = new QPainter(mScreenImage);
0
179-
180 for (int rectIndex = 0; rectIndex < mRepaintRegion.rectCount()
rectIndex < mR...on.rectCount()Description
TRUEnever evaluated
FALSEnever evaluated
; rectIndex++) {
0
181 QRegion rectRegion = rects[rectIndex];-
182-
183 for (int i = 0; i < mCachedRects.length()
i < mCachedRects.length()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
184 QRect screenSubRect = mCachedRects[i].first;-
185 int layer = mCachedRects[i].second;-
186 QRegion intersect = rectRegion.intersected(screenSubRect);-
187-
188 if (intersect.isEmpty()
intersect.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
189 continue;
never executed: continue;
0
190-
191 rectRegion -= intersect;-
192-
193-
194 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(intersect.rects())>::type> _container_((intersect.rects())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QRect &rect = *_container_.i; _container_.control; _container_.control = 0) {-
195 bool firstLayer = true;-
196 if (layer == -1
layer == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
197 mCompositePainter->setCompositionMode(QPainter::CompositionMode_Source);-
198 mCompositePainter->fillRect(rect, mScreenImage->hasAlphaChannel() ? Qt::transparent : Qt::black);-
199 firstLayer = false;-
200 layer = mWindowStack.size() - 1;-
201 }
never executed: end of block
0
202-
203 for (int layerIndex = layer; layerIndex != -1
layerIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
; layerIndex--) {
0
204 if (!mWindowStack[layerIndex]->window()->isVisible()
!mWindowStack[...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
205 continue;
never executed: continue;
0
206-
207-
208-
209 QRect windowRect = mWindowStack[layerIndex]->geometry().translated(-screenOffset);-
210 QRect windowIntersect = rect.translated(-windowRect.left(),-
211 -windowRect.top());-
212-
213-
214 QFbBackingStore *backingStore = mWindowStack[layerIndex]->backingStore();-
215-
216 if (backingStore
backingStoreDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
217 backingStore->lock();-
218 mCompositePainter->drawImage(rect, backingStore->image(), windowIntersect);-
219 backingStore->unlock();-
220 }
never executed: end of block
0
221 if (firstLayer
firstLayerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
222 firstLayer = false;-
223 }
never executed: end of block
0
224 }
never executed: end of block
0
225 }
never executed: end of block
0
226 }
never executed: end of block
0
227 }
never executed: end of block
0
228-
229 QRect cursorRect;-
230 if (mCursor
mCursorDescription
TRUEnever evaluated
FALSEnever evaluated
&& (mCursor->isDirty()
mCursor->isDirty()Description
TRUEnever evaluated
FALSEnever evaluated
|| mRepaintRegion.intersects(mCursor->lastPainted())
mRepaintRegion...lastPainted())Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
231 mCompositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver);-
232 cursorRect = mCursor->drawCursor(*mCompositePainter);-
233 touchedRegion += cursorRect;-
234 }
never executed: end of block
0
235 touchedRegion += mRepaintRegion;-
236 mRepaintRegion = QRegion();-
237-
238-
239-
240-
241-
242 return
never executed: return touchedRegion;
touchedRegion;
never executed: return touchedRegion;
0
243}-
244-
245QFbWindow *QFbScreen::windowForId(WId wid) const-
246{-
247 for (int i = 0; i < mWindowStack.count()
i < mWindowStack.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
248 if (mWindowStack[i]->winId() == wid
mWindowStack[i...winId() == widDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
249 return
never executed: return mWindowStack[i];
mWindowStack[i];
never executed: return mWindowStack[i];
0
250-
251 return
never executed: return 0;
0;
never executed: return 0;
0
252}-
253-
254-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9