Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00032 #ifndef _RAS_RECT 00033 #define _RAS_RECT 00034 00035 #ifdef WITH_CXX_GUARDEDALLOC 00036 #include "MEM_guardedalloc.h" 00037 #endif 00038 00044 class RAS_Rect 00045 { 00046 public: // todo: make a decent class, and make private 00047 int m_x1, m_y1; 00048 int m_x2, m_y2; 00049 00050 public: 00051 RAS_Rect() : m_x1(0), m_y1(0), m_x2(0), m_y2(0) {} 00052 int GetWidth( 00053 ) const { 00054 return m_x2 - m_x1; 00055 } 00056 int GetHeight( 00057 ) const { 00058 return m_y2 - m_y1; 00059 } 00060 int GetLeft( 00061 ) const { 00062 return m_x1; 00063 } 00064 int GetRight( 00065 ) const { 00066 return m_x2; 00067 } 00068 int GetBottom( 00069 ) const { 00070 return m_y1; 00071 } 00072 int GetTop( 00073 ) const { 00074 return m_y2; 00075 } 00076 00077 void SetLeft( 00078 int x1) 00079 { 00080 m_x1 = x1; 00081 } 00082 void SetBottom( 00083 int y1) 00084 { 00085 m_y1 = y1; 00086 } 00087 void SetRight( 00088 int x2) 00089 { 00090 m_x2 = x2; 00091 } 00092 void SetTop( 00093 int y2) 00094 { 00095 m_y2 = y2; 00096 } 00097 00098 #ifdef WITH_CXX_GUARDEDALLOC 00099 public: 00100 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_Rect"); } 00101 void operator delete( void *mem ) { MEM_freeN(mem); } 00102 #endif 00103 }; 00104 00105 #endif // _RAS_RECT 00106