aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2004-04-25 16:16:21 +0000
committerMax Horn2004-04-25 16:16:21 +0000
commit795a735a312c1a6c444c4b35c62721b69eee3d8b (patch)
tree73faa5f0cdc71fd88618d467c957a88e5050efdf /common
parentabc8dca0732b26d6d5e27e8a4c5a4136faff1bbd (diff)
downloadscummvm-rg350-795a735a312c1a6c444c4b35c62721b69eee3d8b.tar.gz
scummvm-rg350-795a735a312c1a6c444c4b35c62721b69eee3d8b.tar.bz2
scummvm-rg350-795a735a312c1a6c444c4b35c62721b69eee3d8b.zip
Comment about how our Rect class works. Note: the SAGA engine currently does use the alternate approach to rects! Hence we can't currently use all those nice and nifty helper methods from Common::Rect in SAGA.
svn-id: r13626
Diffstat (limited to 'common')
-rw-r--r--common/rect.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/common/rect.h b/common/rect.h
index 7eeec875f2..40b01044a7 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -46,7 +46,20 @@ struct Point {
/*! @brief simple class for handling a rectangular zone.
This small class is an helper for rectangles.
- It is mostly used by the blitter class.
+ Note: This implementation is built around the assumption that (top,left) is
+ part of the rectangle, but (bottom,right) is not! This is reflected in
+ various methods, including contains(), intersects() and others.
+
+ Another very wide spread approach to rectangle classes treats (bottom,right)
+ also as a part of the rectangle.
+
+ Coneptually, both are sound, but the approach we use saves many intermediate
+ computations (like computing the height in our case is done by doing this:
+ height = bottom - top;
+ while in the alternate system, it would be
+ height = bottom - top + 1;
+
+ When writing code using our Rect class, always keep this principle in mind!
*/
struct Rect {
int16 top, left; //!< The point at the top left of the rectangle (part of the rect).