File indexing completed on 2025-03-16 06:57:21
0001 /******************************************************************* 0002 * 0003 * Copyright 2007 Aron Boström <c02ab@efd.lth.se> 0004 * 0005 * Bovo is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2, or (at your option) 0008 * any later version. 0009 * 0010 * Bovo is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with Bovo; see the file COPYING. If not, write to 0017 * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 * 0020 ********************************************************************/ 0021 0022 #include "dimension.h" 0023 #include "coord.h" 0024 0025 namespace bovo { 0026 0027 Dimension::Dimension(usi width, usi height) 0028 : m_height(height), m_width(width) { 0029 } 0030 0031 Dimension::Dimension(const Dimension& dimension) 0032 = default; 0033 0034 usi Dimension::height() const { 0035 return m_height; 0036 } 0037 0038 usi Dimension::width() const { 0039 return m_width; 0040 } 0041 0042 bool Dimension::ok(const Coord* c) const { 0043 return c->x() < m_width && c->y() < m_height; 0044 } 0045 0046 bool Dimension::ok(const Coord& c) const { 0047 return c.x() < m_width && c.y() < m_height; 0048 } 0049 0050 } /* namespace bovo */