[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/gnash.h server/types.cpp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/gnash.h server/types.cpp... |
Date: |
Tue, 17 Oct 2006 14:33:08 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/10/17 14:33:08
Modified files:
. : ChangeLog
server : gnash.h types.cpp edit_text_character.h
movie_root.h
server/parser : shape_character_def.cpp
Log message:
* server/gnash.h, server/types.cpp (rect class): added
is_null(),
set_null() methods and check for it in all public functions;
added enclose_point() method; added some TODO items.
* server/edit_text_character.h (reset_bounding_box): avoid
directly accessin rect class data members.
* server/movie_root.h (get_invalidated_bounds): use set_null()
to reset bounds when browsing for invalidated rectangle,
avoid directly accessing rect class data members.
* server/parser/shape_character_def.cpp (compute_bound):
avoid directly accessin rect class data members, use
rect::set_null() to initialize bounds.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1264&r2=1.1265
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/gnash/server/types.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1264
retrieving revision 1.1265
diff -u -b -r1.1264 -r1.1265
--- ChangeLog 17 Oct 2006 13:50:39 -0000 1.1264
+++ ChangeLog 17 Oct 2006 14:33:07 -0000 1.1265
@@ -1,3 +1,17 @@
+2006-10-17 Sandro Santilli <address@hidden>
+
+ * server/gnash.h, server/types.cpp (rect class): added is_null(),
+ set_null() methods and check for it in all public functions;
+ added enclose_point() method; added some TODO items.
+ * server/edit_text_character.h (reset_bounding_box): avoid
+ directly accessin rect class data members.
+ * server/movie_root.h (get_invalidated_bounds): use set_null()
+ to reset bounds when browsing for invalidated rectangle,
+ avoid directly accessing rect class data members.
+ * server/parser/shape_character_def.cpp (compute_bound):
+ avoid directly accessin rect class data members, use
+ rect::set_null() to initialize bounds.
+
2006-10-17 Bastiaan Jacques <address@hidden>
* gui/Makefile.am: when we are building the KDE GUI, build
Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- server/gnash.h 16 Oct 2006 22:17:14 -0000 1.63
+++ server/gnash.h 17 Oct 2006 14:33:07 -0000 1.64
@@ -35,7 +35,7 @@
//
//
-/* $Id: gnash.h,v 1.63 2006/10/16 22:17:14 tgc Exp $ */
+/* $Id: gnash.h,v 1.64 2006/10/17 14:33:07 strk Exp $ */
/// \mainpage
///
@@ -524,15 +524,37 @@
//
+/// 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; }
Index: server/types.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/types.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/types.cpp 16 Oct 2006 10:22:07 -0000 1.13
+++ server/types.cpp 17 Oct 2006 14:33:07 -0000 1.14
@@ -218,6 +218,25 @@
// 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)
{
@@ -234,17 +253,26 @@
// 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
@@ -259,19 +287,32 @@
}
+ 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)
- // Expand this rectangle to enclose the given point.
+ {
+ 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,
@@ -284,6 +325,7 @@
// 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));
@@ -300,6 +342,7 @@
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);
@@ -309,6 +352,7 @@
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));
@@ -326,6 +370,8 @@
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);
Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/edit_text_character.h 12 Oct 2006 16:37:25 -0000 1.13
+++ server/edit_text_character.h 17 Oct 2006 14:33:07 -0000 1.14
@@ -115,10 +115,7 @@
/// Reset our text bounding box to the given point.
void reset_bounding_box(float x, float y)
{
- m_text_bounding_box.m_x_min = x;
- m_text_bounding_box.m_x_max = x;
- m_text_bounding_box.m_y_min = y;
- m_text_bounding_box.m_y_max = y;
+ m_text_bounding_box.enclose_point(x,y);
}
std::vector<text_glyph_record> m_text_glyph_records;
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/movie_root.h 14 Oct 2006 14:37:21 -0000 1.15
+++ server/movie_root.h 17 Oct 2006 14:33:07 -0000 1.16
@@ -35,7 +35,7 @@
//
//
-/* $Id: movie_root.h,v 1.15 2006/10/14 14:37:21 strk Exp $ */
+/* $Id: movie_root.h,v 1.16 2006/10/17 14:33:07 strk Exp $ */
#ifndef GNASH_MOVIE_ROOT_H
#define GNASH_MOVIE_ROOT_H
@@ -282,24 +282,22 @@
movie* get_active_entity();
void set_active_entity(movie* ch);
- void get_invalidated_bounds(rect* bounds, bool force) {
+ void get_invalidated_bounds(rect* bounds, bool force)
+ {
- if (m_invalidated) {
+ if (m_invalidated)
+ {
// complete redraw (usually first frame)
- bounds->m_x_min = -1e10f;
- bounds->m_y_min = -1e10f;
- bounds->m_x_max = +1e10f;
- bounds->m_y_max = +1e10f;
- } else {
+ bounds->expand_to_point(-1e10f, -1e10f);
+ bounds->expand_to_point(1e10f, 1e10f);
+ }
+ else
+ {
// browse characters to compute bounds
-
// TODO: Use better start-values
- bounds->m_x_min = +1e10f;
- bounds->m_y_min = +1e10f;
- bounds->m_x_max = -1e10f;
- bounds->m_y_max = -1e10f;
-
- m_movie->get_invalidated_bounds(bounds, force||m_invalidated);
+ bounds->set_null();
+ m_movie->get_invalidated_bounds(bounds,
+ force||m_invalidated);
}
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/parser/shape_character_def.cpp 10 Oct 2006 17:14:45 -0000
1.6
+++ server/parser/shape_character_def.cpp 17 Oct 2006 14:33:07 -0000
1.7
@@ -6,7 +6,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape_character_def.cpp,v 1.6 2006/10/10 17:14:45 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.7 2006/10/17 14:33:07 strk Exp $ */
#include "shape_character_def.h"
@@ -589,10 +589,7 @@
// Find the bounds of this shape, and store them in
// the given rectangle.
{
- r->m_x_min = 1e10f;
- r->m_y_min = 1e10f;
- r->m_x_max = -1e10f;
- r->m_y_max = -1e10f;
+ r->set_null();
for (unsigned int i = 0; i < m_paths.size(); i++) {
const path& p = m_paths[i];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/gnash.h server/types.cpp...,
Sandro Santilli <=