[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/parser/shape_character_d...
From: |
Udo Giacomozzi |
Subject: |
[Gnash-commit] gnash ChangeLog server/parser/shape_character_d... |
Date: |
Mon, 05 Nov 2007 17:26:31 +0000 |
CVSROOT: /cvsroot/gnash
Module name: gnash
Changes by: Udo Giacomozzi <udog> 07/11/05 17:26:31
Modified files:
. : ChangeLog
server/parser : shape_character_def.cpp
testsuite/misc-ming.all: DrawingApiTestRunner.cpp
Log message:
* server/parser/shape_character_def.cpp: take outline hit test
algorithm from old implementation; drop the old point_test
method in favor of the new one; avoid browsing the paths
in point_test_local() when the point is already out of the
shape bounds
* testsuite/misc-ming.all/DrawingApiTestRunner.cpp: two new PASSes
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4770&r2=1.4771
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DrawingApiTestRunner.cpp?cvsroot=gnash&r1=1.25&r2=1.26
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.4770
retrieving revision 1.4771
diff -u -b -r1.4770 -r1.4771
--- ChangeLog 5 Nov 2007 16:45:42 -0000 1.4770
+++ ChangeLog 5 Nov 2007 17:26:30 -0000 1.4771
@@ -1,3 +1,12 @@
+2007-11-05 Udo Giacomozzi <address@hidden>
+
+ * server/parser/shape_character_def.cpp: take outline hit test
+ algorithm from old implementation; drop the old point_test
+ method in favor of the new one; avoid browsing the paths
+ in point_test_local() when the point is already out of the
+ shape bounds
+ * testsuite/misc-ming.all/DrawingApiTestRunner.cpp: two new PASSes
+
2007-11-05 Benjamin Wolsey <address@hidden>
* server/FreetypeGlyphsProvider.cpp: Pass bold and italic values
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/parser/shape_character_def.cpp 5 Nov 2007 14:56:10 -0000
1.44
+++ server/parser/shape_character_def.cpp 5 Nov 2007 17:26:30 -0000
1.45
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: shape_character_def.cpp,v 1.44 2007/11/05 14:56:10 udog Exp $ */
+/* $Id: shape_character_def.cpp,v 1.45 2007/11/05 17:26:30 udog Exp $ */
// Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden>
2003
@@ -36,11 +36,6 @@
#include <cfloat>
#include <algorithm>
-// Define the macro below to use the new (Udo's) point-in-shape algorithm
-// which should work perfectly for any shape but ignores strokes at the
-// moment.
-//#define USE_NEW_POINT_TEST
-
// Define the macro below to always compute bounds for shape characters
// and compare them with the bounds encoded in the SWF
//#define GNASH_DEBUG_SHAPE_BOUNDS 1
@@ -721,8 +716,6 @@
}
-#ifdef USE_NEW_POINT_TEST
-
// TODO: this should be moved to libgeometry or something
int curve_x_crossings(float x0, float y0, float x1, float y1,
float cx, float cy, float y, float &cross1, float &cross2)
@@ -816,12 +809,19 @@
// Incoming coords are local coords.
{
+ point pt(x, y);
+
+ if (m_bound.point_test(x, y) == false) {
+ // Early out.
+ return false;
+ }
+
bool result = false;
unsigned npaths = m_paths.size();
float last_crossing;
bool first = true;
- // browse all paths...
+ // browse all paths
for (unsigned pno=0; pno<npaths; pno++) {
const path& pth = m_paths[pno];
@@ -841,7 +841,31 @@
first = true;
}
- // ...and edges
+ // If the path has a line style, check for strokes there
+ if (pth.m_line != 0 ) {
+
+ assert(m_line_styles.size() >= pth.m_line);
+
+ line_style& ls = m_line_styles[pth.m_line-1];
+
+ int thickness = ls.get_width();
+ float sqdist;
+
+ if (thickness == 0) {
+ // hairline has always a tolerance of a single twip
+ sqdist = 1;
+ } else {
+ float dist = thickness/2;
+ sqdist = dist*dist;
+ }
+
+ //cout << "Thickness of line is " << thickness << " squared is " <<
sqdist << endl;
+ if (pth.withinSquareDistance(pt, sqdist))
+ return true;
+ }
+
+
+ // browse all edges of the path
for (unsigned eno=0; eno<nedges; eno++) {
const edge& edg = pth.m_edges[eno];
@@ -946,7 +970,7 @@
// ==> we have now:
- // - a valid cross_x, which is left to "x"
+ // - a valid cross_x
// - cross_dir tells the direction of the crossing
// (+1 = downward, -1 = upward)
@@ -985,71 +1009,6 @@
return result;
}
-#else // ifdef USE_NEW_POINT_TEST
-
-bool shape_character_def::point_test_local(float x, float y)
- // Return true if the specified point is on the interior of our shape.
- // Incoming coords are local coords.
-{
- if (m_bound.point_test(x, y) == false) {
- // Early out.
- return false;
- }
-
- size_t npaths = m_paths.size();
-
- if ( ! npaths ) return false;
-
- point pt(x, y);
-
- int ray_crossings=0;
-
- // Try each of the paths.
- for (size_t i = 0; i < npaths; ++i)
- {
- const path& pth = m_paths[i];
-
- if ( pth.empty() ) continue;
-
- // If it has a line style, check for strokes there
- if ( pth.m_line != 0 )
- {
- assert(m_line_styles.size() >= pth.m_line);
- line_style& ls = m_line_styles[pth.m_line-1];
- int thickness = ls.get_width();
- float sqdist;
- if ( thickness == 0 )
- {
- // hairline has always a tolerance of a single twip
- sqdist = 1;
- }
- else
- {
- float dist = thickness/2;
- sqdist = dist*dist;
- }
-
- //cout << "Thickness of line is " << thickness << " squared is " << sqdist
<< endl;
- if ( pth.withinSquareDistance(pt, sqdist) ) return true;
- }
-
- // Check for point in polygon (if filled - but that test is in point_test
itself)
- if ( pth.m_fill0 || pth.m_fill1 )
- {
- pth.ray_crossing(ray_crossings, x, y);
- }
-
- //if (pth.point_test(x, y)) return true;
- }
-
- if (ray_crossings & 1) {
- // Odd number of ray crossings means the point
- // is inside the poly.
- return true;
- }
- return false;
-}
-#endif
float shape_character_def::get_height_local() const
{
Index: testsuite/misc-ming.all/DrawingApiTestRunner.cpp
===================================================================
RCS file:
/cvsroot/gnash/gnash/testsuite/misc-ming.all/DrawingApiTestRunner.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- testsuite/misc-ming.all/DrawingApiTestRunner.cpp 30 Oct 2007 15:32:06
-0000 1.25
+++ testsuite/misc-ming.all/DrawingApiTestRunner.cpp 5 Nov 2007 17:26:30
-0000 1.26
@@ -170,7 +170,7 @@
// Over the green curve
tester.movePointerTo(376, 139);
- xcheck(tester.isMouseOverMouseEntity()); // fails due to
edge::withinSquareDistance bug
+ check(tester.isMouseOverMouseEntity()); // failed due to
edge::withinSquareDistance bug
check_pixel(376, 139, 2, green, 2); // fails due to bug in AGG
// Over the center of the green circle fill
@@ -180,7 +180,7 @@
// Over the boundary of the green circle fill
tester.movePointerTo(363, 174);
- xcheck(tester.isMouseOverMouseEntity()); // fails due to
edge::withinSquareDistance bug
+ check(tester.isMouseOverMouseEntity()); // failed due to
edge::withinSquareDistance bug
check_pixel(363, 174, 2, black, 2);
// Check that nothing is drawin in the bottom line
- [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., Udo Giacomozzi, 2007/11/05
- [Gnash-commit] gnash ChangeLog server/parser/shape_character_d...,
Udo Giacomozzi <=
- [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., Udo Giacomozzi, 2007/11/08
- Re: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., strk, 2007/11/08
- Re[2]: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., Udo Giacomozzi, 2007/11/08
- Re: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., strk, 2007/11/08
- Re[2]: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., Udo Giacomozzi, 2007/11/12
- Re: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., strk, 2007/11/12
- Re: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., strk, 2007/11/12
- Re[2]: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., Udo Giacomozzi, 2007/11/12
- Re: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., strk, 2007/11/12
- Re[2]: [Gnash-commit] gnash ChangeLog server/parser/shape_character_d..., Udo Giacomozzi, 2007/11/12