[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... |
Date: |
Thu, 08 May 2008 08:10:53 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 08/05/08 08:10:53
Modified files:
. : ChangeLog
server : sprite_instance.cpp sprite_instance.h
testsuite/misc-ming.all: Makefile.am RollOverOutTest.c
Added files:
testsuite/misc-ming.all: empty.as
Removed files:
testsuite/media: empty_swf.swf
Log message:
* server/sprite_instance.{h,cpp}: add a pointInHitableShape() for
fixing MovieClip.hitTest().
* testsuite/media/empty_swf.swf: removed.
testsuite/misc-ming.all/empty.as: add a empty as file for making an
empty frame.
testsuite/misc-ming.all/Makefile.am: use empty.as instead of
empty_swf.swf
testsuite/misc-ming.all/RollOverOutTest.c: pass.
should fix bug #22889.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6550&r2=1.6551
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.532&r2=1.533
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.194&r2=1.195
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.197&r2=1.198
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/RollOverOutTest.c?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/empty.as?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/media/empty_swf.swf?cvsroot=gnash&r1=1.1&r2=0
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6550
retrieving revision 1.6551
diff -u -b -r1.6550 -r1.6551
--- ChangeLog 8 May 2008 08:05:14 -0000 1.6550
+++ ChangeLog 8 May 2008 08:10:51 -0000 1.6551
@@ -1,10 +1,19 @@
+2008-05-08 Zou Lunkai <address@hidden>
+
+ * server/sprite_instance.{h,cpp}: add a pointInHitableShape() for
+ fixing MovieClip.hitTest().
+ * testsuite/media/empty_swf.swf: removed.
+ testsuite/misc-ming.all/empty.as: add a empty as file for making an
empty frame.
+ testsuite/misc-ming.all/Makefile.am: use empty.as instead of
empty_swf.swf
+ testsuite/misc-ming.all/RollOverOutTest.c: pass.
+ should fix bug #22889.
+
2008-05-08 Benjamin Wolsey <address@hidden>
* server/parser/action_buffer.cpp: it's a vector, use push_back.
* server/swf/PlaceObject2Tag.cpp: use ensureBytes, drop
assertion, with comment: rely on action_buffer's safety.
-
2008-05-07 Russ Nelson <address@hidden>
* libamf/amf.cpp: eliminate "tmp used before initialization"
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.532
retrieving revision 1.533
diff -u -b -r1.532 -r1.533
--- server/sprite_instance.cpp 7 May 2008 09:41:13 -0000 1.532
+++ server/sprite_instance.cpp 8 May 2008 08:10:51 -0000 1.533
@@ -821,7 +821,7 @@
bool shapeFlag = fn.arg(2).to_bool();
if ( ! shapeFlag ) return sprite->pointInBounds(x, y);
- else return sprite->pointInVisibleShape(x, y);
+ else return sprite->pointInHitableShape(x, y);
}
default:
@@ -3731,6 +3731,43 @@
};
+/// Find the first hitable character whose shape contain the point
+//
+/// Point coordinates in world TWIPS
+///
+class HitableShapeContainerFinder {
+ bool _found;
+ float _x;
+ float _y;
+
+public:
+ HitableShapeContainerFinder(float x, float y)
+ :
+ _found(false),
+ _x(x),
+ _y(y)
+ {}
+
+ bool operator() (character* ch)
+ {
+ if( ch->isDynamicMask() )
+ {
+ return true;
+ }
+ else if ( ch->pointInShape(_x, _y) )
+ {
+ _found = true;
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ bool hitFound() { return _found; }
+};
+
bool
sprite_instance::pointInShape(float x, float y) const
{
@@ -3768,6 +3805,33 @@
return _drawable_inst->pointInVisibleShape(x, y);
}
+bool
+sprite_instance::pointInHitableShape(float x, float y) const
+{
+ if ( isDynamicMask() && !can_handle_mouse_event() )
+ {
+ return false;
+ }
+
+ character* mask = getMask();
+ if ( mask && ! mask->pointInShape(x, y) )
+ {
+ return false;
+ }
+
+ HitableShapeContainerFinder finder(x, y);
+ m_display_list.visitBackward(finder);
+
+ if ( finder.hitFound() )
+ {
+ return true;
+ }
+ else
+ {
+ return _drawable_inst->pointInShape(x, y);
+ }
+}
+
character*
sprite_instance::get_topmost_mouse_entity(float x, float y)
{
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -b -r1.194 -r1.195
--- server/sprite_instance.h 5 May 2008 18:50:07 -0000 1.194
+++ server/sprite_instance.h 8 May 2008 08:10:52 -0000 1.195
@@ -147,6 +147,12 @@
// See dox in character.h
bool pointInVisibleShape(float x, float y) const;
+ /// return true if the given point is located in this sprite.
+ ///
+ /// all sprites except mouse-insensitive dynamic masks are hitable.
+ /// _visible property is ignored for hitable characters.
+ bool pointInHitableShape(float x, float y) const;
+
/// Return 0-based index to current frame
size_t get_current_frame() const
{
Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -b -r1.197 -r1.198
--- testsuite/misc-ming.all/Makefile.am 7 May 2008 08:30:39 -0000 1.197
+++ testsuite/misc-ming.all/Makefile.am 8 May 2008 08:10:52 -0000 1.198
@@ -1573,7 +1573,7 @@
DrawingApiTest.swf: $(srcdir)/DrawingApiTest.as
- $(MAKESWF) -r 1 -o $@ $(abs_mediadir)/empty_swf.swf
$(srcdir)/DrawingApiTest.as
+ $(MAKESWF) -r 1 -o $@ $(srcdir)/empty.as $(srcdir)/DrawingApiTest.as
DrawingApiTestRunner_SOURCES = \
DrawingApiTestRunner.cpp \
Index: testsuite/misc-ming.all/RollOverOutTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/RollOverOutTest.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/misc-ming.all/RollOverOutTest.c 6 May 2008 05:32:18 -0000
1.5
+++ testsuite/misc-ming.all/RollOverOutTest.c 8 May 2008 08:10:52 -0000
1.6
@@ -242,7 +242,7 @@
// hitTest works for visible sprites.
check(mo, "visible_mc.hitTest(80, 120, true)");
// hitTest works for invisible sprites.
- xcheck(mo, "invisible_mc.hitTest(80, 180, true)");
+ check(mo, "invisible_mc.hitTest(80, 180, true)");
// hitTest works for static placed maskes.
check(mo, "static_mask.hitTest(80, 240, true)");
// hitTest does not work for dynamic masks created by drawing API.
Index: testsuite/misc-ming.all/empty.as
===================================================================
RCS file: testsuite/misc-ming.all/empty.as
diff -N testsuite/misc-ming.all/empty.as
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/empty.as 8 May 2008 08:10:52 -0000 1.1
@@ -0,0 +1,4 @@
+// an empty as file for building an empty frame for other as or swf file.
+// usage: makeswf empty.as other_souce.as -o output.swf
+
+
Index: testsuite/media/empty_swf.swf
===================================================================
RCS file: testsuite/media/empty_swf.swf
diff -N testsuite/media/empty_swf.swf
Binary files /tmp/cvsLWe5wz and /dev/null differ
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...,
Zou Lunkai <=