____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"00001 // ____ _ __ 00002 // / __ )____ _____ | | / /___ ___________ 00003 // / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/ 00004 // / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ ) 00005 // /_____/\____/____/ |__/|__/\__,_/_/ /____/ 00006 // 00007 // A futuristic real-time strategy game. 00008 // This file is part of Bos Wars. 00009 // 00010 //*@file intern_video.h @brief The video headerfile for video sources only. */ 00011 // 00012 // (c) Copyright 1999-2002 by Stephan Rasenbergver. 00013 // 00014 // This program is free software; you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation; only version 2 of the License. 00017 // 00018 // This program is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU General Public License for more details. 00022 // 00023 // You should have received a copy of the GNU General Public License 00024 // along with this program; if not, write to the Free Software 00025 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00026 // 02111-1307, USA. 00027 // 00028 00029 #ifndef __INTERN_VIDEO_H__ 00030 #define __INTERN_VIDEO_H__ 00031 00033 00034 /*---------------------------------------------------------------------------- 00035 -- Documentation 00036 ----------------------------------------------------------------------------*/ 00037 00052 /*---------------------------------------------------------------------------- 00053 -- Includes 00054 ----------------------------------------------------------------------------*/ 00055 00056 00057 /*---------------------------------------------------------------------------- 00058 -- Declarations 00059 ----------------------------------------------------------------------------*/ 00060 00061 00062 /*---------------------------------------------------------------------------- 00063 -- Variables 00064 ----------------------------------------------------------------------------*/ 00065 00066 // Direct acces to clipping rectangle for macro CLIP_RECTANGLE 00067 extern int ClipX1; 00068 extern int ClipY1; 00069 extern int ClipX2; 00070 extern int ClipY2; 00071 00072 /*---------------------------------------------------------------------------- 00073 -- Macros 00074 ----------------------------------------------------------------------------*/ 00075 00093 #define CLIP_RECTANGLE(x, y, width, height) { \ 00094 int f; \ 00095 if (x < ClipX1) { \ 00096 f = ClipX1 - x; \ 00097 if (width <= f) { \ 00098 return; \ 00099 } \ 00100 width -= f; \ 00101 x = ClipX1; \ 00102 } \ 00103 if ((x + width) > ClipX2 + 1) { \ 00104 if (x > ClipX2) { \ 00105 return; \ 00106 } \ 00107 width = ClipX2 - x + 1; \ 00108 } \ 00109 if (y < ClipY1) { \ 00110 f = ClipY1 - y; \ 00111 if (height <= f) { \ 00112 return; \ 00113 } \ 00114 height -= f; \ 00115 y = ClipY1; \ 00116 } \ 00117 if ((y + height) > ClipY2 + 1) { \ 00118 if (y > ClipY2) { \ 00119 return; \ 00120 } \ 00121 height = ClipY2 - y + 1; \ 00122 } \ 00123 } 00124 00148 #define CLIP_RECTANGLE_OFS(x, y, width, height, ofsx, ofsy, endx) { \ 00149 if (y < ClipY1) { \ 00150 ofsy = ClipY1 - y; \ 00151 if (height <= ofsy) { \ 00152 return; \ 00153 } \ 00154 height -= ofsy; \ 00155 y = ClipY1; \ 00156 } else { \ 00157 ofsy = 0; \ 00158 } \ 00159 if ((y + height) > ClipY2 + 1) { \ 00160 if (y > ClipY2) { \ 00161 return; \ 00162 } \ 00163 height = ClipY2 - y + 1; \ 00164 } \ 00165 if (x < ClipX1) { \ 00166 ofsx = ClipX1 - x; \ 00167 if (width <= ofsx) { \ 00168 return; \ 00169 } \ 00170 width -= ofsx; \ 00171 x = ClipX1; \ 00172 } else { \ 00173 ofsx = 0; \ 00174 } \ 00175 if ((x + width) > ClipX2 + 1) { \ 00176 if (x > ClipX2) { \ 00177 return; \ 00178 } \ 00179 endx = (x + width) - (ClipX2 + 1); \ 00180 width = ClipX2 - x + 1; \ 00181 } else { \ 00182 endx = 0; \ 00183 } \ 00184 } 00185 00186 00187 /*---------------------------------------------------------------------------- 00188 -- Functions 00189 ----------------------------------------------------------------------------*/ 00190 00191 00193 00194 #endif // !__INTERN_VIDEO_H__
1.5.6