[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/shape.cpp server/shape.h...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/shape.cpp server/shape.h... |
Date: |
Fri, 14 Sep 2007 16:02:51 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/09/14 16:02:51
Modified files:
. : ChangeLog
server : shape.cpp shape.h
server/parser : shape_character_def.cpp
Log message:
* server/shape.{cpp,h}: add path::expandBounds to compute bounds
of a path locally.
* server/parser/shape_character_def.cpp (compute_bound):
delegate
computation of path bounds to the new path method.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4319&r2=1.4320
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.cpp?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.39&r2=1.40
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4319
retrieving revision 1.4320
diff -u -b -r1.4319 -r1.4320
--- ChangeLog 14 Sep 2007 08:49:55 -0000 1.4319
+++ ChangeLog 14 Sep 2007 16:02:50 -0000 1.4320
@@ -1,5 +1,12 @@
2007-09-14 Sandro Santilli <address@hidden>
+ * server/shape.{cpp,h}: add path::expandBounds to compute bounds
+ of a path locally.
+ * server/parser/shape_character_def.cpp (compute_bound): delegate
+ computation of path bounds to the new path method.
+
+2007-09-14 Sandro Santilli <address@hidden>
+
* server/FreetypeGlyphsProvider.{cpp,h}: use USE_FREETYPE instead
of HAVE_FREETYPE2 ..
* macros/freetype.m4: don't miss to add a -I to cflags; add a note
Index: server/shape.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shape.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/shape.cpp 11 Aug 2007 05:06:51 -0000 1.38
+++ server/shape.cpp 14 Sep 2007 16:02:50 -0000 1.39
@@ -22,6 +22,7 @@
#include "tu_file.h"
#include "tesselate.h"
+#include "rect.h"
#include <cfloat>
#include <map>
@@ -155,6 +156,39 @@
return m_edges.size() == 0;
}
+void
+path::expandBounds(rect& r, unsigned int thickness) const
+{
+ const path& p = *this;
+
+ size_t nedges = m_edges.size();
+ if ( ! nedges ) return; // this path adds nothing
+
+ if (thickness)
+ {
+ // NOTE: Half of thickness would be enough (and correct) for
+ // radius, but that would not match how Flash calculates the
+ // bounds using the drawing API.
+ float radius = thickness;
+
+ r.expand_to_circle(m_ax, m_ay, radius);
+ for (unsigned int j = 0; j<nedges; j++)
+ {
+ r.expand_to_circle(m_edges[j].m_ax, m_edges[j].m_ay,
radius);
+ r.expand_to_circle(m_edges[j].m_cx, m_edges[j].m_cy,
radius);
+ }
+
+ return;
+ }
+
+ r.expand_to_point(m_ax, m_ay);
+ for (unsigned int j = 0; j<nedges; j++)
+ {
+ r.expand_to_point(m_edges[j].m_ax, p.m_edges[j].m_ay);
+ r.expand_to_point(m_edges[j].m_cx, p.m_edges[j].m_cy);
+ }
+}
+
bool path::point_test(float x, float y) const
{
Index: server/shape.h
===================================================================
RCS file: /sources/gnash/gnash/server/shape.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/shape.h 24 Apr 2007 10:01:46 -0000 1.23
+++ server/shape.h 14 Sep 2007 16:02:51 -0000 1.24
@@ -5,7 +5,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape.h,v 1.23 2007/04/24 10:01:46 strk Exp $ */
+/* $Id: shape.h,v 1.24 2007/09/14 16:02:51 strk Exp $ */
#ifndef GNASH_SHAPE_H
#define GNASH_SHAPE_H
@@ -257,6 +257,17 @@
bool withinSquareDistance(const point& p, float dist) const;
+ /// Expand given rect to include bounds of this path
+ //
+ /// @param r
+ /// The rectangle to expand with our own bounds
+ ///
+ /// @param thickness
+ /// The thickess of our lines, half the thickness will
+ /// be added in all directions
+ ///
+ void expandBounds(rect& r, unsigned int thickness) const;
+
//private:
/// Left fill style index (1-based)
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/parser/shape_character_def.cpp 10 Sep 2007 04:29:54 -0000
1.39
+++ server/parser/shape_character_def.cpp 14 Sep 2007 16:02:51 -0000
1.40
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: shape_character_def.cpp,v 1.39 2007/09/10 04:29:54 cmusick Exp $ */
+/* $Id: shape_character_def.cpp,v 1.40 2007/09/14 16:02:51 strk Exp $ */
// Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden>
2003
@@ -786,41 +786,11 @@
for (unsigned int i = 0; i < m_paths.size(); i++)
{
-
const path& p = m_paths[i];
- size_t nedges = p.m_edges.size();
- if ( ! nedges ) continue;
-
- if (p.m_line)
- {
- unsigned thickness=m_line_styles[p.m_line-1].get_width();
- if ( thickness ) // hairlines don't add any bound
- {
- // NOTE: Half of thickness would be enough (and
correct) for
- // radius, but that would not match how Flash
calculates the
- // bounds using the drawing API.
- float radius = thickness;
-
- r->expand_to_circle(p.m_ax, p.m_ay, radius);
- for (unsigned int j = 0; j<nedges; j++)
- {
- r->expand_to_circle(p.m_edges[j].m_ax,
p.m_edges[j].m_ay, radius);
- r->expand_to_circle(p.m_edges[j].m_cx,
p.m_edges[j].m_cy, radius);
- }
-
- continue;
- }
- }
-
- assert(p.m_line==0 || m_line_styles[p.m_line-1].get_width()==0);
-
- r->expand_to_point(p.m_ax, p.m_ay);
- for (unsigned int j = 0; j<nedges; j++)
- {
- r->expand_to_point(p.m_edges[j].m_ax, p.m_edges[j].m_ay);
- r->expand_to_point(p.m_edges[j].m_cx, p.m_edges[j].m_cy);
- }
+ unsigned thickness = 0;
+ if ( p.m_line ) thickness = m_line_styles[p.m_line-1].get_width();
+ p.expandBounds(*r, thickness);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/shape.cpp server/shape.h...,
Sandro Santilli <=