[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/rect.h
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/rect.h |
Date: |
Wed, 18 Oct 2006 14:16:02 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/10/18 14:16:02
Modified files:
. : ChangeLog
server : rect.h
Log message:
* server/rect.h: added shift_x, shift_y, scale_x and scale_x
methods (toward making data members private).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1296&r2=1.1297
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.h?cvsroot=gnash&r1=1.3&r2=1.4
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1296
retrieving revision 1.1297
diff -u -b -r1.1296 -r1.1297
--- ChangeLog 18 Oct 2006 14:02:09 -0000 1.1296
+++ ChangeLog 18 Oct 2006 14:16:01 -0000 1.1297
@@ -1,5 +1,7 @@
2006-10-18 Sandro Santilli <address@hidden>
+ * server/rect.h: added shift_x, shift_y, scale_x and scale_x
+ methods (toward making data members private).
* server/rect.h: added getters for all ordinates (toward making
them private).
* server/as_environment.h: minor cleanups.
Index: server/rect.h
===================================================================
RCS file: /sources/gnash/gnash/server/rect.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/rect.h 18 Oct 2006 14:03:44 -0000 1.3
+++ server/rect.h 18 Oct 2006 14:16:02 -0000 1.4
@@ -35,7 +35,7 @@
//
//
-/* $Id: rect.h,v 1.3 2006/10/18 14:03:44 strk Exp $ */
+/* $Id: rect.h,v 1.4 2006/10/18 14:16:02 strk Exp $ */
#ifndef GNASH_RECT_H
#define GNASH_RECT_H
@@ -89,18 +89,73 @@
/// Set ourself to bound the given point
void enclose_point(float x, float y);
+ /// Return width this rectangle
float width() const
{
if ( is_null() ) return 0;
return m_x_max-m_x_min;
}
+ /// Return height this rectangle
float height() const
{
if ( is_null() ) return 0;
return m_y_max-m_y_min;
}
+ /// Shift this rectangle horizontally
+ //
+ /// A positive offset will shift to the right,
+ /// A negative offset will shift to the left.
+ ///
+ void shift_x(float offset)
+ {
+ if ( is_null() ) return;
+ m_x_min += offset;
+ m_x_max += offset;
+ }
+
+ /// Shift this rectangle vertically
+ //
+ /// A positive offset will increment y values.
+ /// A negative offset will decrement y values.
+ ///
+ /// TODO: document what the orientation is supposed
+ /// to be (up/down) ?
+ ///
+ void shift_y(float offset)
+ {
+ if ( is_null() ) return;
+ m_y_min += offset;
+ m_y_max += offset;
+ }
+
+ /// Scale this rectangle horizontally
+ //
+ /// A positive factor will make the rectangle bigger.
+ /// A negative factor will make the rectangle smaller.
+ /// A factor of 1 will leave it unchanged.
+ ///
+ void scale_x(float factor)
+ {
+ if ( is_null() ) return;
+ m_x_min *= factor;
+ m_x_max *= factor;
+ }
+
+ /// Scale this rectangle vertically
+ //
+ /// A positive factor will make the rectangle bigger.
+ /// A negative factor will make the rectangle smaller.
+ /// A factor of 1 will leave it unchanged.
+ ///
+ void scale_y(float factor)
+ {
+ if ( is_null() ) return;
+ m_y_min *= factor;
+ m_y_max *= factor;
+ }
+
/// Get min X ordinate.
//
/// Don't call this against a null rectangle