[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/gui.h server/Makefile.am se...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/gui.h server/Makefile.am se... |
Date: |
Tue, 17 Oct 2006 15:32:48 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/10/17 15:32:48
Modified files:
. : ChangeLog
gui : gui.h
server : Makefile.am font.h gnash.h movie_interface.h
types.cpp
server/parser : character_def.h edit_text_character_def.h
shape_character_def.h text_character_def.h
Added files:
server : rect.cpp rect.h
Log message:
* server: Makefile.am, rect.cpp rect.h: put rect class in it's
own
files, fixed width() and height() to return 0 when rect is
null.
* gui/gui.h, server: font.h, gnash.h, movie_interface.h,
types.cpp,
parser/: character_def.h, edit_text_character_def.h,
shape_character_def.h, text_character_def.h: updated all
includes
to use new rect.h file.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1266&r2=1.1267
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/server/font.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_interface.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/types.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/character_def.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/edit_text_character_def.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/text_character_def.h?cvsroot=gnash&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1266
retrieving revision 1.1267
diff -u -b -r1.1266 -r1.1267
--- ChangeLog 17 Oct 2006 15:30:04 -0000 1.1266
+++ ChangeLog 17 Oct 2006 15:32:47 -0000 1.1267
@@ -1,5 +1,12 @@
2006-10-17 Sandro Santilli <address@hidden>
+ * server: Makefile.am, rect.cpp rect.h: put rect class in it's own
+ files, fixed width() and height() to return 0 when rect is
+ null.
+ * gui/gui.h, server: font.h, gnash.h, movie_interface.h, types.cpp,
+ parser/: character_def.h, edit_text_character_def.h,
+ shape_character_def.h, text_character_def.h: updated all includes
+ to use new rect.h file.
* gui/gui.cpp (display): added missing return (doesn't tell much
actually)
* server/gnash.h, server/types.cpp (rect class): added is_null(),
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- gui/gui.h 17 Oct 2006 13:12:43 -0000 1.25
+++ gui/gui.h 17 Oct 2006 15:32:47 -0000 1.26
@@ -43,16 +43,15 @@
#endif
#include "tu_config.h"
-#include "gnash.h" // for rect
+#include "rect.h" // for composition
#include <string>
-//#include "gnash.h"
-
// Forward declarations
namespace gnash
{
class render_handler;
+ class movie_interface;
}
namespace gnash
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- server/Makefile.am 15 Oct 2006 09:11:20 -0000 1.74
+++ server/Makefile.am 17 Oct 2006 15:32:48 -0000 1.75
@@ -36,7 +36,7 @@
#
#
-# $Id: Makefile.am,v 1.74 2006/10/15 09:11:20 nihilus Exp $
+# $Id: Makefile.am,v 1.75 2006/10/17 15:32:48 strk Exp $
AUTOMAKE_OPTIONS =
@@ -92,6 +92,7 @@
font.cpp \
fontlib.cpp \
impl.cpp \
+ rect.cpp \
render.cpp \
shape.cpp \
shm.cpp \
@@ -140,6 +141,7 @@
movie.h \
movie_interface.h \
movie_root.h \
+ rect.h \
resource.h \
render.h \
shape.h \
Index: server/font.h
===================================================================
RCS file: /sources/gnash/gnash/server/font.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/font.h 26 Sep 2006 13:10:55 -0000 1.15
+++ server/font.h 17 Oct 2006 15:32:48 -0000 1.16
@@ -11,7 +11,7 @@
#include "container.h"
-#include "gnash.h"
+#include "rect.h" // for composition of class texture_glyph
#include "types.h"
#include "resource.h" // for inheritance of font
#include "ref_counted.h" // for inheritance of texture_glyph
Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- server/gnash.h 17 Oct 2006 14:33:07 -0000 1.64
+++ server/gnash.h 17 Oct 2006 15:32:48 -0000 1.65
@@ -35,7 +35,7 @@
//
//
-/* $Id: gnash.h,v 1.64 2006/10/17 14:33:07 strk Exp $ */
+/* $Id: gnash.h,v 1.65 2006/10/17 15:32:48 strk Exp $ */
/// \mainpage
///
@@ -519,63 +519,6 @@
};
-//
-// rect: rectangle type, used by render handler
-//
-
-
-/// Rectangle class
-//
-/// TODO: move in server/rect.h
-class DSOLOCAL rect
-{
-public:
-
- // TODO: make private and provide getters
- float m_x_min, m_x_max, m_y_min, m_y_max;
-
-public:
-
- /// construct a NULL rectangle
- rect();
-
- /// returns true if this is the NULL rectangle
- bool is_null() const;
-
- /// set the rectangle to the NULL value
- void set_null();
-
- void read(stream* in);
- void print() const;
- bool point_test(float x, float y) const;
-
- /// Expand this rectangle to enclose the given point.
- void expand_to_point(float x, float y);
-
- /// Set ourself to bound the given point
- void enclose_point(float x, float y);
-
- float width() const { return m_x_max-m_x_min; }
- float height() const { return m_y_max-m_y_min; }
-
- point get_corner(int i) const;
-
- /// Set ourself to bound a rectangle that has been transformed
- /// by m. This is an axial bound of an oriented (and/or
- /// sheared, scaled, etc) box.
- void enclose_transformed_rect(const matrix& m, const rect& r);
-
- /// Same as enclose_transformed_rect but expanding the current rect
instead
- /// of replacing it.
- void expand_to_transformed_rect(const matrix& m, const rect& r);
-
- /// Makes union of the given and the current rect
- DSOEXPORT void expand_to_rect(const rect& r);
-
- void set_lerp(const rect& a, const rect& b, float t);
-};
-
-
/// Color transform type, used by render handler
class DSOEXPORT cxform
{
Index: server/movie_interface.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_interface.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/movie_interface.h 14 Oct 2006 14:37:21 -0000 1.11
+++ server/movie_interface.h 17 Oct 2006 15:32:48 -0000 1.12
@@ -35,7 +35,7 @@
//
//
-/* $Id: movie_interface.h,v 1.11 2006/10/14 14:37:21 strk Exp $ */
+/* $Id: movie_interface.h,v 1.12 2006/10/17 15:32:48 strk Exp $ */
#ifndef GNASH_MOVIE_INTERFACE_H
#define GNASH_MOVIE_INTERFACE_H
@@ -50,16 +50,13 @@
#include "as_object.h" // for inheritance
-class tu_file;
-class render_handler;
-
-// forward decl
-class tu_string;
-class tu_stringi;
-
+// Forward declarations
namespace gnash {
+ class sprite_instance;
+ class rect;
+}
-class sprite_instance;
+namespace gnash {
/// An independent stateful live movie. (should be movie_instance?)
//
@@ -70,8 +67,11 @@
{
public:
- /// Set when the visual aspect this particular character or movie has been
- /// changed and redrawing is necessary.
+ /// Set when the visual aspect this particular character or movie
+ /// has been changed and redrawing is necessary.
+ //
+ /// TODO: make protected
+ ///
bool m_invalidated;
Index: server/types.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/types.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/types.cpp 17 Oct 2006 14:33:07 -0000 1.14
+++ server/types.cpp 17 Oct 2006 15:32:48 -0000 1.15
@@ -214,171 +214,6 @@
}
- //
- // rect
- //
-
- /// TODO: move in server/rect.cpp
-
- rect::rect()
- :
- m_x_min(1),
- m_x_max(-1)
- {
- }
-
- bool rect::is_null() const
- {
- return m_x_max < m_x_min;
- }
-
- void rect::set_null()
- {
- m_x_min = 1;
- m_x_max = -1;
- }
-
- void rect::read(stream* in)
- {
- in->align();
- int nbits = in->read_uint(5);
- m_x_min = (float) in->read_sint(nbits);
- m_x_max = (float) in->read_sint(nbits);
- m_y_min = (float) in->read_sint(nbits);
- m_y_max = (float) in->read_sint(nbits);
-
-// IF_DEBUG(log_msg("rect::read() nbits = %d\n", nbits));
- }
-
- // Debug spew.
- void rect::print() const
- {
- if ( is_null() )
- {
- log_parse(" null rectangle");
- }
- else
- {
- log_parse("xmin = %g, ymin = %g, xmax = %g, ymax = %g",
- TWIPS_TO_PIXELS(m_x_min),
- TWIPS_TO_PIXELS(m_y_min),
- TWIPS_TO_PIXELS(m_x_max),
- TWIPS_TO_PIXELS(m_y_max));
- }
- }
-
-
- bool rect::point_test(float x, float y) const
- // Return true if the specified point is inside this rect.
- {
- if ( is_null() ) return false;
-
- if (x < m_x_min
- || x > m_x_max
- || y < m_y_min
- || y > m_y_max)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
-
- void rect::enclose_point(float x, float y)
- {
- m_y_min = m_y_max = y;
- m_x_min = m_x_max = x;
- }
-
- void rect::expand_to_point(float x, float y)
- {
- if ( is_null() )
- {
- enclose_point(x,y);
- }
- else
- {
- m_x_min = fmin(m_x_min, x);
- m_y_min = fmin(m_y_min, y);
- m_x_max = fmax(m_x_max, x);
- m_y_max = fmax(m_y_max, y);
- }
- }
-
-
- point rect::get_corner(int i) const
- // Get one of the rect verts.
- {
- assert ( ! is_null() ); // caller should check this
- assert(i >= 0 && i < 4);
- return point(
- (i == 0 || i == 3) ? m_x_min : m_x_max,
- (i < 2) ? m_y_min : m_y_max);
- }
-
-
- void rect::enclose_transformed_rect(const matrix& m, const rect& r)
- // Set ourself to bound a rectangle that has been transformed
- // by m. This is an axial bound of an oriented (and/or
- // sheared, scaled, etc) box.
- {
- assert ( ! r.is_null() ); // caller should check this
- // Get the transformed bounding box.
- point p0, p1, p2, p3;
- m.transform(&p0, r.get_corner(0));
- m.transform(&p1, r.get_corner(1));
- m.transform(&p2, r.get_corner(2));
- m.transform(&p3, r.get_corner(3));
-
- m_x_min = m_x_max = p0.m_x;
- m_y_min = m_y_max = p0.m_y;
- expand_to_point(p1.m_x, p1.m_y);
- expand_to_point(p2.m_x, p2.m_y);
- expand_to_point(p3.m_x, p3.m_y);
- }
-
- void rect::expand_to_rect(const rect& r)
- {
- if ( r.is_null() ) return; // nothing to do
- point tmp;
- tmp = r.get_corner(0); expand_to_point(tmp.m_x, tmp.m_y);
- tmp = r.get_corner(1); expand_to_point(tmp.m_x, tmp.m_y);
- tmp = r.get_corner(2); expand_to_point(tmp.m_x, tmp.m_y);
- tmp = r.get_corner(3); expand_to_point(tmp.m_x, tmp.m_y);
- }
-
- void rect::expand_to_transformed_rect(const matrix& m, const rect& r)
- {
- assert ( ! r.is_null() ); // caller should check this
- // Get the transformed bounding box.
- point p0, p1, p2, p3;
- m.transform(&p0, r.get_corner(0));
- m.transform(&p1, r.get_corner(1));
- m.transform(&p2, r.get_corner(2));
- m.transform(&p3, r.get_corner(3));
-
- expand_to_point(p0.m_x, p0.m_y);
- expand_to_point(p1.m_x, p1.m_y);
- expand_to_point(p2.m_x, p2.m_y);
- expand_to_point(p3.m_x, p3.m_y);
- }
-
-
- void rect::set_lerp(const rect& a, const rect& b, float t)
- // Set this to the lerp of a and b.
- {
- assert ( ! a.is_null() ); // caller should check this
- assert ( ! b.is_null() ); // caller should check this
- m_x_min = flerp(a.m_x_min, b.m_x_min, t);
- m_y_min = flerp(a.m_y_min, b.m_y_min, t);
- m_x_max = flerp(a.m_x_max, b.m_x_max, t);
- m_y_max = flerp(a.m_y_max, b.m_y_max, t);
- }
-
-
} // end namespace gnash
Index: server/parser/character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/character_def.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/parser/character_def.h 12 Oct 2006 16:37:25 -0000 1.6
+++ server/parser/character_def.h 17 Oct 2006 15:32:48 -0000 1.7
@@ -42,7 +42,6 @@
#include "config.h"
#endif
-#include "gnash.h" // for rect
#include "resource.h" // for inheritance from resource class
// Forward declarations
@@ -51,7 +50,7 @@
namespace gnash {
class character;
class cache_options;
- //class sprite_instance;
+ class rect;
}
namespace gnash {
Index: server/parser/edit_text_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/edit_text_character_def.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/parser/edit_text_character_def.h 12 Oct 2006 16:37:25 -0000
1.6
+++ server/parser/edit_text_character_def.h 17 Oct 2006 15:32:48 -0000
1.7
@@ -40,7 +40,7 @@
#define _GNASH_EDIT_TEXT_CHARACTER_DEF_H_
#include "character_def.h" // for inheritance
-#include "gnash.h" // for composition (struct rect)
+#include "rect.h" // for composition
#include "textformat.h" // for composition
namespace gnash {
Index: server/parser/shape_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/parser/shape_character_def.h 10 Oct 2006 17:14:45 -0000 1.4
+++ server/parser/shape_character_def.h 17 Oct 2006 15:32:48 -0000 1.5
@@ -5,7 +5,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape_character_def.h,v 1.4 2006/10/10 17:14:45 strk Exp $ */
+/* $Id: shape_character_def.h,v 1.5 2006/10/17 15:32:48 strk Exp $ */
#ifndef GNASH_SHAPE_CHARACTER_DEF_H
#define GNASH_SHAPE_CHARACTER_DEF_H
@@ -14,6 +14,7 @@
#include "character_def.h" // for inheritance of shape_character_def
#include "tesselate.h"
#include "shape.h" // for path
+#include "rect.h" // for composition
namespace gnash {
Index: server/parser/text_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/text_character_def.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/parser/text_character_def.h 12 Oct 2006 16:37:25 -0000 1.4
+++ server/parser/text_character_def.h 17 Oct 2006 15:32:48 -0000 1.5
@@ -46,6 +46,7 @@
#include "text.h" // for text_glyph_record
#include "textformat.h" // maybe we should include it here
#include "styles.h"
+#include "rect.h" // for composition
namespace gnash {
Index: server/rect.cpp
===================================================================
RCS file: server/rect.cpp
diff -N server/rect.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/rect.cpp 17 Oct 2006 15:32:48 -0000 1.1
@@ -0,0 +1,213 @@
+//
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+//
+//
+
+#include "rect.h"
+#include "log.h"
+#include "stream.h"
+#include "matrix.h"
+#include "types.h" // for TWIPS_TO_PIXELS
+
+namespace gnash {
+
+rect::rect()
+ :
+ m_x_min(1),
+ m_x_max(-1)
+{
+}
+
+void rect::set_null()
+{
+ m_x_min = 1;
+ m_x_max = -1;
+}
+
+bool rect::is_null() const
+{
+ return m_x_max < m_x_min;
+}
+
+void rect::read(stream* in)
+{
+ in->align();
+ int nbits = in->read_uint(5);
+ m_x_min = (float) in->read_sint(nbits);
+ m_x_max = (float) in->read_sint(nbits);
+ m_y_min = (float) in->read_sint(nbits);
+ m_y_max = (float) in->read_sint(nbits);
+
+// IF_DEBUG(log_msg("rect::read() nbits = %d\n", nbits));
+}
+
+// Debug spew.
+void rect::print() const
+{
+ if ( is_null() )
+ {
+ log_parse(" null rectangle");
+ }
+ else
+ {
+ log_parse("xmin = %g, ymin = %g, xmax = %g, ymax = %g",
+ TWIPS_TO_PIXELS(m_x_min),
+ TWIPS_TO_PIXELS(m_y_min),
+ TWIPS_TO_PIXELS(m_x_max),
+ TWIPS_TO_PIXELS(m_y_max));
+ }
+}
+
+
+bool rect::point_test(float x, float y) const
+// Return true if the specified point is inside this rect.
+{
+ if ( is_null() ) return false;
+
+ if (x < m_x_min
+ || x > m_x_max
+ || y < m_y_min
+ || y > m_y_max)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+}
+
+
+void rect::enclose_point(float x, float y)
+{
+ m_y_min = m_y_max = y;
+ m_x_min = m_x_max = x;
+}
+
+void rect::expand_to_point(float x, float y)
+{
+ if ( is_null() )
+ {
+ enclose_point(x,y);
+ }
+ else
+ {
+ m_x_min = fmin(m_x_min, x);
+ m_y_min = fmin(m_y_min, y);
+ m_x_max = fmax(m_x_max, x);
+ m_y_max = fmax(m_y_max, y);
+ }
+}
+
+
+point rect::get_corner(int i) const
+// Get one of the rect verts.
+{
+ assert ( ! is_null() ); // caller should check this
+ assert(i >= 0 && i < 4);
+ return point(
+ (i == 0 || i == 3) ? m_x_min : m_x_max,
+ (i < 2) ? m_y_min : m_y_max);
+}
+
+
+void rect::enclose_transformed_rect(const matrix& m, const rect& r)
+// Set ourself to bound a rectangle that has been transformed
+// by m. This is an axial bound of an oriented (and/or
+// sheared, scaled, etc) box.
+{
+ assert ( ! r.is_null() ); // caller should check this
+ // Get the transformed bounding box.
+ point p0, p1, p2, p3;
+ m.transform(&p0, r.get_corner(0));
+ m.transform(&p1, r.get_corner(1));
+ m.transform(&p2, r.get_corner(2));
+ m.transform(&p3, r.get_corner(3));
+
+ m_x_min = m_x_max = p0.m_x;
+ m_y_min = m_y_max = p0.m_y;
+ expand_to_point(p1.m_x, p1.m_y);
+ expand_to_point(p2.m_x, p2.m_y);
+ expand_to_point(p3.m_x, p3.m_y);
+}
+
+void rect::expand_to_rect(const rect& r)
+{
+ if ( r.is_null() ) return; // nothing to do
+ point tmp;
+ tmp = r.get_corner(0); expand_to_point(tmp.m_x, tmp.m_y);
+ tmp = r.get_corner(1); expand_to_point(tmp.m_x, tmp.m_y);
+ tmp = r.get_corner(2); expand_to_point(tmp.m_x, tmp.m_y);
+ tmp = r.get_corner(3); expand_to_point(tmp.m_x, tmp.m_y);
+}
+
+void rect::expand_to_transformed_rect(const matrix& m, const rect& r)
+{
+ assert ( ! r.is_null() ); // caller should check this
+ // Get the transformed bounding box.
+ point p0, p1, p2, p3;
+ m.transform(&p0, r.get_corner(0));
+ m.transform(&p1, r.get_corner(1));
+ m.transform(&p2, r.get_corner(2));
+ m.transform(&p3, r.get_corner(3));
+
+ expand_to_point(p0.m_x, p0.m_y);
+ expand_to_point(p1.m_x, p1.m_y);
+ expand_to_point(p2.m_x, p2.m_y);
+ expand_to_point(p3.m_x, p3.m_y);
+}
+
+
+void rect::set_lerp(const rect& a, const rect& b, float t)
+// Set this to the lerp of a and b.
+{
+ assert ( ! a.is_null() ); // caller should check this
+ assert ( ! b.is_null() ); // caller should check this
+ m_x_min = flerp(a.m_x_min, b.m_x_min, t);
+ m_y_min = flerp(a.m_y_min, b.m_y_min, t);
+ m_x_max = flerp(a.m_x_max, b.m_x_max, t);
+ m_y_max = flerp(a.m_y_max, b.m_y_max, t);
+}
+
+
+} // end namespace gnash
+
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 8
+// tab-width: 8
+// indent-tabs-mode: t
+// End:
Index: server/rect.h
===================================================================
RCS file: server/rect.h
diff -N server/rect.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/rect.h 17 Oct 2006 15:32:48 -0000 1.1
@@ -0,0 +1,128 @@
+//
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+//
+//
+
+/* $Id: rect.h,v 1.1 2006/10/17 15:32:48 strk Exp $ */
+
+#ifndef GNASH_RECT_H
+#define GNASH_RECT_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tu_config.h"
+
+// Forward decl
+namespace gnash {
+ class matrix;
+ class stream;
+ class point; // is a forward declaration enough for a return type ?
+}
+
+namespace gnash {
+
+/// Rectangle class
+//
+/// used by render handler (?)
+///
+class DSOLOCAL rect
+{
+public:
+
+ // TODO: make private and provide getters
+ float m_x_min, m_x_max, m_y_min, m_y_max;
+
+public:
+
+ /// construct a NULL rectangle
+ rect();
+
+ /// returns true if this is the NULL rectangle
+ bool is_null() const;
+
+ /// set the rectangle to the NULL value
+ void set_null();
+
+ void read(stream* in);
+ void print() const;
+ bool point_test(float x, float y) const;
+
+ /// Expand this rectangle to enclose the given point.
+ void expand_to_point(float x, float y);
+
+ /// Set ourself to bound the given point
+ void enclose_point(float x, float y);
+
+ float width() const
+ {
+ if ( is_null() ) return 0;
+ return m_x_max-m_x_min;
+ }
+
+ float height() const
+ {
+ if ( is_null() ) return 0;
+ return m_y_max-m_y_min;
+ }
+
+ point get_corner(int i) const;
+
+ /// Set ourself to bound a rectangle that has been transformed
+ /// by m. This is an axial bound of an oriented (and/or
+ /// sheared, scaled, etc) box.
+ void enclose_transformed_rect(const matrix& m, const rect& r);
+
+ /// Same as enclose_transformed_rect but expanding the current rect
instead
+ /// of replacing it.
+ void expand_to_transformed_rect(const matrix& m, const rect& r);
+
+ /// Makes union of the given and the current rect
+ DSOEXPORT void expand_to_rect(const rect& r);
+
+ void set_lerp(const rect& a, const rect& b, float t);
+};
+
+
+} // namespace gnash
+
+#endif // GNASH_RECT_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/gui.h server/Makefile.am se...,
Sandro Santilli <=