/src/libmspub/src/lib/Coordinate.cpp
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* |
3 | | * This file is part of the libmspub project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | |
10 | | #include "Coordinate.h" |
11 | | |
12 | | #include <utility> |
13 | | |
14 | | namespace libmspub |
15 | | { |
16 | | |
17 | | Coordinate::Coordinate(int xs, int ys, int xe, int ye) |
18 | 118k | : m_xs(xs) |
19 | 118k | , m_ys(ys) |
20 | 118k | , m_xe(xe) |
21 | 118k | , m_ye(ye) |
22 | 118k | { |
23 | 118k | arrange(); |
24 | 118k | } |
25 | | |
26 | | void Coordinate::arrange() |
27 | 126k | { |
28 | 126k | if (m_xs > m_xe) |
29 | 26.3k | std::swap(m_xs, m_xe); |
30 | 126k | if (m_ys > m_ye) |
31 | 48.0k | std::swap(m_ys, m_ye); |
32 | 126k | } |
33 | | |
34 | | } |
35 | | |
36 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |