image/qmovie.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9class QFrameInfo -
10{ -
11public: -
12 QPixmap pixmap; -
13 int delay; -
14 bool endMark; -
15 inline QFrameInfo(bool endMark) -
16 : pixmap(QPixmap()), delay(-1), endMark(endMark) -
17 { }
executed: }
Execution Count:9
9
18 -
19 inline QFrameInfo() -
20 : pixmap(QPixmap()), delay(-1), endMark(false) -
21 { }
never executed: }
0
22 -
23 inline QFrameInfo(const QPixmap &pixmap, int delay) -
24 : pixmap(pixmap), delay(delay), endMark(false) -
25 { }
executed: }
Execution Count:134
134
26 -
27 inline bool isValid() -
28 { -
29 return endMark || !(pixmap.isNull() && (delay == -1));
executed: return endMark || !(pixmap.isNull() && (delay == -1));
Execution Count:143
143
30 } -
31 -
32 inline bool isEndMarker() -
33 { return endMark; }
executed: return endMark;
Execution Count:143
143
34 -
35 static inline QFrameInfo endMarker() -
36 { return QFrameInfo(true); }
executed: return QFrameInfo(true);
Execution Count:9
9
37}; -
38 -
39class QMoviePrivate : public QObjectPrivate -
40{ -
41 inline QMovie* q_func() { return static_cast<QMovie *>(q_ptr); } inline const QMovie* q_func() const { return static_cast<const QMovie *>(q_ptr); } friend class QMovie; -
42 -
43public: -
44 QMoviePrivate(QMovie *qq); -
45 bool isDone(); -
46 bool next(); -
47 int speedAdjustedDelay(int delay) const; -
48 bool isValid() const; -
49 bool jumpToFrame(int frameNumber); -
50 int frameCount() const; -
51 bool jumpToNextFrame(); -
52 QFrameInfo infoForFrame(int frameNumber); -
53 void reset(); -
54 -
55 inline void enterState(QMovie::MovieState newState) { -
56 movieState = newState; -
57 q_func()->stateChanged(newState); -
58 }
executed: }
Execution Count:23
23
59 -
60 -
61 void _q_loadNextFrame(); -
62 void _q_loadNextFrame(bool starting); -
63 -
64 QImageReader *reader; -
65 int speed; -
66 QMovie::MovieState movieState; -
67 QRect frameRect; -
68 QPixmap currentPixmap; -
69 int currentFrameNumber; -
70 int nextFrameNumber; -
71 int greatestFrameNumber; -
72 int nextDelay; -
73 int playCounter; -
74 qint64 initialDevicePos; -
75 QMovie::CacheMode cacheMode; -
76 bool haveReadAll; -
77 bool isFirstIteration; -
78 QMap<int, QFrameInfo> frameMap; -
79 QString absoluteFilePath; -
80 -
81 QTimer nextImageTimer; -
82}; -
83 -
84 -
85 -
86QMoviePrivate::QMoviePrivate(QMovie *qq) -
87 : reader(0), speed(100), movieState(QMovie::NotRunning), -
88 currentFrameNumber(-1), nextFrameNumber(0), greatestFrameNumber(-1), -
89 nextDelay(0), playCounter(-1), -
90 cacheMode(QMovie::CacheNone), haveReadAll(false), isFirstIteration(true) -
91{ -
92 q_ptr = qq; -
93 nextImageTimer.setSingleShot(true); -
94}
executed: }
Execution Count:11
11
95 -
96 -
97 -
98void QMoviePrivate::reset() -
99{ -
100 nextImageTimer.stop(); -
101 if (reader->device())
evaluated: reader->device()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
102 initialDevicePos = reader->device()->pos();
executed: initialDevicePos = reader->device()->pos();
Execution Count:4
4
103 currentFrameNumber = -1; -
104 nextFrameNumber = 0; -
105 greatestFrameNumber = -1; -
106 nextDelay = 0; -
107 playCounter = -1; -
108 haveReadAll = false; -
109 isFirstIteration = true; -
110 frameMap.clear(); -
111}
executed: }
Execution Count:5
5
112 -
113 -
114 -
115bool QMoviePrivate::isDone() -
116{ -
117 return (playCounter == 0);
executed: return (playCounter == 0);
Execution Count:4
4
118} -
119int QMoviePrivate::speedAdjustedDelay(int delay) const -
120{ -
121 return int( (qint64(delay) * qint64(100) ) / qint64(speed) );
executed: return int( (qint64(delay) * qint64(100) ) / qint64(speed) );
Execution Count:134
134
122} -
123QFrameInfo QMoviePrivate::infoForFrame(int frameNumber) -
124{ -
125 if (frameNumber < 0)
partially evaluated: frameNumber < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:143
0-143
126 return QFrameInfo();
never executed: return QFrameInfo();
0
127 -
128 if (haveReadAll && (frameNumber > greatestFrameNumber)) {
evaluated: haveReadAll
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:57
evaluated: (frameNumber > greatestFrameNumber)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:82
4-86
129 if (frameNumber == greatestFrameNumber+1)
partially evaluated: frameNumber == greatestFrameNumber+1
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
130 return QFrameInfo::endMarker();
executed: return QFrameInfo::endMarker();
Execution Count:4
4
131 return QFrameInfo();
never executed: return QFrameInfo();
0
132 } -
133 -
134 if (cacheMode == QMovie::CacheNone) {
partially evaluated: cacheMode == QMovie::CacheNone
TRUEFALSE
yes
Evaluation Count:139
no
Evaluation Count:0
0-139
135 if (frameNumber != currentFrameNumber+1) {
evaluated: frameNumber != currentFrameNumber+1
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:132
7-132
136 -
137 if (!reader->jumpToImage(frameNumber)) {
partially evaluated: !reader->jumpToImage(frameNumber)
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
138 if (frameNumber == 0) {
partially evaluated: frameNumber == 0
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
139 -
140 -
141 if (reader->device()->isSequential())
partially evaluated: reader->device()->isSequential()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
142 return QFrameInfo();
never executed: return QFrameInfo();
0
143 QString fileName = reader->fileName(); -
144 QByteArray format = reader->format(); -
145 QIODevice *device = reader->device(); -
146 QColor bgColor = reader->backgroundColor(); -
147 QSize scaledSize = reader->scaledSize(); -
148 delete reader; -
149 if (fileName.isEmpty())
partially evaluated: fileName.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
150 reader = new QImageReader(device, format);
never executed: reader = new QImageReader(device, format);
0
151 else -
152 reader = new QImageReader(absoluteFilePath, format);
executed: reader = new QImageReader(absoluteFilePath, format);
Execution Count:7
7
153 (void)reader->canRead(); -
154 reader->device()->seek(initialDevicePos); -
155 reader->setBackgroundColor(bgColor); -
156 reader->setScaledSize(scaledSize); -
157 } else {
executed: }
Execution Count:7
7
158 return QFrameInfo();
never executed: return QFrameInfo();
0
159 } -
160 } -
161 }
executed: }
Execution Count:7
7
162 if (reader->canRead()) {
evaluated: reader->canRead()
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:5
5-134
163 -
164 QImage anImage = reader->read(); -
165 if (anImage.isNull()) {
partially evaluated: anImage.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:134
0-134
166 -
167 return QFrameInfo();
never executed: return QFrameInfo();
0
168 } -
169 if (frameNumber > greatestFrameNumber)
evaluated: frameNumber > greatestFrameNumber
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:84
50-84
170 greatestFrameNumber = frameNumber;
executed: greatestFrameNumber = frameNumber;
Execution Count:50
50
171 QPixmap aPixmap = QPixmap::fromImage(anImage); -
172 int aDelay = reader->nextImageDelay(); -
173 return QFrameInfo(aPixmap, aDelay);
executed: return QFrameInfo(aPixmap, aDelay);
Execution Count:134
134
174 } else if (frameNumber != 0) {
partially evaluated: frameNumber != 0
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
175 -
176 haveReadAll = true; -
177 return QFrameInfo::endMarker();
executed: return QFrameInfo::endMarker();
Execution Count:5
5
178 } else { -
179 -
180 haveReadAll = true; -
181 return QFrameInfo();
never executed: return QFrameInfo();
0
182 } -
183 } -
184 -
185 -
186 if (frameNumber > greatestFrameNumber) {
never evaluated: frameNumber > greatestFrameNumber
0
187 -
188 for (int i = greatestFrameNumber + 1; i <= frameNumber; ++i) {
never evaluated: i <= frameNumber
0
189 if (reader->canRead()) {
never evaluated: reader->canRead()
0
190 -
191 QImage anImage = reader->read(); -
192 if (anImage.isNull()) {
never evaluated: anImage.isNull()
0
193 -
194 return QFrameInfo();
never executed: return QFrameInfo();
0
195 } -
196 greatestFrameNumber = i; -
197 QPixmap aPixmap = QPixmap::fromImage(anImage); -
198 int aDelay = reader->nextImageDelay(); -
199 QFrameInfo info(aPixmap, aDelay); -
200 -
201 frameMap.insert(i, info); -
202 if (i == frameNumber) {
never evaluated: i == frameNumber
0
203 return info;
never executed: return info;
0
204 } -
205 } else {
never executed: }
0
206 -
207 haveReadAll = true; -
208 return QFrameInfo::endMarker();
never executed: return QFrameInfo::endMarker();
0
209 } -
210 } -
211 }
never executed: }
0
212 -
213 return frameMap.value(frameNumber);
never executed: return frameMap.value(frameNumber);
0
214} -
215bool QMoviePrivate::next() -
216{ -
217 QTime time; -
218 time.start(); -
219 QFrameInfo info = infoForFrame(nextFrameNumber); -
220 if (!info.isValid())
partially evaluated: !info.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:143
0-143
221 return false;
never executed: return false;
0
222 if (info.isEndMarker()) {
evaluated: info.isEndMarker()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:134
9-134
223 -
224 if (isFirstIteration) {
evaluated: isFirstIteration
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
225 if (nextFrameNumber == 0) {
partially evaluated: nextFrameNumber == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
226 -
227 return false;
never executed: return false;
0
228 } -
229 -
230 playCounter = reader->loopCount(); -
231 isFirstIteration = false; -
232 }
executed: }
Execution Count:5
5
233 -
234 if (playCounter != 0) {
evaluated: playCounter != 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
235 if (playCounter != -1)
evaluated: playCounter != -1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
236 playCounter--;
executed: playCounter--;
Execution Count:4
4
237 nextFrameNumber = 0; -
238 return next();
executed: return next();
Execution Count:5
5
239 } -
240 -
241 return false;
executed: return false;
Execution Count:4
4
242 } -
243 -
244 currentFrameNumber = nextFrameNumber++; -
245 QSize scaledSize = reader->scaledSize(); -
246 if (scaledSize.isValid() && (scaledSize != info.pixmap.size()))
partially evaluated: scaledSize.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:134
never evaluated: (scaledSize != info.pixmap.size())
0-134
247 currentPixmap = QPixmap::fromImage( info.pixmap.toImage().scaled(scaledSize) );
never executed: currentPixmap = QPixmap::fromImage( info.pixmap.toImage().scaled(scaledSize) );
0
248 else -
249 currentPixmap = info.pixmap;
executed: currentPixmap = info.pixmap;
Execution Count:134
134
250 nextDelay = speedAdjustedDelay(info.delay); -
251 -
252 int processingTime = time.elapsed(); -
253 if (processingTime > nextDelay)
evaluated: processingTime > nextDelay
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:130
4-130
254 nextDelay = 0;
executed: nextDelay = 0;
Execution Count:4
4
255 else -
256 nextDelay = nextDelay - processingTime;
executed: nextDelay = nextDelay - processingTime;
Execution Count:130
130
257 return true;
executed: return true;
Execution Count:134
134
258} -
259 -
260 -
261 -
262void QMoviePrivate::_q_loadNextFrame() -
263{ -
264 _q_loadNextFrame(false); -
265}
executed: }
Execution Count:128
128
266 -
267void QMoviePrivate::_q_loadNextFrame(bool starting) -
268{ -
269 QMovie * const q = q_func(); -
270 if (next()) {
evaluated: next()
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:4
4-134
271 if (starting && movieState == QMovie::NotRunning) {
evaluated: starting
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:124
partially evaluated: movieState == QMovie::NotRunning
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-124
272 enterState(QMovie::Running); -
273 q->started(); -
274 }
executed: }
Execution Count:10
10
275 -
276 if (frameRect.size() != currentPixmap.rect().size()) {
evaluated: frameRect.size() != currentPixmap.rect().size()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:126
8-126
277 frameRect = currentPixmap.rect(); -
278 q->resized(frameRect.size()); -
279 }
executed: }
Execution Count:8
8
280 -
281 q->updated(frameRect); -
282 q->frameChanged(currentFrameNumber); -
283 -
284 if (movieState == QMovie::Running)
partially evaluated: movieState == QMovie::Running
TRUEFALSE
yes
Evaluation Count:134
no
Evaluation Count:0
0-134
285 nextImageTimer.start(nextDelay);
executed: nextImageTimer.start(nextDelay);
Execution Count:134
134
286 } else {
executed: }
Execution Count:134
134
287 -
288 if (!isDone()) {
partially evaluated: !isDone()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
289 q->error(reader->error()); -
290 }
never executed: }
0
291 -
292 -
293 if (movieState != QMovie::Paused) {
partially evaluated: movieState != QMovie::Paused
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
294 nextFrameNumber = 0; -
295 isFirstIteration = true; -
296 playCounter = -1; -
297 enterState(QMovie::NotRunning); -
298 q->finished(); -
299 }
executed: }
Execution Count:4
4
300 }
executed: }
Execution Count:4
4
301} -
302 -
303 -
304 -
305 -
306bool QMoviePrivate::isValid() const -
307{ -
308 return (greatestFrameNumber >= 0) 130
309 || reader->canRead();
executed: return (greatestFrameNumber >= 0) || reader->canRead();
Execution Count:130
130
310} -
311 -
312 -
313 -
314 -
315bool QMoviePrivate::jumpToFrame(int frameNumber) -
316{ -
317 if (frameNumber < 0)
evaluated: frameNumber < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
318 return false;
executed: return false;
Execution Count:2
2
319 if (currentFrameNumber == frameNumber)
partially evaluated: currentFrameNumber == frameNumber
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
320 return true;
executed: return true;
Execution Count:2
2
321 nextFrameNumber = frameNumber; -
322 if (movieState == QMovie::Running)
never evaluated: movieState == QMovie::Running
0
323 nextImageTimer.stop();
never executed: nextImageTimer.stop();
0
324 _q_loadNextFrame(); -
325 return (nextFrameNumber == currentFrameNumber+1);
never executed: return (nextFrameNumber == currentFrameNumber+1);
0
326} -
327 -
328 -
329 -
330 -
331int QMoviePrivate::frameCount() const -
332{ -
333 int result; -
334 if ((result = reader->imageCount()) != 0)
partially evaluated: (result = reader->imageCount()) != 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
335 return result;
executed: return result;
Execution Count:2
2
336 if (haveReadAll)
never evaluated: haveReadAll
0
337 return greatestFrameNumber+1;
never executed: return greatestFrameNumber+1;
0
338 return 0;
never executed: return 0;
0
339} -
340 -
341 -
342 -
343 -
344bool QMoviePrivate::jumpToNextFrame() -
345{ -
346 return jumpToFrame(currentFrameNumber+1);
never executed: return jumpToFrame(currentFrameNumber+1);
0
347} -
348 -
349 -
350 -
351 -
352 -
353 -
354 -
355QMovie::QMovie(QObject *parent) -
356 : QObject(*new QMoviePrivate(this), parent) -
357{ -
358 QMoviePrivate * const d = d_func(); -
359 d->reader = new QImageReader; -
360 connect(&d->nextImageTimer, "2""timeout()", this, "1""_q_loadNextFrame()"); -
361}
executed: }
Execution Count:5
5
362QMovie::QMovie(QIODevice *device, const QByteArray &format, QObject *parent) -
363 : QObject(*new QMoviePrivate(this), parent) -
364{ -
365 QMoviePrivate * const d = d_func(); -
366 d->reader = new QImageReader(device, format); -
367 d->initialDevicePos = device->pos(); -
368 connect(&d->nextImageTimer, "2""timeout()", this, "1""_q_loadNextFrame()"); -
369}
never executed: }
0
370QMovie::QMovie(const QString &fileName, const QByteArray &format, QObject *parent) -
371 : QObject(*new QMoviePrivate(this), parent) -
372{ -
373 QMoviePrivate * const d = d_func(); -
374 d->absoluteFilePath = QDir(fileName).absolutePath(); -
375 d->reader = new QImageReader(fileName, format); -
376 if (d->reader->device())
partially evaluated: d->reader->device()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
377 d->initialDevicePos = d->reader->device()->pos();
executed: d->initialDevicePos = d->reader->device()->pos();
Execution Count:6
6
378 connect(&d->nextImageTimer, "2""timeout()", this, "1""_q_loadNextFrame()"); -
379}
executed: }
Execution Count:6
6
380 -
381 -
382 -
383 -
384QMovie::~QMovie() -
385{ -
386 QMoviePrivate * const d = d_func(); -
387 delete d->reader; -
388}
executed: }
Execution Count:11
11
389 -
390 -
391 -
392 -
393 -
394 -
395 -
396void QMovie::setDevice(QIODevice *device) -
397{ -
398 QMoviePrivate * const d = d_func(); -
399 d->reader->setDevice(device); -
400 d->reset(); -
401}
executed: }
Execution Count:2
2
402 -
403 -
404 -
405 -
406 -
407 -
408 -
409QIODevice *QMovie::device() const -
410{ -
411 const QMoviePrivate * const d = d_func(); -
412 return d->reader->device();
executed: return d->reader->device();
Execution Count:3
3
413} -
414 -
415 -
416 -
417 -
418 -
419 -
420 -
421void QMovie::setFileName(const QString &fileName) -
422{ -
423 QMoviePrivate * const d = d_func(); -
424 d->absoluteFilePath = QDir(fileName).absolutePath(); -
425 d->reader->setFileName(fileName); -
426 d->reset(); -
427}
executed: }
Execution Count:3
3
428QString QMovie::fileName() const -
429{ -
430 const QMoviePrivate * const d = d_func(); -
431 return d->reader->fileName();
executed: return d->reader->fileName();
Execution Count:1
1
432} -
433void QMovie::setFormat(const QByteArray &format) -
434{ -
435 QMoviePrivate * const d = d_func(); -
436 d->reader->setFormat(format); -
437}
never executed: }
0
438 -
439 -
440 -
441 -
442 -
443 -
444 -
445QByteArray QMovie::format() const -
446{ -
447 const QMoviePrivate * const d = d_func(); -
448 return d->reader->format();
never executed: return d->reader->format();
0
449} -
450 -
451 -
452 -
453 -
454 -
455 -
456 -
457void QMovie::setBackgroundColor(const QColor &color) -
458{ -
459 QMoviePrivate * const d = d_func(); -
460 d->reader->setBackgroundColor(color); -
461}
never executed: }
0
462 -
463 -
464 -
465 -
466 -
467 -
468 -
469QColor QMovie::backgroundColor() const -
470{ -
471 const QMoviePrivate * const d = d_func(); -
472 return d->reader->backgroundColor();
never executed: return d->reader->backgroundColor();
0
473} -
474 -
475 -
476 -
477 -
478 -
479 -
480QMovie::MovieState QMovie::state() const -
481{ -
482 const QMoviePrivate * const d = d_func(); -
483 return d->movieState;
executed: return d->movieState;
Execution Count:23
23
484} -
485 -
486 -
487 -
488 -
489 -
490 -
491 -
492QRect QMovie::frameRect() const -
493{ -
494 const QMoviePrivate * const d = d_func(); -
495 return d->frameRect;
never executed: return d->frameRect;
0
496} -
497 -
498 -
499 -
500 -
501 -
502 -
503QPixmap QMovie::currentPixmap() const -
504{ -
505 const QMoviePrivate * const d = d_func(); -
506 return d->currentPixmap;
executed: return d->currentPixmap;
Execution Count:264
264
507} -
508 -
509 -
510 -
511 -
512 -
513 -
514QImage QMovie::currentImage() const -
515{ -
516 const QMoviePrivate * const d = d_func(); -
517 return d->currentPixmap.toImage();
never executed: return d->currentPixmap.toImage();
0
518} -
519 -
520 -
521 -
522 -
523 -
524bool QMovie::isValid() const -
525{ -
526 const QMoviePrivate * const d = d_func(); -
527 return d->isValid();
executed: return d->isValid();
Execution Count:130
130
528} -
529 -
530 -
531 -
532 -
533 -
534 -
535 -
536int QMovie::frameCount() const -
537{ -
538 const QMoviePrivate * const d = d_func(); -
539 return d->frameCount();
executed: return d->frameCount();
Execution Count:2
2
540} -
541 -
542 -
543 -
544 -
545 -
546int QMovie::nextFrameDelay() const -
547{ -
548 const QMoviePrivate * const d = d_func(); -
549 return d->nextDelay;
executed: return d->nextDelay;
Execution Count:2
2
550} -
551 -
552 -
553 -
554 -
555 -
556int QMovie::currentFrameNumber() const -
557{ -
558 const QMoviePrivate * const d = d_func(); -
559 return d->currentFrameNumber;
executed: return d->currentFrameNumber;
Execution Count:3
3
560} -
561 -
562 -
563 -
564 -
565bool QMovie::jumpToNextFrame() -
566{ -
567 QMoviePrivate * const d = d_func(); -
568 return d->jumpToNextFrame();
never executed: return d->jumpToNextFrame();
0
569} -
570 -
571 -
572 -
573 -
574 -
575bool QMovie::jumpToFrame(int frameNumber) -
576{ -
577 QMoviePrivate * const d = d_func(); -
578 return d->jumpToFrame(frameNumber);
executed: return d->jumpToFrame(frameNumber);
Execution Count:4
4
579} -
580int QMovie::loopCount() const -
581{ -
582 const QMoviePrivate * const d = d_func(); -
583 return d->reader->loopCount();
never executed: return d->reader->loopCount();
0
584} -
585void QMovie::setPaused(bool paused) -
586{ -
587 QMoviePrivate * const d = d_func(); -
588 if (paused) {
evaluated: paused
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
589 if (d->movieState == NotRunning)
partially evaluated: d->movieState == NotRunning
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
590 return;
never executed: return;
0
591 d->enterState(Paused); -
592 d->nextImageTimer.stop(); -
593 } else {
executed: }
Execution Count:2
2
594 if (d->movieState == Running)
partially evaluated: d->movieState == Running
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
595 return;
never executed: return;
0
596 d->enterState(Running); -
597 d->nextImageTimer.start(nextFrameDelay()); -
598 }
executed: }
Execution Count:2
2
599} -
600void QMovie::setSpeed(int percentSpeed) -
601{ -
602 QMoviePrivate * const d = d_func(); -
603 d->speed = percentSpeed; -
604}
executed: }
Execution Count:5
5
605 -
606int QMovie::speed() const -
607{ -
608 const QMoviePrivate * const d = d_func(); -
609 return d->speed;
executed: return d->speed;
Execution Count:3
3
610} -
611void QMovie::start() -
612{ -
613 QMoviePrivate * const d = d_func(); -
614 if (d->movieState == NotRunning) {
evaluated: d->movieState == NotRunning
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
615 d->_q_loadNextFrame(true); -
616 } else if (d->movieState == Paused) {
partially evaluated: d->movieState == Paused
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
executed: }
Execution Count:10
0-10
617 setPaused(false); -
618 }
executed: }
Execution Count:2
2
619} -
620void QMovie::stop() -
621{ -
622 QMoviePrivate * const d = d_func(); -
623 if (d->movieState == NotRunning)
evaluated: d->movieState == NotRunning
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
624 return;
executed: return;
Execution Count:1
1
625 d->enterState(NotRunning); -
626 d->nextImageTimer.stop(); -
627 d->nextFrameNumber = 0; -
628}
executed: }
Execution Count:5
5
629QSize QMovie::scaledSize() -
630{ -
631 QMoviePrivate * const d = d_func(); -
632 return d->reader->scaledSize();
never executed: return d->reader->scaledSize();
0
633} -
634void QMovie::setScaledSize(const QSize &size) -
635{ -
636 QMoviePrivate * const d = d_func(); -
637 d->reader->setScaledSize(size); -
638}
never executed: }
0
639QList<QByteArray> QMovie::supportedFormats() -
640{ -
641 QList<QByteArray> list = QImageReader::supportedImageFormats(); -
642 QMutableListIterator<QByteArray> it(list); -
643 QBuffer buffer; -
644 buffer.open(QIODevice::ReadOnly); -
645 while (it.hasNext()) {
never evaluated: it.hasNext()
0
646 QImageReader reader(&buffer, it.next()); -
647 if (!reader.supportsAnimation())
never evaluated: !reader.supportsAnimation()
0
648 it.remove();
never executed: it.remove();
0
649 }
never executed: }
0
650 return list;
never executed: return list;
0
651} -
652QMovie::CacheMode QMovie::cacheMode() const -
653{ -
654 const QMoviePrivate * const d = d_func(); -
655 return d->cacheMode;
executed: return d->cacheMode;
Execution Count:2
2
656} -
657 -
658void QMovie::setCacheMode(CacheMode cacheMode) -
659{ -
660 QMoviePrivate * const d = d_func(); -
661 d->cacheMode = cacheMode; -
662}
executed: }
Execution Count:2
2
663 -
664 -
665 -
666 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial