| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qmatrix.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | QMatrix::QMatrix() | - | ||||||||||||||||||||||||
| 6 | : _m11(1.) | - | ||||||||||||||||||||||||
| 7 | , _m12(0.) | - | ||||||||||||||||||||||||
| 8 | , _m21(0.) | - | ||||||||||||||||||||||||
| 9 | , _m22(1.) | - | ||||||||||||||||||||||||
| 10 | , _dx(0.) | - | ||||||||||||||||||||||||
| 11 | , _dy(0.) | - | ||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||
| 13 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 14 | QMatrix::QMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy) | - | ||||||||||||||||||||||||
| 15 | : _m11(m11) | - | ||||||||||||||||||||||||
| 16 | , _m12(m12) | - | ||||||||||||||||||||||||
| 17 | , _m21(m21) | - | ||||||||||||||||||||||||
| 18 | , _m22(m22) | - | ||||||||||||||||||||||||
| 19 | , _dx(dx) | - | ||||||||||||||||||||||||
| 20 | , _dy(dy) | - | ||||||||||||||||||||||||
| 21 | { | - | ||||||||||||||||||||||||
| 22 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | QMatrix::QMatrix(const QMatrix &matrix) | - | ||||||||||||||||||||||||
| 29 | : _m11(matrix._m11) | - | ||||||||||||||||||||||||
| 30 | , _m12(matrix._m12) | - | ||||||||||||||||||||||||
| 31 | , _m21(matrix._m21) | - | ||||||||||||||||||||||||
| 32 | , _m22(matrix._m22) | - | ||||||||||||||||||||||||
| 33 | , _dx(matrix._dx) | - | ||||||||||||||||||||||||
| 34 | , _dy(matrix._dy) | - | ||||||||||||||||||||||||
| 35 | { | - | ||||||||||||||||||||||||
| 36 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 37 | void QMatrix::setMatrix(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy) | - | ||||||||||||||||||||||||
| 38 | { | - | ||||||||||||||||||||||||
| 39 | _m11 = m11; | - | ||||||||||||||||||||||||
| 40 | _m12 = m12; | - | ||||||||||||||||||||||||
| 41 | _m21 = m21; | - | ||||||||||||||||||||||||
| 42 | _m22 = m22; | - | ||||||||||||||||||||||||
| 43 | _dx = dx; | - | ||||||||||||||||||||||||
| 44 | _dy = dy; | - | ||||||||||||||||||||||||
| 45 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 46 | void QMatrix::map(qreal x, qreal y, qreal *tx, qreal *ty) const | - | ||||||||||||||||||||||||
| 47 | { | - | ||||||||||||||||||||||||
| 48 | { qreal fx = x; qreal fy = y; *tx = _m11*fx + _m21*fy + _dx; *ty = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 49 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 50 | void QMatrix::map(int x, int y, int *tx, int *ty) const | - | ||||||||||||||||||||||||
| 51 | { | - | ||||||||||||||||||||||||
| 52 | { qreal fx = x; qreal fy = y; *tx = qRound(_m11*fx + _m21*fy + _dx); *ty = qRound(_m12*fx + _m22*fy + _dy); }; | - | ||||||||||||||||||||||||
| 53 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | QRect QMatrix::mapRect(const QRect &rect) const | - | ||||||||||||||||||||||||
| 56 | { | - | ||||||||||||||||||||||||
| 57 | QRect result; | - | ||||||||||||||||||||||||
| 58 |     if (_m12 == 0.0F
 
  | 0 | ||||||||||||||||||||||||
| 59 | int x = qRound(_m11*rect.x() + _dx); | - | ||||||||||||||||||||||||
| 60 | int y = qRound(_m22*rect.y() + _dy); | - | ||||||||||||||||||||||||
| 61 | int w = qRound(_m11*rect.width()); | - | ||||||||||||||||||||||||
| 62 | int h = qRound(_m22*rect.height()); | - | ||||||||||||||||||||||||
| 63 |         if (w < 0
  | 0 | ||||||||||||||||||||||||
| 64 | w = -w; | - | ||||||||||||||||||||||||
| 65 | x -= w; | - | ||||||||||||||||||||||||
| 66 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 67 |         if (h < 0
  | 0 | ||||||||||||||||||||||||
| 68 | h = -h; | - | ||||||||||||||||||||||||
| 69 | y -= h; | - | ||||||||||||||||||||||||
| 70 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 71 | result = QRect(x, y, w, h); | - | ||||||||||||||||||||||||
| 72 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | qreal x0, y0; | - | ||||||||||||||||||||||||
| 75 | qreal x, y; | - | ||||||||||||||||||||||||
| 76 | { qreal fx = rect.left(); qreal fy = rect.top(); x0 = _m11*fx + _m21*fy + _dx; y0 = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 77 | qreal xmin = x0; | - | ||||||||||||||||||||||||
| 78 | qreal ymin = y0; | - | ||||||||||||||||||||||||
| 79 | qreal xmax = x0; | - | ||||||||||||||||||||||||
| 80 | qreal ymax = y0; | - | ||||||||||||||||||||||||
| 81 | { qreal fx = rect.right() + 1; qreal fy = rect.top(); x = _m11*fx + _m21*fy + _dx; y = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 82 | xmin = qMin(xmin, x); | - | ||||||||||||||||||||||||
| 83 | ymin = qMin(ymin, y); | - | ||||||||||||||||||||||||
| 84 | xmax = qMax(xmax, x); | - | ||||||||||||||||||||||||
| 85 | ymax = qMax(ymax, y); | - | ||||||||||||||||||||||||
| 86 | { qreal fx = rect.right() + 1; qreal fy = rect.bottom() + 1; x = _m11*fx + _m21*fy + _dx; y = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 87 | xmin = qMin(xmin, x); | - | ||||||||||||||||||||||||
| 88 | ymin = qMin(ymin, y); | - | ||||||||||||||||||||||||
| 89 | xmax = qMax(xmax, x); | - | ||||||||||||||||||||||||
| 90 | ymax = qMax(ymax, y); | - | ||||||||||||||||||||||||
| 91 | { qreal fx = rect.left(); qreal fy = rect.bottom() + 1; x = _m11*fx + _m21*fy + _dx; y = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 92 | xmin = qMin(xmin, x); | - | ||||||||||||||||||||||||
| 93 | ymin = qMin(ymin, y); | - | ||||||||||||||||||||||||
| 94 | xmax = qMax(xmax, x); | - | ||||||||||||||||||||||||
| 95 | ymax = qMax(ymax, y); | - | ||||||||||||||||||||||||
| 96 | result = QRect(qRound(xmin), qRound(ymin), qRound(xmax)-qRound(xmin), qRound(ymax)-qRound(ymin)); | - | ||||||||||||||||||||||||
| 97 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 98 |     return never executed:   result;return result;never executed:  return result; | 0 | ||||||||||||||||||||||||
| 99 | } | - | ||||||||||||||||||||||||
| 100 | QRectF QMatrix::mapRect(const QRectF &rect) const | - | ||||||||||||||||||||||||
| 101 | { | - | ||||||||||||||||||||||||
| 102 | QRectF result; | - | ||||||||||||||||||||||||
| 103 |     if (_m12 == 0.0F
 
  | 0 | ||||||||||||||||||||||||
| 104 | qreal x = _m11*rect.x() + _dx; | - | ||||||||||||||||||||||||
| 105 | qreal y = _m22*rect.y() + _dy; | - | ||||||||||||||||||||||||
| 106 | qreal w = _m11*rect.width(); | - | ||||||||||||||||||||||||
| 107 | qreal h = _m22*rect.height(); | - | ||||||||||||||||||||||||
| 108 |         if (w < 0
  | 0 | ||||||||||||||||||||||||
| 109 | w = -w; | - | ||||||||||||||||||||||||
| 110 | x -= w; | - | ||||||||||||||||||||||||
| 111 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 112 |         if (h < 0
  | 0 | ||||||||||||||||||||||||
| 113 | h = -h; | - | ||||||||||||||||||||||||
| 114 | y -= h; | - | ||||||||||||||||||||||||
| 115 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 116 | result = QRectF(x, y, w, h); | - | ||||||||||||||||||||||||
| 117 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 118 | qreal x0, y0; | - | ||||||||||||||||||||||||
| 119 | qreal x, y; | - | ||||||||||||||||||||||||
| 120 | { qreal fx = rect.x(); qreal fy = rect.y(); x0 = _m11*fx + _m21*fy + _dx; y0 = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 121 | qreal xmin = x0; | - | ||||||||||||||||||||||||
| 122 | qreal ymin = y0; | - | ||||||||||||||||||||||||
| 123 | qreal xmax = x0; | - | ||||||||||||||||||||||||
| 124 | qreal ymax = y0; | - | ||||||||||||||||||||||||
| 125 | { qreal fx = rect.x() + rect.width(); qreal fy = rect.y(); x = _m11*fx + _m21*fy + _dx; y = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 126 | xmin = qMin(xmin, x); | - | ||||||||||||||||||||||||
| 127 | ymin = qMin(ymin, y); | - | ||||||||||||||||||||||||
| 128 | xmax = qMax(xmax, x); | - | ||||||||||||||||||||||||
| 129 | ymax = qMax(ymax, y); | - | ||||||||||||||||||||||||
| 130 | { qreal fx = rect.x() + rect.width(); qreal fy = rect.y() + rect.height(); x = _m11*fx + _m21*fy + _dx; y = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 131 | xmin = qMin(xmin, x); | - | ||||||||||||||||||||||||
| 132 | ymin = qMin(ymin, y); | - | ||||||||||||||||||||||||
| 133 | xmax = qMax(xmax, x); | - | ||||||||||||||||||||||||
| 134 | ymax = qMax(ymax, y); | - | ||||||||||||||||||||||||
| 135 | { qreal fx = rect.x(); qreal fy = rect.y() + rect.height(); x = _m11*fx + _m21*fy + _dx; y = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 136 | xmin = qMin(xmin, x); | - | ||||||||||||||||||||||||
| 137 | ymin = qMin(ymin, y); | - | ||||||||||||||||||||||||
| 138 | xmax = qMax(xmax, x); | - | ||||||||||||||||||||||||
| 139 | ymax = qMax(ymax, y); | - | ||||||||||||||||||||||||
| 140 | result = QRectF(xmin, ymin, xmax-xmin, ymax - ymin); | - | ||||||||||||||||||||||||
| 141 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 142 |     return never executed:   result;return result;never executed:  return result; | 0 | ||||||||||||||||||||||||
| 143 | } | - | ||||||||||||||||||||||||
| 144 | QPoint QMatrix::map(const QPoint &p) const | - | ||||||||||||||||||||||||
| 145 | { | - | ||||||||||||||||||||||||
| 146 | qreal fx = p.x(); | - | ||||||||||||||||||||||||
| 147 | qreal fy = p.y(); | - | ||||||||||||||||||||||||
| 148 |     return never executed:   QPoint(qRound(_m11*fx + _m21*fy + _dx),return QPoint(qRound(_m11*fx + _m21*fy + _dx), qRound(_m12*fx + _m22*fy + _dy));never executed:  return QPoint(qRound(_m11*fx + _m21*fy + _dx), qRound(_m12*fx + _m22*fy + _dy)); | 0 | ||||||||||||||||||||||||
| 149 |                    qRound(_m12*fx + _m22*fy + _dy)); never executed:  return QPoint(qRound(_m11*fx + _m21*fy + _dx), qRound(_m12*fx + _m22*fy + _dy)); | 0 | ||||||||||||||||||||||||
| 150 | } | - | ||||||||||||||||||||||||
| 151 | QPointF QMatrix::map(const QPointF &point) const | - | ||||||||||||||||||||||||
| 152 | { | - | ||||||||||||||||||||||||
| 153 | qreal fx = point.x(); | - | ||||||||||||||||||||||||
| 154 | qreal fy = point.y(); | - | ||||||||||||||||||||||||
| 155 |     return never executed:   QPointF(_m11*fx + _m21*fy + _dx, _m12*fx + _m22*fy + _dy);return QPointF(_m11*fx + _m21*fy + _dx, _m12*fx + _m22*fy + _dy);never executed:  return QPointF(_m11*fx + _m21*fy + _dx, _m12*fx + _m22*fy + _dy); | 0 | ||||||||||||||||||||||||
| 156 | } | - | ||||||||||||||||||||||||
| 157 | QLineF QMatrix::map(const QLineF &line) const | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 |     return never executed:   QLineF(map(line.p1()), map(line.p2()));return QLineF(map(line.p1()), map(line.p2()));never executed:  return QLineF(map(line.p1()), map(line.p2())); | 0 | ||||||||||||||||||||||||
| 160 | } | - | ||||||||||||||||||||||||
| 161 | QLine QMatrix::map(const QLine &line) const | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 |     return never executed:   QLine(map(line.p1()), map(line.p2()));return QLine(map(line.p1()), map(line.p2()));never executed:  return QLine(map(line.p1()), map(line.p2())); | 0 | ||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||
| 165 | QPolygon QMatrix::map(const QPolygon &a) const | - | ||||||||||||||||||||||||
| 166 | { | - | ||||||||||||||||||||||||
| 167 | int size = a.size(); | - | ||||||||||||||||||||||||
| 168 | int i; | - | ||||||||||||||||||||||||
| 169 | QPolygon p(size); | - | ||||||||||||||||||||||||
| 170 | const QPoint *da = a.constData(); | - | ||||||||||||||||||||||||
| 171 | QPoint *dp = p.data(); | - | ||||||||||||||||||||||||
| 172 |     for(i = 0; i < size
  | 0 | ||||||||||||||||||||||||
| 173 | { qreal fx = da[i].x(); qreal fy = da[i].y(); dp[i].rx() = qRound(_m11*fx + _m21*fy + _dx); dp[i].ry() = qRound(_m12*fx + _m22*fy + _dy); }; | - | ||||||||||||||||||||||||
| 174 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 175 |     return never executed:   p;return p;never executed:  return p; | 0 | ||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||
| 177 | QPolygonF QMatrix::map(const QPolygonF &a) const | - | ||||||||||||||||||||||||
| 178 | { | - | ||||||||||||||||||||||||
| 179 | int size = a.size(); | - | ||||||||||||||||||||||||
| 180 | int i; | - | ||||||||||||||||||||||||
| 181 | QPolygonF p(size); | - | ||||||||||||||||||||||||
| 182 | const QPointF *da = a.constData(); | - | ||||||||||||||||||||||||
| 183 | QPointF *dp = p.data(); | - | ||||||||||||||||||||||||
| 184 |     for(i = 0; i < size
  | 0 | ||||||||||||||||||||||||
| 185 | { qreal fx = da[i].xp; qreal fy = da[i].yp; dp[i].xp = _m11*fx + _m21*fy + _dx; dp[i].yp = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 186 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 187 |     return never executed:   p;return p;never executed:  return p; | 0 | ||||||||||||||||||||||||
| 188 | } | - | ||||||||||||||||||||||||
| 189 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - | ||||||||||||||||||||||||
| 190 | QRegion QMatrix::map(const QRegion &r) const | - | ||||||||||||||||||||||||
| 191 | { | - | ||||||||||||||||||||||||
| 192 |     if (_m11 == 1.0
 
 
 
  | 0 | ||||||||||||||||||||||||
| 193 |         if (_dx == 0.0
 
  | 0 | ||||||||||||||||||||||||
| 194 |             return never executed:   r;return r;never executed:  return r; | 0 | ||||||||||||||||||||||||
| 195 | QRegion copy(r); | - | ||||||||||||||||||||||||
| 196 | copy.translate(qRound(_dx), qRound(_dy)); | - | ||||||||||||||||||||||||
| 197 |         return never executed:   copy;return copy;never executed:  return copy; | 0 | ||||||||||||||||||||||||
| 198 | } | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | QPainterPath p = map(qt_regionToPath(r)); | - | ||||||||||||||||||||||||
| 201 |     return never executed:   p.toFillPolygon().toPolygon();return p.toFillPolygon().toPolygon();never executed:  return p.toFillPolygon().toPolygon(); | 0 | ||||||||||||||||||||||||
| 202 | } | - | ||||||||||||||||||||||||
| 203 | QPainterPath QMatrix::map(const QPainterPath &path) const | - | ||||||||||||||||||||||||
| 204 | { | - | ||||||||||||||||||||||||
| 205 |     if (path.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 206 |         return never executed:   QPainterPath();return QPainterPath();never executed:  return QPainterPath(); | 0 | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | QPainterPath copy = path; | - | ||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 |     if (_m11 == 1.0
 
 
 
  | 0 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 |         if (_dx != 0.0
 
  | 0 | ||||||||||||||||||||||||
| 215 | copy.detach(); | - | ||||||||||||||||||||||||
| 216 |             for (int i=0; i<path.elementCount()
  | 0 | ||||||||||||||||||||||||
| 217 | QPainterPath::Element &e = copy.d_ptr->elements[i]; | - | ||||||||||||||||||||||||
| 218 | e.x += _dx; | - | ||||||||||||||||||||||||
| 219 | e.y += _dy; | - | ||||||||||||||||||||||||
| 220 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 221 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 225 | copy.detach(); | - | ||||||||||||||||||||||||
| 226 |         for (int i=0; i<path.elementCount()
  | 0 | ||||||||||||||||||||||||
| 227 | QPainterPath::Element &e = copy.d_ptr->elements[i]; | - | ||||||||||||||||||||||||
| 228 | qreal fx = e.x, fy = e.y; | - | ||||||||||||||||||||||||
| 229 | e.x = _m11*fx + _m21*fy + _dx; | - | ||||||||||||||||||||||||
| 230 | e.y = _m12*fx + _m22*fy + _dy; | - | ||||||||||||||||||||||||
| 231 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 232 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 |     return never executed:   copy;return copy;never executed:  return copy; | 0 | ||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||
| 236 | QPolygon QMatrix::mapToPolygon(const QRect &rect) const | - | ||||||||||||||||||||||||
| 237 | { | - | ||||||||||||||||||||||||
| 238 | QPolygon a(4); | - | ||||||||||||||||||||||||
| 239 | qreal x[4], y[4]; | - | ||||||||||||||||||||||||
| 240 |     if (_m12 == 0.0F
 
  | 0 | ||||||||||||||||||||||||
| 241 | x[0] = _m11*rect.x() + _dx; | - | ||||||||||||||||||||||||
| 242 | y[0] = _m22*rect.y() + _dy; | - | ||||||||||||||||||||||||
| 243 | qreal w = _m11*rect.width(); | - | ||||||||||||||||||||||||
| 244 | qreal h = _m22*rect.height(); | - | ||||||||||||||||||||||||
| 245 |         if (w < 0
  | 0 | ||||||||||||||||||||||||
| 246 | w = -w; | - | ||||||||||||||||||||||||
| 247 | x[0] -= w; | - | ||||||||||||||||||||||||
| 248 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 249 |         if (h < 0
  | 0 | ||||||||||||||||||||||||
| 250 | h = -h; | - | ||||||||||||||||||||||||
| 251 | y[0] -= h; | - | ||||||||||||||||||||||||
| 252 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 253 | x[1] = x[0]+w; | - | ||||||||||||||||||||||||
| 254 | x[2] = x[1]; | - | ||||||||||||||||||||||||
| 255 | x[3] = x[0]; | - | ||||||||||||||||||||||||
| 256 | y[1] = y[0]; | - | ||||||||||||||||||||||||
| 257 | y[2] = y[0]+h; | - | ||||||||||||||||||||||||
| 258 | y[3] = y[2]; | - | ||||||||||||||||||||||||
| 259 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 260 | qreal right = rect.x() + rect.width(); | - | ||||||||||||||||||||||||
| 261 | qreal bottom = rect.y() + rect.height(); | - | ||||||||||||||||||||||||
| 262 | { qreal fx = rect.x(); qreal fy = rect.y(); x[0] = _m11*fx + _m21*fy + _dx; y[0] = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 263 | { qreal fx = right; qreal fy = rect.y(); x[1] = _m11*fx + _m21*fy + _dx; y[1] = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 264 | { qreal fx = right; qreal fy = bottom; x[2] = _m11*fx + _m21*fy + _dx; y[2] = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 265 | { qreal fx = rect.x(); qreal fy = bottom; x[3] = _m11*fx + _m21*fy + _dx; y[3] = _m12*fx + _m22*fy + _dy; }; | - | ||||||||||||||||||||||||
| 266 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 267 | a.setPoints(4, qRound(x[0]), qRound(y[0]), | - | ||||||||||||||||||||||||
| 268 | qRound(x[1]), qRound(y[1]), | - | ||||||||||||||||||||||||
| 269 | qRound(x[2]), qRound(y[2]), | - | ||||||||||||||||||||||||
| 270 | qRound(x[3]), qRound(y[3])); | - | ||||||||||||||||||||||||
| 271 |     return never executed:   a;return a;never executed:  return a; | 0 | ||||||||||||||||||||||||
| 272 | } | - | ||||||||||||||||||||||||
| 273 | void QMatrix::reset() | - | ||||||||||||||||||||||||
| 274 | { | - | ||||||||||||||||||||||||
| 275 | _m11 = _m22 = 1.0; | - | ||||||||||||||||||||||||
| 276 | _m12 = _m21 = _dx = _dy = 0.0; | - | ||||||||||||||||||||||||
| 277 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 278 | QMatrix &QMatrix::translate(qreal dx, qreal dy) | - | ||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||
| 280 | _dx += dx*_m11 + dy*_m21; | - | ||||||||||||||||||||||||
| 281 | _dy += dy*_m22 + dx*_m12; | - | ||||||||||||||||||||||||
| 282 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||||||||
| 283 | } | - | ||||||||||||||||||||||||
| 284 | QMatrix &QMatrix::scale(qreal sx, qreal sy) | - | ||||||||||||||||||||||||
| 285 | { | - | ||||||||||||||||||||||||
| 286 | _m11 *= sx; | - | ||||||||||||||||||||||||
| 287 | _m12 *= sx; | - | ||||||||||||||||||||||||
| 288 | _m21 *= sy; | - | ||||||||||||||||||||||||
| 289 | _m22 *= sy; | - | ||||||||||||||||||||||||
| 290 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||||||||
| 291 | } | - | ||||||||||||||||||||||||
| 292 | QMatrix &QMatrix::shear(qreal sh, qreal sv) | - | ||||||||||||||||||||||||
| 293 | { | - | ||||||||||||||||||||||||
| 294 | qreal tm11 = sv*_m21; | - | ||||||||||||||||||||||||
| 295 | qreal tm12 = sv*_m22; | - | ||||||||||||||||||||||||
| 296 | qreal tm21 = sh*_m11; | - | ||||||||||||||||||||||||
| 297 | qreal tm22 = sh*_m12; | - | ||||||||||||||||||||||||
| 298 | _m11 += tm11; | - | ||||||||||||||||||||||||
| 299 | _m12 += tm12; | - | ||||||||||||||||||||||||
| 300 | _m21 += tm21; | - | ||||||||||||||||||||||||
| 301 | _m22 += tm22; | - | ||||||||||||||||||||||||
| 302 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||||||||
| 303 | } | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | const qreal deg2rad = qreal(0.017453292519943295769); | - | ||||||||||||||||||||||||
| 306 | QMatrix &QMatrix::rotate(qreal a) | - | ||||||||||||||||||||||||
| 307 | { | - | ||||||||||||||||||||||||
| 308 | qreal sina = 0; | - | ||||||||||||||||||||||||
| 309 | qreal cosa = 0; | - | ||||||||||||||||||||||||
| 310 |     if (a == 90.
 
  | 0 | ||||||||||||||||||||||||
| 311 |         sina = 1.; never executed:  sina = 1.; | 0 | ||||||||||||||||||||||||
| 312 |     else if (a == 270.
 
  | 0 | ||||||||||||||||||||||||
| 313 |         sina = -1.; never executed:  sina = -1.; | 0 | ||||||||||||||||||||||||
| 314 |     else if (a == 180.
  | 0 | ||||||||||||||||||||||||
| 315 |         cosa = -1.; never executed:  cosa = -1.; | 0 | ||||||||||||||||||||||||
| 316 | else{ | - | ||||||||||||||||||||||||
| 317 | qreal b = deg2rad*a; | - | ||||||||||||||||||||||||
| 318 | sina = qSin(b); | - | ||||||||||||||||||||||||
| 319 | cosa = qCos(b); | - | ||||||||||||||||||||||||
| 320 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 321 | qreal tm11 = cosa*_m11 + sina*_m21; | - | ||||||||||||||||||||||||
| 322 | qreal tm12 = cosa*_m12 + sina*_m22; | - | ||||||||||||||||||||||||
| 323 | qreal tm21 = -sina*_m11 + cosa*_m21; | - | ||||||||||||||||||||||||
| 324 | qreal tm22 = -sina*_m12 + cosa*_m22; | - | ||||||||||||||||||||||||
| 325 | _m11 = tm11; _m12 = tm12; | - | ||||||||||||||||||||||||
| 326 | _m21 = tm21; _m22 = tm22; | - | ||||||||||||||||||||||||
| 327 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||||||||
| 328 | } | - | ||||||||||||||||||||||||
| 329 | QMatrix QMatrix::inverted(bool *invertible) const | - | ||||||||||||||||||||||||
| 330 | { | - | ||||||||||||||||||||||||
| 331 | qreal dtr = determinant(); | - | ||||||||||||||||||||||||
| 332 |     if (dtr == 0.0
  | 0 | ||||||||||||||||||||||||
| 333 |         if (invertible
  | 0 | ||||||||||||||||||||||||
| 334 |             * never executed:  invertible = false;*invertible = false;never executed:  *invertible = false; | 0 | ||||||||||||||||||||||||
| 335 |         return never executed:   QMatrix(true);return QMatrix(true);never executed:  return QMatrix(true); | 0 | ||||||||||||||||||||||||
| 336 | } | - | ||||||||||||||||||||||||
| 337 | else { | - | ||||||||||||||||||||||||
| 338 |         if (invertible
  | 0 | ||||||||||||||||||||||||
| 339 |             * never executed:  invertible = true;*invertible = true;never executed:  *invertible = true; | 0 | ||||||||||||||||||||||||
| 340 | qreal dinv = 1.0/dtr; | - | ||||||||||||||||||||||||
| 341 |         return never executed:   QMatrix((_m22*dinv), (-_m12*dinv),return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), ((_m12*_dx - _m11*_dy)*dinv), true);never executed:  return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), ((_m12*_dx - _m11*_dy)*dinv), true); | 0 | ||||||||||||||||||||||||
| 342 |                        (-_m21*dinv), (_m11*dinv), never executed:  return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), ((_m12*_dx - _m11*_dy)*dinv), true); | 0 | ||||||||||||||||||||||||
| 343 |                        ((_m21*_dy - _m22*_dx)*dinv), never executed:  return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), ((_m12*_dx - _m11*_dy)*dinv), true); | 0 | ||||||||||||||||||||||||
| 344 |                        ((_m12*_dx - _m11*_dy)*dinv), never executed:  return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), ((_m12*_dx - _m11*_dy)*dinv), true); | 0 | ||||||||||||||||||||||||
| 345 |                        true); never executed:  return QMatrix((_m22*dinv), (-_m12*dinv), (-_m21*dinv), (_m11*dinv), ((_m21*_dy - _m22*_dx)*dinv), ((_m12*_dx - _m11*_dy)*dinv), true); | 0 | ||||||||||||||||||||||||
| 346 | } | - | ||||||||||||||||||||||||
| 347 | } | - | ||||||||||||||||||||||||
| 348 | bool QMatrix::operator==(const QMatrix &m) const | - | ||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||
| 350 |     return never executed:   _m11 == m._m11return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy;
 never executed:  return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy; | 0 | ||||||||||||||||||||||||
| 351 |            _m12 == m._m12
 never executed:  return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy; | 0 | ||||||||||||||||||||||||
| 352 |            _m21 == m._m21
 never executed:  return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy; | 0 | ||||||||||||||||||||||||
| 353 |            _m22 == m._m22
 never executed:  return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy; | 0 | ||||||||||||||||||||||||
| 354 |            _dx == m._dx
 never executed:  return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy; | 0 | ||||||||||||||||||||||||
| 355 |            _dy == m._dy
 never executed:  return _m11 == m._m11 && _m12 == m._m12 && _m21 == m._m21 && _m22 == m._m22 && _dx == m._dx && _dy == m._dy; | 0 | ||||||||||||||||||||||||
| 356 | } | - | ||||||||||||||||||||||||
| 357 | uint qHash(const QMatrix &key, uint seed) noexcept | - | ||||||||||||||||||||||||
| 358 | { | - | ||||||||||||||||||||||||
| 359 | QtPrivate::QHashCombine hash; | - | ||||||||||||||||||||||||
| 360 | seed = hash(key.m11(), seed); | - | ||||||||||||||||||||||||
| 361 | seed = hash(key.m12(), seed); | - | ||||||||||||||||||||||||
| 362 | seed = hash(key.m21(), seed); | - | ||||||||||||||||||||||||
| 363 | seed = hash(key.m22(), seed); | - | ||||||||||||||||||||||||
| 364 | seed = hash(key.dx(), seed); | - | ||||||||||||||||||||||||
| 365 | seed = hash(key.dy(), seed); | - | ||||||||||||||||||||||||
| 366 |     return never executed:   seed;return seed;never executed:  return seed; | 0 | ||||||||||||||||||||||||
| 367 | } | - | ||||||||||||||||||||||||
| 368 | bool QMatrix::operator!=(const QMatrix &m) const | - | ||||||||||||||||||||||||
| 369 | { | - | ||||||||||||||||||||||||
| 370 |     return never executed:   _m11 != m._m11return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy;
 never executed:  return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy; | 0 | ||||||||||||||||||||||||
| 371 |            _m12 != m._m12
 never executed:  return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy; | 0 | ||||||||||||||||||||||||
| 372 |            _m21 != m._m21
 never executed:  return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy; | 0 | ||||||||||||||||||||||||
| 373 |            _m22 != m._m22
 never executed:  return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy; | 0 | ||||||||||||||||||||||||
| 374 |            _dx != m._dx
 never executed:  return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy; | 0 | ||||||||||||||||||||||||
| 375 |            _dy != m._dy
 never executed:  return _m11 != m._m11 || _m12 != m._m12 || _m21 != m._m21 || _m22 != m._m22 || _dx != m._dx || _dy != m._dy; | 0 | ||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||
| 377 | QMatrix &QMatrix::operator *=(const QMatrix &m) | - | ||||||||||||||||||||||||
| 378 | { | - | ||||||||||||||||||||||||
| 379 | qreal tm11 = _m11*m._m11 + _m12*m._m21; | - | ||||||||||||||||||||||||
| 380 | qreal tm12 = _m11*m._m12 + _m12*m._m22; | - | ||||||||||||||||||||||||
| 381 | qreal tm21 = _m21*m._m11 + _m22*m._m21; | - | ||||||||||||||||||||||||
| 382 | qreal tm22 = _m21*m._m12 + _m22*m._m22; | - | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | qreal tdx = _dx*m._m11 + _dy*m._m21 + m._dx; | - | ||||||||||||||||||||||||
| 385 | qreal tdy = _dx*m._m12 + _dy*m._m22 + m._dy; | - | ||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | _m11 = tm11; _m12 = tm12; | - | ||||||||||||||||||||||||
| 388 | _m21 = tm21; _m22 = tm22; | - | ||||||||||||||||||||||||
| 389 | _dx = tdx; _dy = tdy; | - | ||||||||||||||||||||||||
| 390 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||||||||
| 391 | } | - | ||||||||||||||||||||||||
| 392 | QMatrix QMatrix::operator *(const QMatrix &m) const | - | ||||||||||||||||||||||||
| 393 | { | - | ||||||||||||||||||||||||
| 394 | qreal tm11 = _m11*m._m11 + _m12*m._m21; | - | ||||||||||||||||||||||||
| 395 | qreal tm12 = _m11*m._m12 + _m12*m._m22; | - | ||||||||||||||||||||||||
| 396 | qreal tm21 = _m21*m._m11 + _m22*m._m21; | - | ||||||||||||||||||||||||
| 397 | qreal tm22 = _m21*m._m12 + _m22*m._m22; | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | qreal tdx = _dx*m._m11 + _dy*m._m21 + m._dx; | - | ||||||||||||||||||||||||
| 400 | qreal tdy = _dx*m._m12 + _dy*m._m22 + m._dy; | - | ||||||||||||||||||||||||
| 401 |     return never executed:   QMatrix(tm11, tm12, tm21, tm22, tdx, tdy, true);return QMatrix(tm11, tm12, tm21, tm22, tdx, tdy, true);never executed:  return QMatrix(tm11, tm12, tm21, tm22, tdx, tdy, true); | 0 | ||||||||||||||||||||||||
| 402 | } | - | ||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | QMatrix &QMatrix::operator=(const QMatrix &matrix) | - | ||||||||||||||||||||||||
| 408 | { | - | ||||||||||||||||||||||||
| 409 | _m11 = matrix._m11; | - | ||||||||||||||||||||||||
| 410 | _m12 = matrix._m12; | - | ||||||||||||||||||||||||
| 411 | _m21 = matrix._m21; | - | ||||||||||||||||||||||||
| 412 | _m22 = matrix._m22; | - | ||||||||||||||||||||||||
| 413 | _dx = matrix._dx; | - | ||||||||||||||||||||||||
| 414 | _dy = matrix._dy; | - | ||||||||||||||||||||||||
| 415 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||||||||
| 416 | } | - | ||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | QMatrix::operator QVariant() const | - | ||||||||||||||||||||||||
| 424 | { | - | ||||||||||||||||||||||||
| 425 |     return never executed:   QVariant(QVariant::Matrix, this);return QVariant(QVariant::Matrix, this);never executed:  return QVariant(QVariant::Matrix, this); | 0 | ||||||||||||||||||||||||
| 426 | } | - | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | __attribute__((visibility("default"))) QPainterPath operator *(const QPainterPath &p, const QMatrix &m) | - | ||||||||||||||||||||||||
| 429 | { | - | ||||||||||||||||||||||||
| 430 |     return never executed:   m.map(p);return m.map(p);never executed:  return m.map(p); | 0 | ||||||||||||||||||||||||
| 431 | } | - | ||||||||||||||||||||||||
| 432 | QDataStream &operator<<(QDataStream &s, const QMatrix &m) | - | ||||||||||||||||||||||||
| 433 | { | - | ||||||||||||||||||||||||
| 434 |     if (s.version() == 1
  | 0 | ||||||||||||||||||||||||
| 435 | s << (float)m.m11() << (float)m.m12() << (float)m.m21() | - | ||||||||||||||||||||||||
| 436 | << (float)m.m22() << (float)m.dx() << (float)m.dy(); | - | ||||||||||||||||||||||||
| 437 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 438 | s << double(m.m11()) | - | ||||||||||||||||||||||||
| 439 | << double(m.m12()) | - | ||||||||||||||||||||||||
| 440 | << double(m.m21()) | - | ||||||||||||||||||||||||
| 441 | << double(m.m22()) | - | ||||||||||||||||||||||||
| 442 | << double(m.dx()) | - | ||||||||||||||||||||||||
| 443 | << double(m.dy()); | - | ||||||||||||||||||||||||
| 444 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 445 |     return never executed:   s;return s;never executed:  return s; | 0 | ||||||||||||||||||||||||
| 446 | } | - | ||||||||||||||||||||||||
| 447 | QDataStream &operator>>(QDataStream &s, QMatrix &m) | - | ||||||||||||||||||||||||
| 448 | { | - | ||||||||||||||||||||||||
| 449 |     if (s.version() == 1
  | 0 | ||||||||||||||||||||||||
| 450 | float m11, m12, m21, m22, dx, dy; | - | ||||||||||||||||||||||||
| 451 | s >> m11; s >> m12; s >> m21; s >> m22; | - | ||||||||||||||||||||||||
| 452 | s >> dx; s >> dy; | - | ||||||||||||||||||||||||
| 453 | m.setMatrix(m11, m12, m21, m22, dx, dy); | - | ||||||||||||||||||||||||
| 454 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 455 | else { | - | ||||||||||||||||||||||||
| 456 | double m11, m12, m21, m22, dx, dy; | - | ||||||||||||||||||||||||
| 457 | s >> m11; | - | ||||||||||||||||||||||||
| 458 | s >> m12; | - | ||||||||||||||||||||||||
| 459 | s >> m21; | - | ||||||||||||||||||||||||
| 460 | s >> m22; | - | ||||||||||||||||||||||||
| 461 | s >> dx; | - | ||||||||||||||||||||||||
| 462 | s >> dy; | - | ||||||||||||||||||||||||
| 463 | m.setMatrix(m11, m12, m21, m22, dx, dy); | - | ||||||||||||||||||||||||
| 464 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 465 |     return never executed:   s;return s;never executed:  return s; | 0 | ||||||||||||||||||||||||
| 466 | } | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | QDebug operator<<(QDebug dbg, const QMatrix &m) | - | ||||||||||||||||||||||||
| 471 | { | - | ||||||||||||||||||||||||
| 472 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||||||||
| 473 | dbg.nospace() << "QMatrix(" | - | ||||||||||||||||||||||||
| 474 | << "11=" << m.m11() | - | ||||||||||||||||||||||||
| 475 | << " 12=" << m.m12() | - | ||||||||||||||||||||||||
| 476 | << " 21=" << m.m21() | - | ||||||||||||||||||||||||
| 477 | << " 22=" << m.m22() | - | ||||||||||||||||||||||||
| 478 | << " dx=" << m.dx() | - | ||||||||||||||||||||||||
| 479 | << " dy=" << m.dy() | - | ||||||||||||||||||||||||
| 480 | << ')'; | - | ||||||||||||||||||||||||
| 481 |     return never executed:   dbg;return dbg;never executed:  return dbg; | 0 | ||||||||||||||||||||||||
| 482 | } | - | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |