_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

intern_video.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
11 //*@file intern_video.h @brief The video headerfile for video sources only. */
12 //
13 // (c) Copyright 1999-2002 by Stephan Rasenbergver.
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __INTERN_VIDEO_H__
31 #define __INTERN_VIDEO_H__
32 
34 
35 /*----------------------------------------------------------------------------
36 -- Documentation
37 ----------------------------------------------------------------------------*/
38 
53 /*----------------------------------------------------------------------------
54 -- Includes
55 ----------------------------------------------------------------------------*/
56 
57 
58 /*----------------------------------------------------------------------------
59 -- Declarations
60 ----------------------------------------------------------------------------*/
61 
62 
63 /*----------------------------------------------------------------------------
64 -- Variables
65 ----------------------------------------------------------------------------*/
66 
67 // Direct acces to clipping rectangle for macro CLIP_RECTANGLE
68 extern int ClipX1;
69 extern int ClipY1;
70 extern int ClipX2;
71 extern int ClipY2;
72 
73 /*----------------------------------------------------------------------------
74 -- Macros
75 ----------------------------------------------------------------------------*/
76 
94 #define CLIP_RECTANGLE(x, y, width, height) do { \
95  int f; \
96  if (x < ClipX1) { \
97  f = ClipX1 - x; \
98  if (width <= f) { \
99  return; \
100  } \
101  width -= f; \
102  x = ClipX1; \
103  } \
104  if ((x + width) > ClipX2 + 1) { \
105  if (x > ClipX2) { \
106  return; \
107  } \
108  width = ClipX2 - x + 1; \
109  } \
110  if (y < ClipY1) { \
111  f = ClipY1 - y; \
112  if (height <= f) { \
113  return; \
114  } \
115  height -= f; \
116  y = ClipY1; \
117  } \
118  if ((y + height) > ClipY2 + 1) { \
119  if (y > ClipY2) { \
120  return; \
121  } \
122  height = ClipY2 - y + 1; \
123  } \
124  } while(0)
125 
149 #define CLIP_RECTANGLE_OFS(x, y, width, height, ofsx, ofsy, endx) do { \
150  if (y < ClipY1) { \
151  ofsy = ClipY1 - y; \
152  if (height <= ofsy) { \
153  return; \
154  } \
155  height -= ofsy; \
156  y = ClipY1; \
157  } else { \
158  ofsy = 0; \
159  } \
160  if ((y + height) > ClipY2 + 1) { \
161  if (y > ClipY2) { \
162  return; \
163  } \
164  height = ClipY2 - y + 1; \
165  } \
166  if (x < ClipX1) { \
167  ofsx = ClipX1 - x; \
168  if (width <= ofsx) { \
169  return; \
170  } \
171  width -= ofsx; \
172  x = ClipX1; \
173  } else { \
174  ofsx = 0; \
175  } \
176  if ((x + width) > ClipX2 + 1) { \
177  if (x > ClipX2) { \
178  return; \
179  } \
180  endx = (x + width) - (ClipX2 + 1); \
181  width = ClipX2 - x + 1; \
182  } else { \
183  endx = 0; \
184  } \
185  } while(0)
186 
187 
188 /*----------------------------------------------------------------------------
189 -- Functions
190 ----------------------------------------------------------------------------*/
191 
192 
194 
195 #endif // !__INTERN_VIDEO_H__
int ClipX1
Profile, frames out of sync.
Definition: video.cpp:181
int ClipY1
current clipping top left
Definition: video.cpp:182
int ClipX2
current clipping top left
Definition: video.cpp:183
int ClipY2
current clipping bottom right
Definition: video.cpp:184
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.