kernel/qscreen.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4QScreen::QScreen(QPlatformScreen *screen) -
5 : QObject(*new QScreenPrivate(screen), 0) -
6{ -
7}
executed: }
Execution Count:289
289
8 -
9 -
10 -
11 -
12QPlatformScreen *QScreen::handle() const -
13{ -
14 const QScreenPrivate * const d = d_func(); -
15 return d->platformScreen;
executed: return d->platformScreen;
Execution Count:214893
214893
16} -
17QString QScreen::name() const -
18{ -
19 const QScreenPrivate * const d = d_func(); -
20 return d->platformScreen->name();
never executed: return d->platformScreen->name();
0
21} -
22 -
23 -
24 -
25 -
26 -
27int QScreen::depth() const -
28{ -
29 const QScreenPrivate * const d = d_func(); -
30 return d->platformScreen->depth();
executed: return d->platformScreen->depth();
Execution Count:257
257
31} -
32 -
33 -
34 -
35 -
36 -
37QSize QScreen::size() const -
38{ -
39 const QScreenPrivate * const d = d_func(); -
40 return d->geometry.size();
executed: return d->geometry.size();
Execution Count:32
32
41} -
42qreal QScreen::physicalDotsPerInchX() const -
43{ -
44 return size().width() / physicalSize().width() * qreal(25.4);
executed: return size().width() / physicalSize().width() * qreal(25.4);
Execution Count:16
16
45} -
46qreal QScreen::physicalDotsPerInchY() const -
47{ -
48 return size().height() / physicalSize().height() * qreal(25.4);
executed: return size().height() / physicalSize().height() * qreal(25.4);
Execution Count:16
16
49} -
50qreal QScreen::physicalDotsPerInch() const -
51{ -
52 QSize sz = size(); -
53 QSizeF psz = physicalSize(); -
54 return ((sz.height() / psz.height()) + (sz.width() / psz.width())) * qreal(25.4 * 0.5);
never executed: return ((sz.height() / psz.height()) + (sz.width() / psz.width())) * qreal(25.4 * 0.5);
0
55} -
56qreal QScreen::logicalDotsPerInchX() const -
57{ -
58 const QScreenPrivate * const d = d_func(); -
59 return d->logicalDpi.first;
executed: return d->logicalDpi.first;
Execution Count:213
213
60} -
61qreal QScreen::logicalDotsPerInchY() const -
62{ -
63 const QScreenPrivate * const d = d_func(); -
64 return d->logicalDpi.second;
executed: return d->logicalDpi.second;
Execution Count:123604
123604
65} -
66qreal QScreen::logicalDotsPerInch() const -
67{ -
68 const QScreenPrivate * const d = d_func(); -
69 QDpi dpi = d->logicalDpi; -
70 return (dpi.first + dpi.second) * qreal(0.5);
never executed: return (dpi.first + dpi.second) * qreal(0.5);
0
71} -
72qreal QScreen::devicePixelRatio() const -
73{ -
74 const QScreenPrivate * const d = d_func(); -
75 return d->platformScreen->devicePixelRatio();
executed: return d->platformScreen->devicePixelRatio();
Execution Count:2
2
76} -
77QSizeF QScreen::physicalSize() const -
78{ -
79 const QScreenPrivate * const d = d_func(); -
80 return d->platformScreen->physicalSize();
executed: return d->platformScreen->physicalSize();
Execution Count:32
32
81} -
82QSize QScreen::availableSize() const -
83{ -
84 const QScreenPrivate * const d = d_func(); -
85 return d->availableGeometry.size();
never executed: return d->availableGeometry.size();
0
86} -
87QRect QScreen::geometry() const -
88{ -
89 const QScreenPrivate * const d = d_func(); -
90 return d->geometry;
executed: return d->geometry;
Execution Count:5480
5480
91} -
92QRect QScreen::availableGeometry() const -
93{ -
94 const QScreenPrivate * const d = d_func(); -
95 return d->availableGeometry;
executed: return d->availableGeometry;
Execution Count:3620
3620
96} -
97QList<QScreen *> QScreen::virtualSiblings() const -
98{ -
99 const QScreenPrivate * const d = d_func(); -
100 QList<QPlatformScreen *> platformScreens = d->platformScreen->virtualSiblings(); -
101 QList<QScreen *> screens; -
102 for (QForeachContainer<__typeof__(platformScreens)> _container_(platformScreens); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QPlatformScreen *platformScreen = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
103 screens << platformScreen->screen();
executed: screens << platformScreen->screen();
Execution Count:388
388
104 return screens;
executed: return screens;
Execution Count:388
388
105} -
106QSize QScreen::virtualSize() const -
107{ -
108 return virtualGeometry().size();
never executed: return virtualGeometry().size();
0
109} -
110QRect QScreen::virtualGeometry() const -
111{ -
112 QRect result; -
113 for (QForeachContainer<__typeof__(virtualSiblings())> _container_(virtualSiblings()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QScreen *screen = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
114 result |= screen->geometry();
never executed: result |= screen->geometry();
0
115 return result;
never executed: return result;
0
116} -
117QSize QScreen::availableVirtualSize() const -
118{ -
119 return availableVirtualGeometry().size();
never executed: return availableVirtualGeometry().size();
0
120} -
121QRect QScreen::availableVirtualGeometry() const -
122{ -
123 QRect result; -
124 for (QForeachContainer<__typeof__(virtualSiblings())> _container_(virtualSiblings()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QScreen *screen = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
125 result |= screen->availableGeometry();
never executed: result |= screen->availableGeometry();
0
126 return result;
never executed: return result;
0
127} -
128void QScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) -
129{ -
130 QScreenPrivate * const d = d_func(); -
131 d->orientationUpdateMask = mask; -
132 d->platformScreen->setOrientationUpdateMask(mask); -
133 QGuiApplicationPrivate::updateFilteredScreenOrientation(this); -
134}
executed: }
Execution Count:3
3
135 -
136 -
137 -
138 -
139 -
140 -
141Qt::ScreenOrientations QScreen::orientationUpdateMask() const -
142{ -
143 const QScreenPrivate * const d = d_func(); -
144 return d->orientationUpdateMask;
executed: return d->orientationUpdateMask;
Execution Count:12
12
145} -
146Qt::ScreenOrientation QScreen::orientation() const -
147{ -
148 const QScreenPrivate * const d = d_func(); -
149 return d->filteredOrientation;
executed: return d->filteredOrientation;
Execution Count:24
24
150} -
151 -
152 -
153 -
154 -
155 -
156qreal QScreen::refreshRate() const -
157{ -
158 const QScreenPrivate * const d = d_func(); -
159 return d->refreshRate;
never executed: return d->refreshRate;
0
160} -
161Qt::ScreenOrientation QScreen::primaryOrientation() const -
162{ -
163 const QScreenPrivate * const d = d_func(); -
164 return d->primaryOrientation;
executed: return d->primaryOrientation;
Execution Count:7
7
165} -
166 -
167 -
168static int log2(uint i) -
169{ -
170 if (i == 0)
partially evaluated: i == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
0-30
171 return -1;
never executed: return -1;
0
172 -
173 int result = 0; -
174 while (!(i & 1)) {
evaluated: !(i & 1)
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:30
30-45
175 ++result; -
176 i >>= 1; -
177 }
executed: }
Execution Count:45
45
178 return result;
executed: return result;
Execution Count:30
30
179} -
180int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const -
181{ -
182 if (a == Qt::PrimaryOrientation)
evaluated: a == Qt::PrimaryOrientation
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:19
1-19
183 a = primaryOrientation();
executed: a = primaryOrientation();
Execution Count:1
1
184 -
185 if (b == Qt::PrimaryOrientation)
evaluated: b == Qt::PrimaryOrientation
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:19
1-19
186 b = primaryOrientation();
executed: b = primaryOrientation();
Execution Count:1
1
187 -
188 if (a == b)
evaluated: a == b
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:15
5-15
189 return 0;
executed: return 0;
Execution Count:5
5
190 -
191 int ia = log2(uint(a)); -
192 int ib = log2(uint(b)); -
193 -
194 int delta = ia - ib; -
195 -
196 if (delta < 0)
evaluated: delta < 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:7
7-8
197 delta = delta + 4;
executed: delta = delta + 4;
Execution Count:8
8
198 -
199 int angles[] = { 0, 90, 180, 270 }; -
200 return angles[delta];
executed: return angles[delta];
Execution Count:15
15
201} -
202QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const -
203{ -
204 if (a == Qt::PrimaryOrientation)
partially evaluated: a == Qt::PrimaryOrientation
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
205 a = primaryOrientation();
never executed: a = primaryOrientation();
0
206 -
207 if (b == Qt::PrimaryOrientation)
evaluated: b == Qt::PrimaryOrientation
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
1-7
208 b = primaryOrientation();
executed: b = primaryOrientation();
Execution Count:1
1
209 -
210 if (a == b)
evaluated: a == b
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
211 return QTransform();
executed: return QTransform();
Execution Count:3
3
212 -
213 int angle = angleBetween(a, b); -
214 -
215 QTransform result; -
216 switch (angle) { -
217 case 90: -
218 result.translate(target.width(), 0); -
219 break;
executed: break;
Execution Count:2
2
220 case 180: -
221 result.translate(target.width(), target.height()); -
222 break;
executed: break;
Execution Count:2
2
223 case 270: -
224 result.translate(0, target.height()); -
225 break;
executed: break;
Execution Count:1
1
226 default: -
227 qt_noop(); -
228 }
never executed: }
0
229 result.rotate(angle); -
230 -
231 return result;
executed: return result;
Execution Count:5
5
232} -
233QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const -
234{ -
235 if (a == Qt::PrimaryOrientation)
never evaluated: a == Qt::PrimaryOrientation
0
236 a = primaryOrientation();
never executed: a = primaryOrientation();
0
237 -
238 if (b == Qt::PrimaryOrientation)
never evaluated: b == Qt::PrimaryOrientation
0
239 b = primaryOrientation();
never executed: b = primaryOrientation();
0
240 -
241 if (a == b)
never evaluated: a == b
0
242 return rect;
never executed: return rect;
0
243 -
244 if ((a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation)
never evaluated: a == Qt::PortraitOrientation
never evaluated: a == Qt::InvertedPortraitOrientation
0
245 != (b == Qt::PortraitOrientation || b == Qt::InvertedPortraitOrientation))
never evaluated: (a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation) != (b == Qt::PortraitOrientation || b == Qt::InvertedPortraitOrientation)
never evaluated: b == Qt::PortraitOrientation
never evaluated: b == Qt::InvertedPortraitOrientation
0
246 { -
247 return QRect(rect.y(), rect.x(), rect.height(), rect.width());
never executed: return QRect(rect.y(), rect.x(), rect.height(), rect.width());
0
248 } -
249 -
250 return rect;
never executed: return rect;
0
251} -
252 -
253 -
254 -
255 -
256 -
257 -
258 -
259bool QScreen::isPortrait(Qt::ScreenOrientation o) const -
260{ -
261 return o == Qt::PortraitOrientation || o == Qt::InvertedPortraitOrientation 0
262 || (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::PortraitOrientation);
never executed: return o == Qt::PortraitOrientation || o == Qt::InvertedPortraitOrientation || (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::PortraitOrientation);
0
263} -
264 -
265 -
266 -
267 -
268 -
269 -
270 -
271bool QScreen::isLandscape(Qt::ScreenOrientation o) const -
272{ -
273 return o == Qt::LandscapeOrientation || o == Qt::InvertedLandscapeOrientation 0
274 || (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::LandscapeOrientation);
never executed: return o == Qt::LandscapeOrientation || o == Qt::InvertedLandscapeOrientation || (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::LandscapeOrientation);
0
275} -
276void QScreenPrivate::updatePrimaryOrientation() -
277{ -
278 primaryOrientation = geometry.width() >= geometry.height() ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
partially evaluated: geometry.width() >= geometry.height()
TRUEFALSE
yes
Evaluation Count:289
no
Evaluation Count:0
0-289
279}
executed: }
Execution Count:289
289
280QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height) -
281{ -
282 const QPlatformScreen *platformScreen = handle(); -
283 if (!platformScreen) {
partially evaluated: !platformScreen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
284 QMessageLogger("kernel/qscreen.cpp", 651, __PRETTY_FUNCTION__).warning("%s invoked with handle==0", __PRETTY_FUNCTION__); -
285 return QPixmap();
never executed: return QPixmap();
0
286 } -
287 return platformScreen->grabWindow(window, x, y, width, height);
executed: return platformScreen->grabWindow(window, x, y, width, height);
Execution Count:44
44
288} -
289 -
290 -
291 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial