| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qsize.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | void QSize::transpose() noexcept | - | ||||||||||||||||||
| 5 | { | - | ||||||||||||||||||
| 6 | int tmp = wd;qSwap(wd= ht;, ht= tmp;); | - | ||||||||||||||||||
| 7 | } executed 3 times by 1 test:  end of blockExecuted by: 
  | 3 | ||||||||||||||||||
| 8 | QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 |     if (mode == Qt::IgnoreAspectRatio
 
 
  | 0-5586 | ||||||||||||||||||
| 11 |         return executed 598 times by 16 tests:   s;return s;Executed by: 
 executed 598 times by 16 tests:  return s;Executed by: 
  | 598 | ||||||||||||||||||
| 12 | } else { | - | ||||||||||||||||||
| 13 | bool useHeight; | - | ||||||||||||||||||
| 14 | qint64 rw = qint64(s.ht) * qint64(wd) / qint64(ht); | - | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 |         if (mode == Qt::KeepAspectRatio
  | 2-5582 | ||||||||||||||||||
| 17 | useHeight = (rw <= s.wd); | - | ||||||||||||||||||
| 18 |         } executed 5582 times by 18 tests:   else {end of blockExecuted by: 
  | 5582 | ||||||||||||||||||
| 19 | useHeight = (rw >= s.wd); | - | ||||||||||||||||||
| 20 |         } executed 2 times by 1 test:  end of blockExecuted by: 
  | 2 | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 |         if (useHeight
  | 38-5546 | ||||||||||||||||||
| 23 |             return executed 5546 times by 16 tests:   QSize(rw, s.ht);return QSize(rw, s.ht);Executed by: 
 executed 5546 times by 16 tests:  return QSize(rw, s.ht);Executed by: 
  | 5546 | ||||||||||||||||||
| 24 | } else { | - | ||||||||||||||||||
| 25 |             return executed 38 times by 4 tests:   QSize(s.wd,return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));Executed by: 
 executed 38 times by 4 tests:  return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));Executed by: 
  | 38 | ||||||||||||||||||
| 26 |                          qint32(qint64(s.wd) * qint64(ht) / qint64(wd))); executed 38 times by 4 tests:  return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));Executed by: 
  | 38 | ||||||||||||||||||
| 27 | } | - | ||||||||||||||||||
| 28 | } | - | ||||||||||||||||||
| 29 | } | - | ||||||||||||||||||
| 30 | QDataStream &operator<<(QDataStream &s, const QSize &sz) | - | ||||||||||||||||||
| 31 | { | - | ||||||||||||||||||
| 32 | if (s.version() == 1) | - | ||||||||||||||||||
| 33 | s << (qint16)sz.width() << (qint16)sz.height(); | - | ||||||||||||||||||
| 34 | else | - | ||||||||||||||||||
| 35 | s << (qint32)sz.width() << (qint32)sz.height(); | - | ||||||||||||||||||
| 36 | return s; | - | ||||||||||||||||||
| 37 | } | - | ||||||||||||||||||
| 38 | QDataStream &operator>>(QDataStream &s, QSize &sz) | - | ||||||||||||||||||
| 39 | { | - | ||||||||||||||||||
| 40 | if (s.version() == 1) { | - | ||||||||||||||||||
| 41 | qint16 w, h; | - | ||||||||||||||||||
| 42 | s >> w; sz.rwidth() = w; | - | ||||||||||||||||||
| 43 | s >> h; sz.rheight() = h; | - | ||||||||||||||||||
| 44 | } | - | ||||||||||||||||||
| 45 | else { | - | ||||||||||||||||||
| 46 | qint32 w, h; | - | ||||||||||||||||||
| 47 | s >> w; sz.rwidth() = w; | - | ||||||||||||||||||
| 48 | s >> h; sz.rheight() = h; | - | ||||||||||||||||||
| 49 | } | - | ||||||||||||||||||
| 50 | return s; | - | ||||||||||||||||||
| 51 | } | - | ||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | QDebug operator<<(QDebug dbg, const QSize &s) | - | ||||||||||||||||||
| 56 | { | - | ||||||||||||||||||
| 57 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||
| 58 | dbg.nospace(); | - | ||||||||||||||||||
| 59 | dbg << "QSize("; | - | ||||||||||||||||||
| 60 | QtDebugUtils::formatQSize(dbg, s); | - | ||||||||||||||||||
| 61 | dbg << ')'; | - | ||||||||||||||||||
| 62 | return dbg; | - | ||||||||||||||||||
| 63 | } | - | ||||||||||||||||||
| 64 | void QSizeF::transpose() noexcept | - | ||||||||||||||||||
| 65 | { | - | ||||||||||||||||||
| 66 | qreal tmp = wd;qSwap(wd= ht;, ht= tmp;); | - | ||||||||||||||||||
| 67 | } executed 6 times by 2 tests:  end of blockExecuted by: 
  | 6 | ||||||||||||||||||
| 68 | QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept | - | ||||||||||||||||||
| 69 | { | - | ||||||||||||||||||
| 70 |     if (mode == Qt::IgnoreAspectRatio
 
 
  | 0-6 | ||||||||||||||||||
| 71 |         return executed 4 times by 1 test:   s;return s;Executed by: 
 executed 4 times by 1 test:  return s;Executed by: 
  | 4 | ||||||||||||||||||
| 72 | } else { | - | ||||||||||||||||||
| 73 | bool useHeight; | - | ||||||||||||||||||
| 74 | qreal rw = s.ht * wd / ht; | - | ||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 |         if (mode == Qt::KeepAspectRatio
  | 2 | ||||||||||||||||||
| 77 | useHeight = (rw <= s.wd); | - | ||||||||||||||||||
| 78 |         } executed 2 times by 1 test:   else {end of blockExecuted by: 
  | 2 | ||||||||||||||||||
| 79 | useHeight = (rw >= s.wd); | - | ||||||||||||||||||
| 80 |         } executed 2 times by 1 test:  end of blockExecuted by: 
  | 2 | ||||||||||||||||||
| 81 | - | |||||||||||||||||||
| 82 |         if (useHeight
  | 2 | ||||||||||||||||||
| 83 |             return executed 2 times by 1 test:   QSizeF(rw, s.ht);return QSizeF(rw, s.ht);Executed by: 
 executed 2 times by 1 test:  return QSizeF(rw, s.ht);Executed by: 
  | 2 | ||||||||||||||||||
| 84 | } else { | - | ||||||||||||||||||
| 85 |             return executed 2 times by 1 test:   QSizeF(s.wd, s.wd * ht / wd);return QSizeF(s.wd, s.wd * ht / wd);Executed by: 
 executed 2 times by 1 test:  return QSizeF(s.wd, s.wd * ht / wd);Executed by: 
  | 2 | ||||||||||||||||||
| 86 | } | - | ||||||||||||||||||
| 87 | } | - | ||||||||||||||||||
| 88 | } | - | ||||||||||||||||||
| 89 | QDataStream &operator<<(QDataStream &s, const QSizeF &sz) | - | ||||||||||||||||||
| 90 | { | - | ||||||||||||||||||
| 91 | s << double(sz.width()) << double(sz.height()); | - | ||||||||||||||||||
| 92 | return s; | - | ||||||||||||||||||
| 93 | } | - | ||||||||||||||||||
| 94 | QDataStream &operator>>(QDataStream &s, QSizeF &sz) | - | ||||||||||||||||||
| 95 | { | - | ||||||||||||||||||
| 96 | double w, h; | - | ||||||||||||||||||
| 97 | s >> w; | - | ||||||||||||||||||
| 98 | s >> h; | - | ||||||||||||||||||
| 99 | sz.setWidth(qreal(w)); | - | ||||||||||||||||||
| 100 | sz.setHeight(qreal(h)); | - | ||||||||||||||||||
| 101 | return s; | - | ||||||||||||||||||
| 102 | } | - | ||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | QDebug operator<<(QDebug dbg, const QSizeF &s) | - | ||||||||||||||||||
| 107 | { | - | ||||||||||||||||||
| 108 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||
| 109 | dbg.nospace(); | - | ||||||||||||||||||
| 110 | dbg << "QSizeF("; | - | ||||||||||||||||||
| 111 | QtDebugUtils::formatQSize(dbg, s); | - | ||||||||||||||||||
| 112 | dbg << ')'; | - | ||||||||||||||||||
| 113 | return dbg; | - | ||||||||||||||||||
| 114 | } | - | ||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |