plugins/shakecursor: Prefer operator[] over at()
Bounds checks are redundant. Plus kwin is built with exceptions disabled.
This commit is contained in:
parent
2ad896c71d
commit
0bc60023f5
1 changed files with 6 additions and 6 deletions
|
@ -58,15 +58,15 @@ bool ShakeDetector::update(QMouseEvent *event)
|
|||
|
||||
for (size_t i = 1; i < m_history.size(); ++i) {
|
||||
// Compute the length of the mouse path.
|
||||
const qreal deltaX = m_history.at(i).position.x() - m_history.at(i - 1).position.x();
|
||||
const qreal deltaY = m_history.at(i).position.y() - m_history.at(i - 1).position.y();
|
||||
const qreal deltaX = m_history[i].position.x() - m_history[i - 1].position.x();
|
||||
const qreal deltaY = m_history[i].position.y() - m_history[i - 1].position.y();
|
||||
distance += std::sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
|
||||
// Compute the bounds of the mouse path.
|
||||
left = std::min(left, m_history.at(i).position.x());
|
||||
top = std::min(top, m_history.at(i).position.y());
|
||||
right = std::max(right, m_history.at(i).position.x());
|
||||
bottom = std::max(bottom, m_history.at(i).position.y());
|
||||
left = std::min(left, m_history[i].position.x());
|
||||
top = std::min(top, m_history[i].position.y());
|
||||
right = std::max(right, m_history[i].position.x());
|
||||
bottom = std::max(bottom, m_history[i].position.y());
|
||||
}
|
||||
|
||||
const qreal boundsWidth = right - left;
|
||||
|
|
Loading…
Reference in a new issue