[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libgeometry/Range2d.h
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libgeometry/Range2d.h |
Date: |
Fri, 08 Dec 2006 08:27:24 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/12/08 08:27:24
Modified files:
. : ChangeLog
libgeometry : Range2d.h
Log message:
* libgeometry/Range2d.h: added scale() functions to scale both
horizontally and vertically in a single call.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1886&r2=1.1887
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/Range2d.h?cvsroot=gnash&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1886
retrieving revision 1.1887
diff -u -b -r1.1886 -r1.1887
--- ChangeLog 7 Dec 2006 17:45:46 -0000 1.1886
+++ ChangeLog 8 Dec 2006 08:27:24 -0000 1.1887
@@ -1,3 +1,8 @@
+2006-12-08 Sandro Santilli <address@hidden>
+
+ * libgeometry/Range2d.h: added scale() functions to scale both
+ horizontally and vertically in a single call.
+
2006-12-07 Sandro Santilli <address@hidden>
* testsuite/actionscript.all/String.as: more
Index: libgeometry/Range2d.h
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/Range2d.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libgeometry/Range2d.h 6 Dec 2006 08:46:50 -0000 1.4
+++ libgeometry/Range2d.h 8 Dec 2006 08:27:24 -0000 1.5
@@ -19,7 +19,7 @@
//
-/* $Id: Range2d.h,v 1.4 2006/12/06 08:46:50 strk Exp $ */
+/* $Id: Range2d.h,v 1.5 2006/12/08 08:27:24 strk Exp $ */
#ifndef GNASH_RANGE2D_H
#define GNASH_RANGE2D_H
@@ -380,7 +380,7 @@
///
Range2d<T> scaleX(T factor)
{
- if ( isNull() || isWorld() ) return *this;
+ if ( ! isFinite() ) return *this;
_xmin *= factor;
_xmax *= factor;
assert(_xmin < _xmax); // in case of overflow...
@@ -402,8 +402,7 @@
///
Range2d<T> scaleY(T factor)
{
- if ( isNull() ) return *this;
-
+ if ( ! isFinite() ) return *this;
_ymin *= factor;
_ymax *= factor;
assert(_ymin < _ymax); // in case of overflow...
@@ -411,6 +410,46 @@
return *this;
}
+ /// Scale this Range2d in both directions
+ //
+ /// A positive factor will make the Range2dangle bigger.
+ /// A negative factor will make the Range2dangle smaller.
+ /// A factor of 1 will leave it unchanged.
+ /// Control point is the origin (0,0).
+ ///
+ /// If the range so scaled will hit the numerical limit
+ /// of the range an assertion will fail
+ /// (TODO: throw an exception instead!).
+ ///
+ /// @param xfactor
+ /// The horizontal scale factor
+ ///
+ /// @param yfactor
+ /// The vertical scale factor
+ ///
+ /// @return a reference to this instance
+ ///
+ Range2d<T> scale(T xfactor, T yfactor)
+ {
+ if ( ! isFinite() ) return *this;
+
+ _xmin *= xfactor;
+ _xmax *= xfactor;
+ assert(_xmin < _xmax); // in case of overflow...
+
+ _ymin *= yfactor;
+ _ymax *= yfactor;
+ assert(_ymin < _ymax); // in case of overflow...
+
+ return *this;
+ }
+
+ /// Scale this Range2d in both directions with the same factor
+ Range2d<T> scale(T factor)
+ {
+ return scale(factor, factor);
+ }
+
/// Grow this range by the given amout in all directions.
//
/// WORLD or NULL ranges will be unchanged.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libgeometry/Range2d.h,
Sandro Santilli <=