[Scummvm-cvs-logs] CVS: scummvm/common rect.h,1.20,1.21
Max Horn
fingolfin at users.sourceforge.net
Sun Apr 25 12:20:47 CEST 2004
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24923
Modified Files:
rect.h
Log Message:
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.
Index: rect.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/rect.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- rect.h 6 Apr 2004 11:11:10 -0000 1.20
+++ rect.h 25 Apr 2004 16:16:21 -0000 1.21
@@ -46,7 +46,20 @@
/*! @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).
More information about the Scummvm-git-logs
mailing list