[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11580: Small cleanups.
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11580: Small cleanups. |
Date: |
Wed, 21 Oct 2009 08:19:14 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11580 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-10-21 08:19:14 +0200
message:
Small cleanups.
modified:
libcore/asobj/Color_as.cpp
libcore/movie_root.cpp
libcore/movie_root.h
=== modified file 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color_as.cpp 2009-10-16 06:31:31 +0000
+++ b/libcore/asobj/Color_as.cpp 2009-10-21 05:50:22 +0000
@@ -275,8 +275,7 @@
MovieClip* sp = target.to_sprite();
if (sp) return sp;
as_object* o = fn.env().find_target(target.to_string());
- DisplayObject* d = getDisplayObject(o);
- if (d) return d->to_movie();
+ if (o) return o->to_movie();
return 0;
}
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2009-10-14 08:47:08 +0000
+++ b/libcore/movie_root.cpp 2009-10-21 06:07:43 +0000
@@ -440,10 +440,9 @@
return false;
}
- boost::intrusive_ptr<Movie> extern_movie;
- extern_movie = md->createMovie();
- if (extern_movie == NULL)
- {
+ boost::intrusive_ptr<Movie> extern_movie = md->createMovie();
+
+ if (!extern_movie) {
log_error(_("can't create extern Movie for %s"),
url.str());
return false;
@@ -452,10 +451,9 @@
// Parse query string
MovieClip::VariableMap vars;
url.parse_querystring(url.querystring(), vars);
- extern_movie->setVariables(vars);
-
- DisplayObject* ch = extern_movie.get();
- ch->set_depth(num+DisplayObject::staticDepthOffset);
+
+ extern_movie->setVariables(vars);
+ extern_movie->set_depth(num + DisplayObject::staticDepthOffset);
setLevel(num, extern_movie);
@@ -576,50 +574,26 @@
}
-boost::intrusive_ptr<Keyboard_as>
+Keyboard_as*
movie_root::getKeyObject()
{
- // TODO: test what happens with the global "Key" object
- // is removed or overridden by the user
-
- if (!_keyobject)
- {
- // This isn't very performant...
- // it will keep trying to find it even if impossible
- // to find.
- // TODO: use a named string...
-
- as_value kval;
- Global_as* global = _vm.getGlobal();
-
- if (global->get_member(NSV::CLASS_KEY, &kval)) {
-
- boost::intrusive_ptr<as_object> obj =
kval.to_object(*global);
- _keyobject = boost::dynamic_pointer_cast<Keyboard_as>(
obj );
- }
- }
-
- return _keyobject;
+ Global_as* global = _vm.getGlobal();
+
+ as_value kval;
+ if (!global->get_member(NSV::CLASS_KEY, &kval)) return 0;
+
+ as_object* obj = kval.to_object(*global);
+ return dynamic_cast<Keyboard_as*>( obj );
}
-boost::intrusive_ptr<as_object>
+as_object*
movie_root::getMouseObject()
{
- // TODO: test what happens with the global "Mouse" object
- // is removed or overridden by the user
- if ( ! _mouseobject )
- {
- as_value val;
- Global_as* global = _vm.getGlobal();
-
- if (global->get_member(NSV::CLASS_MOUSE, &val) )
- {
- //log_debug("Found member 'Mouse' in _global: %s", val);
- _mouseobject = val.to_object(*global);
- }
- }
-
- return _mouseobject;
+ Global_as* global = _vm.getGlobal();
+
+ as_value val;
+ if (!global->get_member(NSV::CLASS_MOUSE, &val)) return 0;
+ return val.to_object(*global);
}
@@ -632,11 +606,10 @@
// which would need to query Key object.
// Testcase: http://www.ferryhalim.com/orisinal/g3/00dog.swf
- boost::intrusive_ptr<Keyboard_as> keyobject = getKeyObject();
- if ( keyobject )
- {
- if (down) _keyobject->set_key_down(k);
- else _keyobject->set_key_up(k);
+ Keyboard_as* keyobject = getKeyObject();
+ if (keyobject) {
+ if (down) keyobject->set_key_down(k);
+ else keyobject->set_key_up(k);
}
else
{
@@ -644,7 +617,7 @@
"exist, or isn't the expected built-in");
}
- return _keyobject.get();
+ return keyobject;
}
bool
@@ -653,7 +626,7 @@
//
// First of all, notify the _global.Key object about key event
//
- Keyboard_as * global_key = notify_global_key(k, down);
+ Keyboard_as* global_key = notify_global_key(k, down);
// Notify DisplayObject key listeners for clip key events
notify_key_listeners(k, down);
@@ -1868,12 +1841,6 @@
std::mem_fun(&ExecutableCode::markReachableResources));
}
- // Mark global Key object
- if ( _keyobject ) _keyobject->setReachable();
-
- // Mark global Mouse object
- if ( _mouseobject ) _mouseobject->setReachable();
-
if (_currentFocus) _currentFocus->setReachable();
// Mark DisplayObject being dragged, if any
=== modified file 'libcore/movie_root.h'
--- a/libcore/movie_root.h 2009-10-07 07:01:31 +0000
+++ b/libcore/movie_root.h 2009-10-21 06:07:43 +0000
@@ -614,8 +614,6 @@
/// - Resources reachable by ActionQueue code (_actionQueue)
/// - Key listeners (m_key_listeners)
/// - Mouse listeners (m_mouse_listeners)
- /// - global Key object (_keyobject)
- /// - global Mouse object (_mouseobject)
/// - Any DisplayObject being dragged
///
void markReachableResources() const;
@@ -1047,10 +1045,6 @@
/// Characters for listening key events
KeyListeners m_key_listeners;
- boost::intrusive_ptr<Keyboard_as> _keyobject;
-
- boost::intrusive_ptr<as_object> _mouseobject;
-
/// Objects listening for mouse events (down,up,move)
MouseListeners m_mouse_listeners;
@@ -1126,16 +1120,10 @@
void setLevel(unsigned int num, boost::intrusive_ptr<Movie> movie);
/// Return the global Key object
- //
- /// @@ might be worth making public
- ///
- boost::intrusive_ptr<Keyboard_as> getKeyObject();
+ Keyboard_as* getKeyObject();
/// Return the global Mouse object
- //
- /// TODO: expose the Mouse as_object directly for faster calls ?
- ///
- boost::intrusive_ptr<as_object> getMouseObject();
+ as_object* getMouseObject();
/// Boundaries of the Stage are always world boundaries
/// and are only invalidated by changes in the background
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11580: Small cleanups.,
Benjamin Wolsey <=