[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. 0f01f719dba2a7db3a6d
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. 0f01f719dba2a7db3a6d410eccf091d1c6338694 |
Date: |
Fri, 03 Dec 2010 15:40:54 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via 0f01f719dba2a7db3a6d410eccf091d1c6338694 (commit)
via e79e72f7629bf12fd541ff47e1154b73faad8e74 (commit)
via 892ebef9a7993144af74e55e9bfa9d0f68b90768 (commit)
via 790d98ff241e6f30712c97c057e92aa3e330475f (commit)
via bec25efdbe207fca18a2733df92442d41e59ee70 (commit)
via 3a1a2bb5a93620d90e3f100f3046e0a57f5dfa97 (commit)
via 05dec445e382f254f9ae2679f7d8bf3a5111e077 (commit)
via f14405b50b2bdabd602143628db52bf98f30b2a6 (commit)
via ae8f86b3f845d0a30a30034b966efc3b067bff2a (commit)
via 8098779b102bf2d2681493b6f2532cdeef7b45d8 (commit)
via aca7550eaadf01f4736ec1c6a1058f9740f9ff32 (commit)
from 692eb4829dec11140a38ec3371d97dd502b0540c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=0f01f719dba2a7db3a6d410eccf091d1c6338694
commit 0f01f719dba2a7db3a6d410eccf091d1c6338694
Merge: e79e72f 692eb48
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 16:25:34 2010 +0100
Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash
http://git.savannah.gnu.org/cgit//commit/?id=e79e72f7629bf12fd541ff47e1154b73faad8e74
commit e79e72f7629bf12fd541ff47e1154b73faad8e74
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 16:25:14 2010 +0100
Really don't call any ltdl functions.
diff --git a/libbase/extension.cpp b/libbase/extension.cpp
index 619af2d..877c598 100644
--- a/libbase/extension.cpp
+++ b/libbase/extension.cpp
@@ -22,18 +22,6 @@
#include "gnashconfig.h"
#endif
-// #if defined(_WIN32) || defined(WIN32)
-// # define lock(lib_mutex);
-// # define scoped_lock ;
-// #define PLUGINSDIR "./" //hack
-// #define USE_DIRENT 1
-// #else
-// # include <boost/detail/lightweight_mutex.hpp>
-// using boost::detail::lightweight_mutex;
-// # define scoped_lock lightweight_mutex::scoped_lock
-// static lightweight_mutex lib_mutex;
-// #endif
-
#if defined(WIN32) || defined(_WIN32)
#define LIBLTDL_DLL_IMPORT 1
#endif
@@ -95,7 +83,9 @@ Extension::Extension()
}
log_debug("Plugins path: %s", _pluginsdir);
+#ifdef HAVE_LTDL
lt_dlsetsearchpath(_pluginsdir.c_str());
+#endif
}
Extension::Extension(const std::string& dir)
@@ -106,7 +96,9 @@ Extension::Extension(const std::string& dir)
// gnash_mutex_seterror, gnash_mutex_geterror);
#endif
_pluginsdir = dir;
+#ifdef HAVE_LTDL
lt_dlsetsearchpath(_pluginsdir.c_str());
+#endif
}
Extension::~Extension()
@@ -119,7 +111,9 @@ Extension::scanAndLoad(const std::string& dir, as_object
&obj)
{
// GNASH_REPORT_FUNCTION;
+#ifdef HAVE_LTDL
lt_dlsetsearchpath(_pluginsdir.c_str());
+#endif
_pluginsdir = dir;
return scanAndLoad(obj);
diff --git a/libbase/sharedlib.cpp b/libbase/sharedlib.cpp
index 06f45b4..c0b87f5 100644
--- a/libbase/sharedlib.cpp
+++ b/libbase/sharedlib.cpp
@@ -154,6 +154,8 @@ SharedLib::getInitEntry (const std::string& symbol)
} else {
log_debug (_("Found symbol %s @ %p"), symbol, (void *)run);
}
+#else
+ (void)symbol;
#endif
return (initentry*)(run);
http://git.savannah.gnu.org/cgit//commit/?id=892ebef9a7993144af74e55e9bfa9d0f68b90768
commit 892ebef9a7993144af74e55e9bfa9d0f68b90768
Author: Petter Reinholdtsen <address@hidden>
Date: Fri Dec 3 12:15:15 2010 +0100
Replace g_print with iostreams.
diff --git a/utilities/findwebcams.cpp b/utilities/findwebcams.cpp
index bb0d58b..d98d160 100644
--- a/utilities/findwebcams.cpp
+++ b/utilities/findwebcams.cpp
@@ -87,7 +87,7 @@ gint findVidDevs(std::vector<data*>& vidVect) {
g_object_get (element, "device-name", &dev_name, NULL);
gst_element_set_state (element, GST_STATE_NULL);
if (strcmp(dev_name, "null") == 0) {
- g_print("no v4l video sources found\n");
+ std::cout << "no v4l video sources found" << std::endl;
}
else {
vidVect.push_back(new data);
@@ -121,7 +121,7 @@ gint findVidDevs(std::vector<data*>& vidVect) {
g_object_get (element, "device-name", &dev_name, NULL);
gst_element_set_state (element, GST_STATE_NULL);
if (strcmp(dev_name, "null") == 0) {
- g_print("no v4l2 video sources found.\n");
+ std::cout << "no v4l2 video sources found." << std::endl;
}
else {
vidVect.push_back(new data);
@@ -155,30 +155,38 @@ int main () {
int fromrc = rcfile.getWebcamDevice();
if (fromrc == -1) {
- g_print("\nUse this utility to set your desired default webcam
device.\n");
+ std::cout << std::endl
+ << "Use this utility to set your desired default webcam
device." << std::endl;
numdevs = findVidDevs(vidVector);
- g_print("\nINFO: these devices were ignored because they are supported
by both");
- g_print("\nvideo4linux and video4linux2:\n\n");
+ std::cout << std::endl
+ << "INFO: these devices were ignored because they are supported
by both" << std::endl
+ << "video4linux and video4linux2:" << std::endl << std::endl;
for (size_t i = 0; i < numdevs; ++i) {
if (vidVector[i]->duplicate == true) {
- g_print(" %s (%s)\n", vidVector[i]->deviceName,
vidVector[i]->deviceType);
+ std::cout << " " << vidVector[i]->deviceName
+ << " (" << vidVector[i]->deviceType << ")" << std::endl;
}
}
- g_print("\nGnash interacts with v4l2 sources better than v4l sources,
thus the");
- g_print("\nv4l sources will not be printed in the list below.\n");
- g_print("\nFound %d video devices: \n\n", (numdevs - numDuplicates));
+ std::cout << std::endl
+ << "Gnash interacts with v4l2 sources better than v4l sources,
thus the" << std::endl
+ << "v4l sources will not be printed in the list below." <<
std::endl
+ << std::endl
+ << "Found " << (numdevs - numDuplicates)
+ << " video devices: " << std::endl << std::endl;
gint counter = 0;
for (size_t i = 0; i < numdevs; ++i)
{
if (i == 0 && (vidVector[i] != 0)) {
- g_print(" %d. Video Test Source (videotestsrc)\n", i);
+ std::cout << " " << i
+ << ". Video Test Source (videotestsrc)" << std::endl;
counter++;
} else if (i == 0 && (vidVector[i] == 0)) {
- g_print("no test video device available");
+ std::cout << "no test video device available";
} else {
if (vidVector[i]->duplicate != true) {
- g_print(" %d. %s (%s)\n", counter,
vidVector[i]->deviceName,
- vidVector[i]->deviceType);
+ std::cout << " " << counter << ". "
+ << vidVector[i]->deviceName
+ << " (" << vidVector[i]->deviceType << ")" <<
std::endl;
counter++;
}
}
@@ -188,8 +196,9 @@ int main () {
std::string fromCin;
do {
dev_select = -1;
- g_print("\nChoose the device you would like to use (0-%d): ",
- (numdevs - numDuplicates - 1));
+ std::cout << std::endl
+ << "Choose the device you would like to use (0-"
+ << (numdevs - numDuplicates - 1) << "): ";
std::cin >> fromCin;
if (fromCin.size() != 1) {
dev_select = -1;
@@ -199,23 +208,27 @@ int main () {
dev_select = atoi(fromCin.c_str());
}
if ((dev_select < 0) || (dev_select > (numdevs - numDuplicates -
1))) {
- g_print("You must make a valid device selection\n");
+ std::cout << "You must make a valid device selection" <<
std::endl;
}
} while ((dev_select < 0) || (dev_select > (numdevs - numDuplicates -
1)));
- g_print("\nTo select this camera, add this line to your gnashrc
file:\n");
- g_print("set webcamDevice %d\n", vidVector[dev_select +
numDuplicates]->deviceNumber);
+ std::cout << std::endl
+ << "To select this camera, add this line to your gnashrc file:"
<< std::endl
+ << "set webcamDevice "
+ << (vidVector[dev_select + numDuplicates]->deviceNumber) <<
std::endl;
} else {
numdevs = findVidDevs(vidVector);
if (fromrc <= (vidVector.size() - 1)) {
- g_print("\nThe gnashrc file reports default webcam is set to:\n");
- g_print("%s (%s)\n", vidVector[fromrc]->deviceName,
- vidVector[fromrc]->deviceType);
- g_print("To change this setting, delete the 'set webcamDevice'
line\n");
- g_print("from your gnashrc file and re-run this program.\n\n");
+ std::cout << std::endl
+ << "The gnashrc file reports default webcam is set to:" <<
std::endl
+ << vidVector[fromrc]->deviceName
+ << " (" << vidVector[fromrc]->deviceType << ")" << std::endl
+ << "To change this setting, delete the 'set webcamDevice'
line" << std::endl
+ << "from your gnashrc file and re-run this program." <<
std::endl << std::endl;
} else {
- g_print("\nYou have an invalid webcam chosen in your gnashrc
file.\n");
- g_print("Try reattaching the device or deleting the value from
gnashrc\n");
- g_print("and running this program again\n");
+ std::cout << std::endl
+ << "You have an invalid webcam chosen in your gnashrc file." <<
std::endl
+ << "Try reattaching the device or deleting the value from
gnashrc" << std::endl
+ << "and running this program again" << std::endl;
}
}
return 0;
http://git.savannah.gnu.org/cgit//commit/?id=790d98ff241e6f30712c97c057e92aa3e330475f
commit 790d98ff241e6f30712c97c057e92aa3e330475f
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 12:12:01 2010 +0100
Do another TODO.
diff --git a/cygnal/cvm.cpp b/cygnal/cvm.cpp
index 02860e1..5d32e46 100644
--- a/cygnal/cvm.cpp
+++ b/cygnal/cvm.cpp
@@ -516,7 +516,7 @@ play_movie(const std::string& filename, const RunResources&
runResources)
fprintf(stderr, "Kicking movie after %g seconds in STOP mode,
kick ct = %d\n", waitforadvance, kick_count);
fflush(stderr);
m.goto_frame(last_frame + 1);
- m.set_play_state(gnash::MovieClip::PLAYSTATE_PLAY);
+
m.getRootMovie().setPlayState(gnash::MovieClip::PLAYSTATE_PLAY);
kick_count++;
if (kick_count > 10) {
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 32fc1a5..329b20c 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -954,9 +954,9 @@ Gui::advanceMovie()
const size_t tot_frames = m->getRootMovie()->get_frame_count();
const bool advanced = m->advance();
- m->getRootMovie.ensureFrameLoaded(tot_frames);
+ m->getRootMovie().ensureFrameLoaded(tot_frames);
m->goto_frame(cur_frame + 1);
- m->set_play_state(gnash::MovieClip::PLAYSTATE_PLAY);
+ m->getRootMovie().setPlayState(gnash::MovieClip::PLAYSTATE_PLAY);
log_debug(_("Frame %d"), m->get_current_frame());
#endif
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 47c3b5b..c16e187 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -299,8 +299,10 @@ public:
void setDragState(const DragState& st);
- /// @return the originating root movie (not necessarely _level0)
- const Movie& getRootMovie() const {
+ /// Access the originating root movie (not necessarily _level0)
+ //
+ /// @return the original root movie.
+ Movie& getRootMovie() {
return *_rootMovie;
}
@@ -409,14 +411,6 @@ public:
void display();
- /// Delegate to originating root movie
- //
- /// TODO: drop ?
- void set_play_state(MovieClip::PlayState s)
- {
- _rootMovie->setPlayState(s);
- }
-
/// Get a unique number for unnamed instances.
size_t nextUnnamedInstance() {
return ++_unnamedInstance;
diff --git a/utilities/processor.cpp b/utilities/processor.cpp
index dce42fc..f1d3142 100644
--- a/utilities/processor.cpp
+++ b/utilities/processor.cpp
@@ -517,7 +517,7 @@ play_movie(const std::string& filename, const RunResources&
runResources)
fprintf(stderr, "Kicking movie after %g seconds in STOP mode,
kick ct = %d\n", waitforadvance, kick_count);
fflush(stderr);
m.goto_frame(last_frame + 1);
- m.set_play_state(gnash::MovieClip::PLAYSTATE_PLAY);
+
m.getRootMovie().setPlayState(gnash::MovieClip::PLAYSTATE_PLAY);
kick_count++;
if (kick_count > 10) {
http://git.savannah.gnu.org/cgit//commit/?id=bec25efdbe207fca18a2733df92442d41e59ee70
commit bec25efdbe207fca18a2733df92442d41e59ee70
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 11:39:47 2010 +0100
Do TODO.
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 0273e24..47c3b5b 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -304,15 +304,6 @@ public:
return *_rootMovie;
}
- /// Creating new MovieClips needs this for now.
- //
- /// TODO: create MovieClips without this and drop. It's deliberately
- /// different from getRootMovie() so it doesn't end up getting used
- /// in the same way.
- Movie* topLevelMovie() const {
- return _rootMovie;
- }
-
/// Return the current nominal frame rate for the Stage.
//
/// This is dependent on the Movie set as root movie.
http://git.savannah.gnu.org/cgit//commit/?id=3a1a2bb5a93620d90e3f100f3046e0a57f5dfa97
commit 3a1a2bb5a93620d90e3f100f3046e0a57f5dfa97
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 11:32:10 2010 +0100
Tabs to spaces.
diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index abac428..108abd5 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -134,24 +134,24 @@ DisplayObject::getNextUnnamedInstanceName()
{
assert(_object);
movie_root& mr = getRoot(*_object);
- std::ostringstream ss;
- ss << "instance" << mr.nextUnnamedInstance();
+ std::ostringstream ss;
+ ss << "instance" << mr.nextUnnamedInstance();
VM& vm = getVM(*_object);
- return getURI(vm, ss.str(), true);
+ return getURI(vm, ss.str(), true);
}
int
DisplayObject::getWorldVolume() const
{
- int volume=_volume;
- if (_parent != NULL)
- {
- volume = int(volume*_parent->getVolume()/100.0);
- }
+ int volume=_volume;
+ if (_parent != NULL)
+ {
+ volume = int(volume*_parent->getVolume()/100.0);
+ }
- return volume;
+ return volume;
}
@@ -167,7 +167,7 @@ DisplayObject::pathElement(const ObjectURI& uri)
// TODO: put ".." and "." in namedStrings
if (key == st.find("..")) return getObject(parent());
- if (key == st.find(".")) return obj;
+ if (key == st.find(".")) return obj;
// The check is case-insensitive for SWF6 and below.
// TODO: cache ObjectURI(NSV::PROP_THIS) [as many others...]
@@ -175,50 +175,50 @@ DisplayObject::pathElement(const ObjectURI& uri)
(uri, ObjectURI(NSV::PROP_THIS))) {
return obj;
}
- return 0;
+ return 0;
}
void
DisplayObject::set_invalidated()
{
- set_invalidated("unknown", -1);
+ set_invalidated("unknown", -1);
}
void
DisplayObject::set_invalidated(const char* debug_file, int debug_line)
{
- // Set the invalidated-flag of the parent. Note this does not mean that
- // the parent must re-draw itself, it just means that one of it's childs
- // needs to be re-drawn.
- if ( _parent ) _parent->set_child_invalidated();
+ // Set the invalidated-flag of the parent. Note this does not mean that
+ // the parent must re-draw itself, it just means that one of it's childs
+ // needs to be re-drawn.
+ if ( _parent ) _parent->set_child_invalidated();
- // Ok, at this point the instance will change it's
- // visual aspect after the
- // call to set_invalidated(). We save the *current*
- // position of the instance because this region must
- // be updated even (or first of all) if the DisplayObject
- // moves away from here.
- //
- if ( ! _invalidated )
- {
- _invalidated = true;
-
- #ifdef DEBUG_SET_INVALIDATED
- log_debug("%p set_invalidated() of %s in %s:%d",
- (void*)this, get_name(), debug_file, debug_line);
- #else
- UNUSED(debug_file);
- UNUSED(debug_line);
- #endif
-
- // NOTE: the SnappingRanges instance used here is not
initialized by the
- // GUI and therefore uses the default settings. This should not
be a
- // problem but special snapping ranges configuration done in
gui.cpp
- // is ignored here...
-
- m_old_invalidated_ranges.setNull();
- add_invalidated_bounds(m_old_invalidated_ranges, true);
- }
+ // Ok, at this point the instance will change it's
+ // visual aspect after the
+ // call to set_invalidated(). We save the *current*
+ // position of the instance because this region must
+ // be updated even (or first of all) if the DisplayObject
+ // moves away from here.
+ //
+ if ( ! _invalidated )
+ {
+ _invalidated = true;
+
+ #ifdef DEBUG_SET_INVALIDATED
+ log_debug("%p set_invalidated() of %s in %s:%d",
+ (void*)this, get_name(), debug_file, debug_line);
+ #else
+ UNUSED(debug_file);
+ UNUSED(debug_line);
+ #endif
+
+ // NOTE: the SnappingRanges instance used here is not initialized by
the
+ // GUI and therefore uses the default settings. This should not be a
+ // problem but special snapping ranges configuration done in gui.cpp
+ // is ignored here...
+
+ m_old_invalidated_ranges.setNull();
+ add_invalidated_bounds(m_old_invalidated_ranges, true);
+ }
}
@@ -240,15 +240,15 @@ DisplayObject::set_child_invalidated()
if ( ! _child_invalidated )
{
_child_invalidated=true;
- if ( _parent ) _parent->set_child_invalidated();
+ if ( _parent ) _parent->set_child_invalidated();
}
}
void
DisplayObject::extend_invalidated_bounds(const InvalidatedRanges& ranges)
{
- set_invalidated(__FILE__, __LINE__);
- m_old_invalidated_ranges.add(ranges);
+ set_invalidated(__FILE__, __LINE__);
+ m_old_invalidated_ranges.add(ranges);
}
as_value
@@ -340,9 +340,9 @@ DisplayObject::set_visible(bool visible)
void
DisplayObject::setWidth(double newwidth)
{
- const SWFRect& bounds = getBounds();
- const double oldwidth = bounds.width();
- assert(oldwidth >= 0);
+ const SWFRect& bounds = getBounds();
+ const double oldwidth = bounds.width();
+ assert(oldwidth >= 0);
const double xscale = oldwidth ? (newwidth / oldwidth) : 0;
const double rotation = _rotation * PI / 180.0;
@@ -356,7 +356,7 @@ DisplayObject::setWidth(double newwidth)
as_value
getHeight(DisplayObject& o)
{
- SWFRect bounds = o.getBounds();
+ SWFRect bounds = o.getBounds();
const SWFMatrix m = getMatrix(o);
m.transform(bounds);
return twipsToPixels(bounds.height());
@@ -378,10 +378,10 @@ setHeight(DisplayObject& o, const as_value& val)
void
DisplayObject::setHeight(double newheight)
{
- const SWFRect& bounds = getBounds();
+ const SWFRect& bounds = getBounds();
- const double oldheight = bounds.height();
- assert(oldheight >= 0);
+ const double oldheight = bounds.height();
+ assert(oldheight >= 0);
const double yscale = oldheight ? (newheight / oldheight) : 0;
const double rotation = _rotation * PI / 180.0;
@@ -413,45 +413,45 @@ DisplayObject::setMatrix(const SWFMatrix& m, bool
updateCache)
void
DisplayObject::set_event_handlers(const Events& copyfrom)
{
- for (Events::const_iterator it=copyfrom.begin(), itE=copyfrom.end();
- it != itE; ++it)
- {
- const event_id& ev = it->first;
- const BufferList& bufs = it->second;
- for (size_t i = 0, e = bufs.size(); i < e; ++i)
- {
- const action_buffer* buf = bufs[i];
- assert(buf);
- add_event_handler(ev, *buf);
- }
- }
+ for (Events::const_iterator it=copyfrom.begin(), itE=copyfrom.end();
+ it != itE; ++it)
+ {
+ const event_id& ev = it->first;
+ const BufferList& bufs = it->second;
+ for (size_t i = 0, e = bufs.size(); i < e; ++i)
+ {
+ const action_buffer* buf = bufs[i];
+ assert(buf);
+ add_event_handler(ev, *buf);
+ }
+ }
}
void
DisplayObject::add_event_handler(const event_id& id, const action_buffer& code)
{
- _event_handlers[id].push_back(&code);
+ _event_handlers[id].push_back(&code);
- // todo: drop the DisplayObject as a listener
- // if it gets no valid handlers for
- // mouse or Key events.
+ // todo: drop the DisplayObject as a listener
+ // if it gets no valid handlers for
+ // mouse or Key events.
}
std::auto_ptr<ExecutableCode>
DisplayObject::get_event_handler(const event_id& id) const
{
- std::auto_ptr<ExecutableCode> handler;
+ std::auto_ptr<ExecutableCode> handler;
- Events::const_iterator it = _event_handlers.find(id);
- if ( it == _event_handlers.end() ) return handler;
+ Events::const_iterator it = _event_handlers.find(id);
+ if ( it == _event_handlers.end() ) return handler;
#ifndef GNASH_USE_GC
- assert(get_ref_count() > 0);
+ assert(get_ref_count() > 0);
#endif // GNASH_USE_GC
- DisplayObject* this_ptr = const_cast<DisplayObject*>(this);
+ DisplayObject* this_ptr = const_cast<DisplayObject*>(this);
- handler.reset( new EventCode(this_ptr, it->second) );
- return handler;
+ handler.reset( new EventCode(this_ptr, it->second) );
+ return handler;
}
bool
@@ -460,46 +460,46 @@ DisplayObject::unload()
const bool childHandler = unloadChildren();
- if (!_unloaded) {
- queueEvent(event_id::UNLOAD, movie_root::PRIORITY_DOACTION);
- }
+ if (!_unloaded) {
+ queueEvent(event_id::UNLOAD, movie_root::PRIORITY_DOACTION);
+ }
// Unregister this DisplayObject as mask and/or maskee.
if (_maskee) _maskee->setMask(0);
if (_mask) _mask->setMaskee(0);
- const bool hasEvent = hasEventHandler(event_id::UNLOAD) || childHandler;
+ const bool hasEvent = hasEventHandler(event_id::UNLOAD) || childHandler;
if (!hasEvent) {
stage().removeQueuedConstructor(this);
}
- _unloaded = true;
+ _unloaded = true;
- return hasEvent;
+ return hasEvent;
}
void
DisplayObject::queueEvent(const event_id& id, int lvl)
{
if (!_object) return;
- std::auto_ptr<ExecutableCode> event(new QueuedEvent(this, id));
- stage().pushAction(event, lvl);
+ std::auto_ptr<ExecutableCode> event(new QueuedEvent(this, id));
+ stage().pushAction(event, lvl);
}
bool
DisplayObject::hasEventHandler(const event_id& id) const
{
- Events::const_iterator it = _event_handlers.find(id);
- if (it != _event_handlers.end()) return true;
+ Events::const_iterator it = _event_handlers.find(id);
+ if (it != _event_handlers.end()) return true;
if (!_object) return false;
// Don't check resolve!
- if (Property* prop = _object->findProperty(id.functionURI())) {
- return prop->getValue(*_object).to_function();
- }
- return false;
+ if (Property* prop = _object->findProperty(id.functionURI())) {
+ return prop->getValue(*_object).to_function();
+ }
+ return false;
}
@@ -526,13 +526,13 @@ DisplayObject::set_x_scale(double scale_percent)
// we don't need to recompute the SWFMatrix from the
// caches.
- SWFMatrix m = getMatrix(*this);
+ SWFMatrix m = getMatrix(*this);
m.set_x_scale(xscale);
setMatrix(m); // we updated the cache ourselves
- transformedByScript();
+ transformedByScript();
}
/// Set the real and cached rotation.
@@ -541,16 +541,16 @@ DisplayObject::set_x_scale(double scale_percent)
void
DisplayObject::set_rotation(double rot)
{
- // Translate to the -180 .. 180 range
- rot = std::fmod(rot, 360.0);
- if (rot > 180.0) rot -= 360.0;
- else if (rot < -180.0) rot += 360.0;
+ // Translate to the -180 .. 180 range
+ rot = std::fmod(rot, 360.0);
+ if (rot > 180.0) rot -= 360.0;
+ else if (rot < -180.0) rot += 360.0;
- double rotation = rot * PI / 180.0;
+ double rotation = rot * PI / 180.0;
if (_xscale < 0) rotation += PI;
- SWFMatrix m = getMatrix(*this);
+ SWFMatrix m = getMatrix(*this);
m.set_rotation(rotation);
// Update the matrix from the cached x scale to avoid accumulating
@@ -558,11 +558,11 @@ DisplayObject::set_rotation(double rot)
// TODO: also update y scale? The x scale update is needed to keep
// TextField correct; no tests for y scale.
m.set_x_scale(std::abs(scaleX() / 100.0));
- setMatrix(m); // we update the cache ourselves
+ setMatrix(m); // we update the cache ourselves
- _rotation = rot;
+ _rotation = rot;
- transformedByScript();
+ transformedByScript();
}
@@ -580,67 +580,67 @@ DisplayObject::set_y_scale(double scale_percent)
else yscale = std::abs(yscale);
}
- _yscale = scale_percent;
+ _yscale = scale_percent;
- SWFMatrix m = getMatrix(*this);
+ SWFMatrix m = getMatrix(*this);
m.set_y_scale(yscale);
- setMatrix(m); // we updated the cache ourselves
+ setMatrix(m); // we updated the cache ourselves
- transformedByScript();
+ transformedByScript();
}
std::string
DisplayObject::getTargetPath() const
{
- // TODO: check what happens when this DisplayObject
- // is a Movie loaded into another
- // running movie.
-
- typedef std::vector<std::string> Path;
- Path path;
+ // TODO: check what happens when this DisplayObject
+ // is a Movie loaded into another
+ // running movie.
+
+ typedef std::vector<std::string> Path;
+ Path path;
- // Build parents stack
- const DisplayObject* topLevel = 0;
- const DisplayObject* ch = this;
+ // Build parents stack
+ const DisplayObject* topLevel = 0;
+ const DisplayObject* ch = this;
string_table& st = getStringTable(*getObject(this));
- for (;;)
- {
- const DisplayObject* parent = ch->parent();
-
- // Don't push the _root name on the stack
- if (!parent) {
- topLevel = ch;
- break;
- }
-
- path.push_back(ch->get_name().toString(st));
- ch = parent;
- }
-
- assert(topLevel);
-
- if (path.empty()) {
- if (&stage().getRootMovie() == this) return "/";
- std::stringstream ss;
- ss << "_level" << _depth-DisplayObject::staticDepthOffset;
- return ss.str();
- }
-
- // Build the target string from the parents stack
- std::string target;
- if (topLevel != &stage().getRootMovie()) {
- std::stringstream ss;
- ss << "_level" <<
+ for (;;)
+ {
+ const DisplayObject* parent = ch->parent();
+
+ // Don't push the _root name on the stack
+ if (!parent) {
+ topLevel = ch;
+ break;
+ }
+
+ path.push_back(ch->get_name().toString(st));
+ ch = parent;
+ }
+
+ assert(topLevel);
+
+ if (path.empty()) {
+ if (&stage().getRootMovie() == this) return "/";
+ std::stringstream ss;
+ ss << "_level" << _depth-DisplayObject::staticDepthOffset;
+ return ss.str();
+ }
+
+ // Build the target string from the parents stack
+ std::string target;
+ if (topLevel != &stage().getRootMovie()) {
+ std::stringstream ss;
+ ss << "_level" <<
topLevel->get_depth() - DisplayObject::staticDepthOffset;
- target = ss.str();
- }
- for (Path::reverse_iterator it=path.rbegin(), itEnd=path.rend();
- it != itEnd; ++it) {
- target += "/" + *it;
- }
- return target;
+ target = ss.str();
+ }
+ for (Path::reverse_iterator it=path.rbegin(), itEnd=path.rend();
+ it != itEnd; ++it) {
+ target += "/" + *it;
+ }
+ return target;
}
@@ -648,76 +648,76 @@ std::string
DisplayObject::getTarget() const
{
- // TODO: check what happens when this DisplayObject
- // is a Movie loaded into another
- // running movie.
-
- typedef std::vector<std::string> Path;
- Path path;
+ // TODO: check what happens when this DisplayObject
+ // is a Movie loaded into another
+ // running movie.
+
+ typedef std::vector<std::string> Path;
+ Path path;
- // Build parents stack
- const DisplayObject* ch = this;
+ // Build parents stack
+ const DisplayObject* ch = this;
string_table& st = stage().getVM().getStringTable();
- for (;;)
- {
- const DisplayObject* parent = ch->parent();
-
- // Don't push the _root name on the stack
- if (!parent) {
-
- std::stringstream ss;
- if (!dynamic_cast<const Movie*>(ch)) {
- // must be an as-referenceable
- // DisplayObject created using 'new'
- // like, new MovieClip, new Video, new
TextField...
- //log_debug("DisplayObject %p (%s) doesn't have
a parent and "
+ for (;;)
+ {
+ const DisplayObject* parent = ch->parent();
+
+ // Don't push the _root name on the stack
+ if (!parent) {
+
+ std::stringstream ss;
+ if (!dynamic_cast<const Movie*>(ch)) {
+ // must be an as-referenceable
+ // DisplayObject created using 'new'
+ // like, new MovieClip, new Video, new TextField...
+ //log_debug("DisplayObject %p (%s) doesn't have a parent and "
// "is not a Movie", ch, typeName(*ch));
- ss << "<no parent, depth" << ch->get_depth() <<
">";
- path.push_back(ss.str());
- }
- else {
- ss << "_level" <<
+ ss << "<no parent, depth" << ch->get_depth() << ">";
+ path.push_back(ss.str());
+ }
+ else {
+ ss << "_level" <<
ch->get_depth() - DisplayObject::staticDepthOffset;
- path.push_back(ss.str());
- }
- break;
- }
+ path.push_back(ss.str());
+ }
+ break;
+ }
- path.push_back(ch->get_name().toString(st));
- ch = parent;
- }
+ path.push_back(ch->get_name().toString(st));
+ ch = parent;
+ }
- assert (!path.empty());
+ assert (!path.empty());
- // Build the target string from the parents stack
- std::string target;
- for (Path::const_reverse_iterator it=path.rbegin(), itEnd=path.rend();
- it != itEnd; ++it) {
+ // Build the target string from the parents stack
+ std::string target;
+ for (Path::const_reverse_iterator it=path.rbegin(), itEnd=path.rend();
+ it != itEnd; ++it) {
- if (!target.empty()) target += ".";
- target += *it;
- }
+ if (!target.empty()) target += ".";
+ target += *it;
+ }
- return target;
+ return target;
}
void
DisplayObject::destroy()
{
- // in case we are destroyed without being unloaded first
- // see bug #21842
- _unloaded = true;
+ // in case we are destroyed without being unloaded first
+ // see bug #21842
+ _unloaded = true;
- /// we may destory a DisplayObject that's not unloaded.
- ///(we don't have chance to unload it in current model,
+ /// we may destory a DisplayObject that's not unloaded.
+ ///(we don't have chance to unload it in current model,
/// see new_child_in_unload_test.c)
- /// We don't destroy ourself twice, right ?
+ /// We don't destroy ourself twice, right ?
if (_object) _object->clearProperties();
- assert(!_destroyed);
- _destroyed = true;
+ assert(!_destroyed);
+ _destroyed = true;
}
void
@@ -725,9 +725,9 @@ DisplayObject::markReachableResources() const
{
markOwnResources();
if (_object) _object->setReachable();
- if (_parent) _parent->setReachable();
- if (_mask) _mask->setReachable();
- if (_maskee) _maskee->setReachable();
+ if (_parent) _parent->setReachable();
+ if (_mask) _mask->setReachable();
+ if (_maskee) _maskee->setReachable();
}
/// Whether to use a hand cursor when the mouse is over this DisplayObject
@@ -759,58 +759,58 @@ DisplayObject::allowHandCursor() const
void
DisplayObject::setMask(DisplayObject* mask)
{
- if ( _mask == mask ) return;
+ if ( _mask == mask ) return;
set_invalidated();
- // Backup this before setMaskee has a chance to change it..
- DisplayObject* prevMaskee = _maskee;
+ // Backup this before setMaskee has a chance to change it..
+ DisplayObject* prevMaskee = _maskee;
- // If we had a previous mask unregister with it
- if ( _mask && _mask != mask )
- {
- // the mask will call setMask(NULL)
- // on any previously registered maskee
- // so we make sure to set our _mask to
- // NULL before getting called again
- _mask->setMaskee(0);
- }
+ // If we had a previous mask unregister with it
+ if ( _mask && _mask != mask )
+ {
+ // the mask will call setMask(NULL)
+ // on any previously registered maskee
+ // so we make sure to set our _mask to
+ // NULL before getting called again
+ _mask->setMaskee(0);
+ }
- // if we had a maskee, notify it to stop using
- // us as a mask
- if (prevMaskee) prevMaskee->setMask(0);
+ // if we had a maskee, notify it to stop using
+ // us as a mask
+ if (prevMaskee) prevMaskee->setMask(0);
- // TODO: should we reset any original clip depth
- // specified by PlaceObject tag ?
- set_clip_depth(noClipDepthValue);
- _mask = mask;
- _maskee = 0;
+ // TODO: should we reset any original clip depth
+ // specified by PlaceObject tag ?
+ set_clip_depth(noClipDepthValue);
+ _mask = mask;
+ _maskee = 0;
- if (_mask) {
- /// Register as as masked by the mask
- _mask->setMaskee(this);
- }
+ if (_mask) {
+ /// Register as as masked by the mask
+ _mask->setMaskee(this);
+ }
}
void
DisplayObject::setMaskee(DisplayObject* maskee)
{
- if ( _maskee == maskee ) { return; }
+ if ( _maskee == maskee ) { return; }
- if (_maskee) {
- // We don't want the maskee to call setMaskee(null)
- // on us again
- _maskee->_mask = 0;
- }
+ if (_maskee) {
+ // We don't want the maskee to call setMaskee(null)
+ // on us again
+ _maskee->_mask = 0;
+ }
- _maskee = maskee;
+ _maskee = maskee;
- if (!maskee)
- {
- // TODO: should we reset any original clip depth
- // specified by PlaceObject tag ?
- set_clip_depth(noClipDepthValue);
- }
+ if (!maskee)
+ {
+ // TODO: should we reset any original clip depth
+ // specified by PlaceObject tag ?
+ set_clip_depth(noClipDepthValue);
+ }
}
@@ -827,14 +827,14 @@ DisplayObject::boundsInClippingArea(Renderer& renderer)
const
DisplayObject::InfoTree::iterator
DisplayObject::getMovieInfo(InfoTree& tr, InfoTree::iterator it)
{
- const std::string yes = _("yes");
- const std::string no = _("no");
+ const std::string yes = _("yes");
+ const std::string no = _("no");
- it = tr.append_child(it, std::make_pair(getTarget(), typeName(*this)));
+ it = tr.append_child(it, std::make_pair(getTarget(), typeName(*this)));
- std::ostringstream os;
- os << get_depth();
- tr.append_child(it, std::make_pair(_("Depth"), os.str()));
+ std::ostringstream os;
+ os << get_depth();
+ tr.append_child(it, std::make_pair(_("Depth"), os.str()));
/// Don't add if the DisplayObject has no ratio value
if (get_ratio() >= 0)
@@ -842,28 +842,28 @@ DisplayObject::getMovieInfo(InfoTree& tr,
InfoTree::iterator it)
os.str("");
os << get_ratio();
tr.append_child(it, std::make_pair(_("Ratio"), os.str()));
- }
+ }
/// Don't add if it's not a real clipping depth
const int cd = get_clip_depth();
if (cd != noClipDepthValue) {
- os.str("");
- if (_maskee) os << "Dynamic mask";
- else os << cd;
+ os.str("");
+ if (_maskee) os << "Dynamic mask";
+ else os << cd;
- tr.append_child(it, std::make_pair(_("Clipping depth"),
os.str()));
+ tr.append_child(it, std::make_pair(_("Clipping depth"), os.str()));
}
os.str("");
os << getBounds().width() << "x" << getBounds().height();
- tr.append_child(it, std::make_pair(_("Dimensions"), os.str()));
+ tr.append_child(it, std::make_pair(_("Dimensions"), os.str()));
- tr.append_child(it, std::make_pair(_("Dynamic"), isDynamic() ? yes :
no));
- tr.append_child(it, std::make_pair(_("Mask"), isMaskLayer() ? yes :
no));
- tr.append_child(it, std::make_pair(_("Destroyed"),
+ tr.append_child(it, std::make_pair(_("Dynamic"), isDynamic() ? yes : no));
+ tr.append_child(it, std::make_pair(_("Mask"), isMaskLayer() ? yes : no));
+ tr.append_child(it, std::make_pair(_("Destroyed"),
isDestroyed() ? yes : no));
- tr.append_child(it, std::make_pair(_("Unloaded"), unloaded() ? yes :
no));
-
+ tr.append_child(it, std::make_pair(_("Unloaded"), unloaded() ? yes : no));
+
os.str("");
os << _blendMode;
tr.append_child(it, std::make_pair(_("Blend mode"), os.str()));
@@ -874,7 +874,7 @@ DisplayObject::getMovieInfo(InfoTree& tr,
InfoTree::iterator it)
tr.append_child(it, std::make_pair(_("Child invalidated"),
_child_invalidated ? yes : no));
#endif
- return it;
+ return it;
}
#endif
@@ -1309,11 +1309,11 @@ setAlpha(DisplayObject& o, const as_value& val)
as_value
getMouseX(DisplayObject& o)
{
- // Local coord of mouse IN PIXELS.
- boost::int32_t x, y;
+ // Local coord of mouse IN PIXELS.
+ boost::int32_t x, y;
boost::tie(x, y) = getRoot(*getObject(&o)).mousePosition();
- SWFMatrix m = getWorldMatrix(o);
+ SWFMatrix m = getWorldMatrix(o);
point a(pixelsToTwips(x), pixelsToTwips(y));
m.invert().transform(a);
@@ -1323,11 +1323,11 @@ getMouseX(DisplayObject& o)
as_value
getMouseY(DisplayObject& o)
{
- // Local coord of mouse IN PIXELS.
- boost::int32_t x, y;
+ // Local coord of mouse IN PIXELS.
+ boost::int32_t x, y;
boost::tie(x, y) = getRoot(*getObject(&o)).mousePosition();
- SWFMatrix m = getWorldMatrix(o);
+ SWFMatrix m = getWorldMatrix(o);
point a(pixelsToTwips(x), pixelsToTwips(y));
m.invert().transform(a);
return as_value(twipsToPixels(a.y));
@@ -1403,7 +1403,7 @@ getSoundBufTime(DisplayObject& /*o*/)
as_value
getWidth(DisplayObject& o)
{
- SWFRect bounds = o.getBounds();
+ SWFRect bounds = o.getBounds();
const SWFMatrix& m = getMatrix(o);
m.transform(bounds);
return twipsToPixels(bounds.width());
http://git.savannah.gnu.org/cgit//commit/?id=05dec445e382f254f9ae2679f7d8bf3a5111e077
commit 05dec445e382f254f9ae2679f7d8bf3a5111e077
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 11:31:27 2010 +0100
Return a pair from mousePosition instead of using out parameters.
diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index 67f8b2e..abac428 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -24,10 +24,11 @@
#include "DisplayObject.h"
+#include <utility>
+#include <boost/tuple/tuple.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
-#include <utility>
#include "smart_ptr.h" // GNASH_USE_GC
#include "movie_root.h"
@@ -1310,7 +1311,7 @@ getMouseX(DisplayObject& o)
{
// Local coord of mouse IN PIXELS.
boost::int32_t x, y;
- getRoot(*getObject(&o)).get_mouse_state(x, y);
+ boost::tie(x, y) = getRoot(*getObject(&o)).mousePosition();
SWFMatrix m = getWorldMatrix(o);
point a(pixelsToTwips(x), pixelsToTwips(y));
@@ -1324,7 +1325,7 @@ getMouseY(DisplayObject& o)
{
// Local coord of mouse IN PIXELS.
boost::int32_t x, y;
- getRoot(*getObject(&o)).get_mouse_state(x, y);
+ boost::tie(x, y) = getRoot(*getObject(&o)).mousePosition();
SWFMatrix m = getWorldMatrix(o);
point a(pixelsToTwips(x), pixelsToTwips(y));
diff --git a/libcore/TextField.cpp b/libcore/TextField.cpp
index c2e1d04..ee40aa8 100644
--- a/libcore/TextField.cpp
+++ b/libcore/TextField.cpp
@@ -28,11 +28,22 @@
// change the mouse cursor to the hand cursor standard for linkable
// text
+#include "TextField.h"
+
+#include <algorithm>
+#include <string>
+#include <cstdlib>
+#include <cctype>
+#include <utility>
+#include <map>
+#include <boost/assign/list_of.hpp>
+#include <boost/bind.hpp>
+#include <boost/tuple/tuple.hpp>
+
#include "utf8.h"
#include "log.h"
#include "swf/DefineEditTextTag.h"
#include "MovieClip.h"
-#include "TextField.h"
#include "movie_root.h" // for killing focus
#include "as_environment.h"
#include "Font.h"
@@ -50,15 +61,6 @@
#include "Transform.h"
#include "ObjectURI.h"
-#include <algorithm>
-#include <string>
-#include <boost/assign/list_of.hpp>
-#include <boost/bind.hpp>
-#include <cstdlib>
-#include <cctype>
-#include <utility>
-#include <map>
-
// Text fields have a fixed 2 pixel padding for each side (regardless of
border)
#define PADDING_TWIPS 40
@@ -530,7 +532,7 @@ TextField::notifyEvent(const event_id& ev)
{
movie_root& root = stage();
boost::int32_t x_mouse, y_mouse;
- root.get_mouse_state(x_mouse, y_mouse);
+ boost::tie(x_mouse, y_mouse) = root.mousePosition();
SWFMatrix m = getMatrix(*this);
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index b58e179..7255ae6 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -692,15 +692,11 @@ movie_root::fire_mouse_event()
}
-void
-movie_root::get_mouse_state(boost::int32_t& x, boost::int32_t& y)
+std::pair<boost::int32_t, boost::int32_t>
+movie_root::mousePosition() const
{
assert(testInvariant());
-
- x = _mouseX;
- y = _mouseY;
-
- assert(testInvariant());
+ return std::make_pair(_mouseX, _mouseY);
}
void
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 510ce76..0273e24 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -295,7 +295,7 @@ public:
/// Use this to retrieve the last state of the mouse.
//
/// Coordinates are in PIXELS, NOT TWIPS.
- void get_mouse_state(boost::int32_t& x, boost::int32_t& y);
+ std::pair<boost::int32_t, boost::int32_t> mousePosition() const;
void setDragState(const DragState& st);
http://git.savannah.gnu.org/cgit//commit/?id=f14405b50b2bdabd602143628db52bf98f30b2a6
commit f14405b50b2bdabd602143628db52bf98f30b2a6
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 09:52:17 2010 +0100
Cleanup, drop unneeded helper functions.
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index cb50971..b58e179 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -94,14 +94,6 @@ namespace {
const DisplayObject* getNearestObject(const DisplayObject* o);
as_object* getBuiltinObject(movie_root& mr, const ObjectURI& cl);
void advanceLiveChar(MovieClip* ch);
-
- /// Push a DisplayObject listener to the front of given container, if not
- /// already present
- void add_listener(movie_root::Listeners& ll, Button* elem);
-
- /// Remove a listener from the list
- void remove_listener(movie_root::Listeners& ll, Button* elem);
-
}
// Utility classes
@@ -281,8 +273,7 @@ movie_root::setLevel(unsigned int num, Movie* movie)
// don't leak overloaded levels
MovieClip* lm = it->second;
- if (lm == _rootMovie)
- {
+ if (lm == _rootMovie) {
// NOTE: this is not enough to trigger
// an application reset. Was tested
// but not automated. If curious
@@ -344,8 +335,7 @@ movie_root::swapLevels(MovieClip* movie, int depth)
#ifdef GNASH_DEBUG_LEVELS_SWAPPING
log_debug("Before swapLevels (source depth %d, target depth %d) "
"levels are: ", oldDepth, depth);
- for (Levels::const_iterator i=_movies.begin(), e=_movies.end(); i!=e; ++i)
- {
+ for (Levels::const_iterator i=_movies.begin(), e=_movies.end(); i!=e; ++i)
{
log_debug(" %d: %p (%s @ depth %d)", i->first,
(void*)(i->second), i->second->getTarget(),
i->second->get_depth());
@@ -396,8 +386,7 @@ movie_root::swapLevels(MovieClip* movie, int depth)
#ifdef GNASH_DEBUG_LEVELS_SWAPPING
log_debug("After swapLevels levels are: ");
- for (Levels::const_iterator i=_movies.begin(), e=_movies.end(); i!=e; ++i)
- {
+ for (Levels::const_iterator i=_movies.begin(), e=_movies.end(); i!=e; ++i)
{
log_debug(" %d: %p (%s @ depth %d)", i->first,
(void*)(i->second), i->second->getTarget(),
i->second->get_depth());
@@ -496,7 +485,7 @@ movie_root::reset()
// remove all loadMovie requests
_movieLoader.clear();
- // remove key/mouse listeners
+ // remove key listeners
_keyListeners.clear();
// Cleanup the stack.
@@ -586,8 +575,7 @@ movie_root::keyEvent(key::code k, bool down)
callMethod(key, getURI(_vm,NSV::PROP_BROADCAST_MESSAGE),
"onKeyUp");
}
}
- catch (ActionLimitException &e)
- {
+ catch (const ActionLimitException &e) {
log_error(_("ActionLimits hit notifying key listeners: %s."),
e.what());
clear(_actionQueue);
@@ -707,7 +695,6 @@ movie_root::fire_mouse_event()
void
movie_root::get_mouse_state(boost::int32_t& x, boost::int32_t& y)
{
-
assert(testInvariant());
x = _mouseX;
@@ -1481,8 +1468,8 @@ movie_root::executeAdvanceCallbacks()
// application. If it is set, we have to check the socket connection
// for XML messages.
if (_controlfd) {
- boost::shared_ptr<ExternalInterface::invoke_t> invoke =
- ExternalInterface::ExternalEventCheck(_controlfd);
+ boost::shared_ptr<ExternalInterface::invoke_t> invoke =
+ ExternalInterface::ExternalEventCheck(_controlfd);
if (invoke) {
if (processInvoke(invoke.get()) == false) {
if (!invoke->name.empty()) {
@@ -1490,7 +1477,7 @@ movie_root::executeAdvanceCallbacks()
invoke->name);
}
}
- }
+ }
}
processActionQueue();
@@ -1520,7 +1507,7 @@ movie_root::processInvoke(ExternalInterface::invoke_t
*invoke)
std::string var = invoke->args[0].to_string();
as_value &val = invoke->args[1] ;
obj->set_member(getURI(vm, var), val);
- // SetVariable doesn't send a response
+ // SetVariable doesn't send a response
} else if (invoke->name == "GetVariable") {
MovieClip *mc = getLevel(0);
as_object *obj = getObject(mc);
@@ -1528,18 +1515,18 @@ movie_root::processInvoke(ExternalInterface::invoke_t
*invoke)
std::string var = invoke->args[0].to_string();
as_value val;
obj->get_member(getURI(vm, var), &val);
- // GetVariable sends the value of the variable
- ss << ExternalInterface::toXML(val);
+ // GetVariable sends the value of the variable
+ ss << ExternalInterface::toXML(val);
} else if (invoke->name == "GotoFrame") {
log_unimpl("ExternalInterface::GotoFrame()");
- // GotoFrame doesn't send a response
+ // GotoFrame doesn't send a response
} else if (invoke->name == "IsPlaying") {
std::string result = callInterface("ExternalInterface.IsPlaying");
as_value val((result == "true") ? true : false);
- ss << ExternalInterface::toXML(val);
+ ss << ExternalInterface::toXML(val);
} else if (invoke->name == "LoadMovie") {
log_unimpl("ExternalInterface::LoadMovie()");
- // LoadMovie doesn't send a response
+ // LoadMovie doesn't send a response
} else if (invoke->name == "Pan") {
std::string arg = invoke->args[0].to_string();
arg += ":";
@@ -1549,20 +1536,20 @@ movie_root::processInvoke(ExternalInterface::invoke_t
*invoke)
arg += ":";
arg += invoke->args[2].to_string();
callInterface("ExternalInterface.Pan", arg);
- // Pan doesn't send a response
+ // Pan doesn't send a response
} else if (invoke->name == "PercentLoaded") {
MovieClip *mc = getLevel(0);
int loaded = mc->get_bytes_loaded();
int total = mc->get_bytes_total();
as_value val((loaded/total) * 100);
// PercentLoaded sends the percentage
- ss << ExternalInterface::toXML(val);
+ ss << ExternalInterface::toXML(val);
} else if (invoke->name == "Play") {
callInterface("ExternalInterface.Play");
- // Play doesn't send a response
+ // Play doesn't send a response
} else if (invoke->name == "Rewind") {
callInterface("ExternalInterface.Rewind");
- // Rewind doesn't send a response
+ // Rewind doesn't send a response
} else if (invoke->name == "SetZoomRect") {
std::string arg = invoke->args[0].to_string();
arg += ":";
@@ -1574,18 +1561,18 @@ movie_root::processInvoke(ExternalInterface::invoke_t
*invoke)
arg += ":";
arg += invoke->args[3].to_string();
callInterface("ExternalInterface.SetZoomRect", arg);
- // SetZoomRect doesn't send a response
+ // SetZoomRect doesn't send a response
} else if (invoke->name == "StopPlay") {
callInterface("ExternalInterface.StopPlay");
- // StopPlay doesn't send a response
+ // StopPlay doesn't send a response
} else if (invoke->name == "Zoom") {
std::string var = invoke->args[0].to_string();
callInterface("ExternalInterface.Zoom", var);
- // Zoom doesn't send a response
+ // Zoom doesn't send a response
} else if (invoke->name == "TotalFrames") {
MovieClip *mc = getLevel(0);
as_value val(mc->get_loaded_frames());
- // TotalFrames sends the number of frames in the movie
+ // TotalFrames sends the number of frames in the movie
ss << ExternalInterface::toXML(val);
} else {
std::string result = callExternalCallback(invoke->name, invoke->args);
@@ -1820,7 +1807,7 @@ movie_root::callExternalJavascript(const std::string
&name,
// Javascript in the browser.
std::string
movie_root::callExternalCallback(const std::string &name,
- const std::vector<as_value> &fnargs)
+ const std::vector<as_value> &fnargs)
{
// GNASH_REPORT_FUNCTION;
@@ -1871,16 +1858,20 @@ movie_root::callExternalCallback(const std::string
&name,
}
void
-movie_root::add_key_listener(Button* listener)
+movie_root::remove_key_listener(Button* listener)
{
- add_listener(_keyListeners, listener);
+ _keyListeners.remove_if(std::bind2nd(std::equal_to<Button*>(), listener));
}
-/// Remove a DisplayObject listener for key events
void
-movie_root::remove_key_listener(Button* listener)
+movie_root::add_key_listener(Button* listener)
{
- remove_listener(_keyListeners, listener);
+ assert(listener);
+
+ if (std::find(_keyListeners.begin(), _keyListeners.end(), listener)
+ != _keyListeners.end()) return;
+
+ _keyListeners.push_front(listener);
}
void
@@ -1933,8 +1924,8 @@ movie_root::cleanupDisplayList()
needScan=false;
// Remove unloaded MovieClips from the _liveChars list
- for (LiveChars::iterator i=_liveChars.begin(), e=_liveChars.end();
i!=e;)
- {
+ for (LiveChars::iterator i = _liveChars.begin(), e = _liveChars.end();
+ i != e;) {
MovieClip* ch = *i;
if (ch->unloaded()) {
// the sprite might have been destroyed already
@@ -1975,8 +1966,7 @@ movie_root::cleanupDisplayList()
} while (needScan);
#ifdef GNASH_DEBUG_INSTANCE_LIST
- if ( _liveChars.size() > maxLiveChars )
- {
+ if (_liveChars.size() > maxLiveChars) {
maxLiveChars = _liveChars.size();
log_debug("Global instance list grew to %d entries", maxLiveChars);
}
@@ -2037,8 +2027,7 @@ movie_root::findCharacterByTarget(const std::string&
tgtstr) const
assert(o);
std::string::size_type from = 0;
- while (std::string::size_type to = tgtstr.find('.', from))
- {
+ while (std::string::size_type to = tgtstr.find('.', from)) {
std::string part(tgtstr, from, to - from);
// TODO: there is surely a cleaner way to implement path finding.
@@ -2087,8 +2076,8 @@ movie_root::getURL(const std::string& urlstr, const
std::string& target,
boost::replace_all(command, "%u", safeurl);
log_debug (_("Launching URL: %s"), command);
- int ret = std::system(command.c_str());
- if ( -1 == ret ) {
+ const int ret = std::system(command.c_str());
+ if (ret == -1) {
log_error(_("Fork failed launching url opener '%s'"), command);
}
return;
@@ -2116,7 +2105,7 @@ movie_root::getURL(const std::string& urlstr, const
std::string& target,
// The third argument is the target, which is something like _blank
// or _self.
if (!target.empty()) {
- fnargs.push_back(as_value(target));
+ fnargs.push_back(as_value(target));
}
// Add any data as the optional 4th argument
if (!data.empty()) {
@@ -2134,10 +2123,10 @@ movie_root::getURL(const std::string& urlstr, const
std::string& target,
std::string msg = ExternalInterface::makeInvoke("getURL", fnargs);
- size_t ret = ExternalInterface::writeBrowser(_hostfd, msg);
+ const size_t ret = ExternalInterface::writeBrowser(_hostfd, msg);
if (ret < msg.size()) {
log_error(_("Could only write %d bytes to fd #%d"),
- ret, _hostfd);
+ ret, _hostfd);
}
}
@@ -2457,8 +2446,7 @@ generate_mouse_button_events(movie_root& mr,
MouseButtonState& ms)
else {
// New active entity is whatever is below the mouse right now.
- if (ms.topmostEntity != ms.activeEntity)
- {
+ if (ms.topmostEntity != ms.activeEntity) {
// onRollOut
if (ms.activeEntity) {
ms.activeEntity->mouseEvent(event_id::ROLL_OUT);
@@ -2536,26 +2524,6 @@ advanceLiveChar(MovieClip* mo)
#endif
}
-void
-add_listener(movie_root::Listeners& ll, Button* listener)
-{
- assert(listener);
-
- // Don't add the same listener twice (why not use a set?)
- if (std::find(ll.begin(), ll.end(), listener) != ll.end()) return;
-
- ll.push_front(listener);
-}
-
-
-void
-remove_listener(movie_root::Listeners& ll, Button* listener)
-{
- assert(listener);
- ll.remove_if(std::bind2nd(std::equal_to<Button*>(), listener));
-}
-
-
} // anonymous namespace
} // namespace gnash
http://git.savannah.gnu.org/cgit//commit/?id=ae8f86b3f845d0a30a30034b966efc3b067bff2a
commit ae8f86b3f845d0a30a30034b966efc3b067bff2a
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 09:40:51 2010 +0100
Use shared_ptr for the timers to avoid potential bugs when
iterators are invalidated during action execution.
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 4fee1b6..cb50971 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -20,8 +20,6 @@
#include "movie_root.h"
-#include <boost/algorithm/string/erase.hpp>
-#include <boost/algorithm/string/replace.hpp>
#include <utility>
#include <string>
#include <sstream>
@@ -29,13 +27,17 @@
#include <bitset>
#include <cassert>
#include <functional>
+#include <boost/algorithm/string/erase.hpp>
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
+#include <boost/ptr_container/ptr_deque.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/bind.hpp>
#include "GnashSystemIOHeaders.h" // write()
#include "log.h"
#include "MovieClip.h"
-#include "Movie.h" // for implicit upcast to MovieClip
+#include "Movie.h"
#include "VM.h"
#include "ExecutableCode.h"
#include "URL.h"
@@ -180,13 +182,6 @@ movie_root::disableScripts()
// of the queue.
}
-
-size_t
-movie_root::nextUnnamedInstance()
-{
- return ++_unnamedInstance;
-}
-
movie_root::~movie_root()
{
clear(_actionQueue);
@@ -222,8 +217,7 @@ movie_root::setRootMovie(Movie* movie)
// assert(movie->get_depth() == 0); ?
movie->set_depth(DisplayObject::staticDepthOffset);
- try
- {
+ try {
setLevel(0, movie);
// actions in first frame of _level0 must execute now,
@@ -231,14 +225,12 @@ movie_root::setRootMovie(Movie* movie)
// or they'll be executed with _currentframe being set to 2
processActionQueue();
}
- catch (ActionLimitException& al)
- {
+ catch (const ActionLimitException& al) {
boost::format fmt = boost::format(_("ActionLimits hit during "
"setRootMovie: %s. Disable scripts?")) % al.what();
handleActionLimitHit(fmt.str());
}
- catch (ActionParserException& e)
- {
+ catch (const ActionParserException& e) {
log_error("ActionParserException thrown during setRootMovie: %s",
e.what());
}
@@ -251,11 +243,12 @@ void
movie_root::handleActionLimitHit(const std::string& msg)
{
bool disable = true;
- if ( _interfaceHandler ) disable = _interfaceHandler->yesNo(msg);
- else log_error("No user interface registered, assuming 'Yes' answer to "
+ if (_interfaceHandler) disable = _interfaceHandler->yesNo(msg);
+ else {
+ log_error("No user interface registered, assuming 'Yes' answer to "
"question: %s", msg);
- if ( disable )
- {
+ }
+ if (disable) {
disableScripts();
clear(_actionQueue);
}
@@ -281,12 +274,10 @@ movie_root::setLevel(unsigned int num, Movie* movie)
Levels::iterator it = _movies.find(movie->get_depth());
- if ( it == _movies.end() )
- {
+ if (it == _movies.end()) {
_movies[movie->get_depth()] = movie;
}
- else
- {
+ else {
// don't leak overloaded levels
MovieClip* lm = it->second;
@@ -799,10 +790,13 @@ movie_root::addIntervalTimer(std::auto_ptr<Timer> timer)
assert(timer.get());
assert(testInvariant());
- size_t id = ++_lastTimerId;
+ const size_t id = ++_lastTimerId;
assert(_intervalTimers.find(id) == _intervalTimers.end());
- _intervalTimers.insert(id, timer);
+
+ boost::shared_ptr<Timer> t(timer);
+ _intervalTimers.insert(std::make_pair(id, t));
+
return id;
}
@@ -1374,8 +1368,7 @@ movie_root::processActionQueue(size_t lvl)
void
movie_root::flushHigherPriorityActionQueues()
{
- if( ! processingActions() )
- {
+ if (!processingActions()) {
// only flush the actions queue when we are
// processing the queue.
// ie. we don't want to flush the queue
@@ -1384,16 +1377,14 @@ movie_root::flushHigherPriorityActionQueues()
return;
}
- if ( _disableScripts )
- {
+ if (_disableScripts) {
/// cleanup anything pushed later..
clear(_actionQueue);
return;
}
int lvl=minPopulatedPriorityQueue();
- while ( lvl<_processingActionLevel )
- {
+ while (lvl < _processingActionLevel) {
lvl = processActionQueue(lvl);
}
@@ -1632,10 +1623,8 @@ movie_root::executeTimers()
unsigned long now = _vm.getTime();
- // This does not own its Timers and is strictly temporary; the
- // original _intervalTimers map must keep all references Timers
- // alive until the end of this function.
- typedef std::multimap<unsigned int, Timer*> ExpiredTimers;
+ typedef std::multimap<unsigned int, boost::shared_ptr<Timer> >
+ ExpiredTimers;
ExpiredTimers expiredTimers;
@@ -1645,7 +1634,7 @@ movie_root::executeTimers()
TimerMap::iterator nextIterator = it;
++nextIterator;
- Timer* timer = it->second;
+ boost::shared_ptr<Timer> timer(it->second);
if (timer->cleared()) {
// this timer was cleared, erase it
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 478f41c..510ce76 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -76,7 +76,6 @@
#include <bitset>
#include <boost/array.hpp>
#include <boost/ptr_container/ptr_deque.hpp>
-#include <boost/ptr_container/ptr_map.hpp>
#include <boost/noncopyable.hpp>
#include "smart_ptr.h" // GNASH_USE_GC
@@ -124,9 +123,7 @@ namespace gnash {
struct DepthComparator
{
typedef MovieClip* LevelMovie;
-
- bool operator()(const LevelMovie& d1, const LevelMovie& d2) const
- {
+ bool operator()(const LevelMovie& d1, const LevelMovie& d2) const {
return d1->get_depth() < d2->get_depth();
}
};
@@ -430,7 +427,9 @@ public:
}
/// Get a unique number for unnamed instances.
- size_t nextUnnamedInstance();
+ size_t nextUnnamedInstance() {
+ return ++_unnamedInstance;
+ }
/// Push a new DisplayObject listener for key events
void add_key_listener(Button* listener);
@@ -1051,7 +1050,7 @@ private:
LoadCallbacks _loadCallbacks;
- typedef boost::ptr_map<boost::uint32_t, Timer> TimerMap;
+ typedef std::map<boost::uint32_t, boost::shared_ptr<Timer> > TimerMap;
TimerMap _intervalTimers;
http://git.savannah.gnu.org/cgit//commit/?id=8098779b102bf2d2681493b6f2532cdeef7b45d8
commit 8098779b102bf2d2681493b6f2532cdeef7b45d8
Merge: aca7550 5b7c0de
Author: Benjamin Wolsey <address@hidden>
Date: Fri Dec 3 09:14:57 2010 +0100
Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash
http://git.savannah.gnu.org/cgit//commit/?id=aca7550eaadf01f4736ec1c6a1058f9740f9ff32
commit aca7550eaadf01f4736ec1c6a1058f9740f9ff32
Author: Benjamin Wolsey <address@hidden>
Date: Thu Dec 2 20:31:55 2010 +0100
Use ptr_containers, be a bit stricter with timer id types.
diff --git a/libcore/asobj/Global_as.cpp b/libcore/asobj/Global_as.cpp
index 2a6a30c..e27b38d 100644
--- a/libcore/asobj/Global_as.cpp
+++ b/libcore/asobj/Global_as.cpp
@@ -1040,7 +1040,9 @@ global_setInterval(const fn_call& fn)
}
movie_root& root = getRoot(fn);
- int id = root.add_interval_timer(timer);
+
+ // TODO: check what should happen to overflows.
+ const int id = root.addIntervalTimer(timer);
return as_value(id);
}
@@ -1110,7 +1112,8 @@ global_setTimeout(const fn_call& fn)
movie_root& root = getRoot(fn);
- int id = root.add_interval_timer(timer);
+ // TODO: check what should happen to overflows.
+ const int id = root.addIntervalTimer(timer);
return as_value(id);
}
@@ -1124,11 +1127,10 @@ global_clearInterval(const fn_call& fn)
return as_value();
}
- int id = int(toNumber(fn.arg(0), getVM(fn)));
+ const boost::uint32_t id = toInt(fn.arg(0), getVM(fn));
movie_root& root = getRoot(fn);
- bool ret = root.clear_interval_timer(id);
- return as_value(ret);
+ return as_value(root.clearIntervalTimer(id));
}
as_value
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index d5775ca..4fee1b6 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -117,6 +117,13 @@ private:
DisplayObject* _target;
};
+void
+clear(movie_root::ActionQueue& aq)
+{
+ std::for_each(aq.begin(), aq.end(),
+ boost::mem_fn(&movie_root::ActionQueue::value_type::clear));
+}
+
} // anonymous namespace
@@ -180,26 +187,10 @@ movie_root::nextUnnamedInstance()
return ++_unnamedInstance;
}
-void
-movie_root::clearActionQueue()
-{
- for (size_t lvl = 0; lvl < _actionQueue.size(); ++lvl) {
- ActionQueue& q = _actionQueue[lvl];
- q.clear();
- }
-}
-
-void
-movie_root::clearIntervalTimers()
-{
- deleteSecondElements(_intervalTimers.begin(), _intervalTimers.end());
- _intervalTimers.clear();
-}
-
movie_root::~movie_root()
{
- clearActionQueue();
- clearIntervalTimers();
+ clear(_actionQueue);
+ _intervalTimers.clear();
_movieLoader.clear();
assert(testInvariant());
@@ -266,7 +257,7 @@ movie_root::handleActionLimitHit(const std::string& msg)
if ( disable )
{
disableScripts();
- clearActionQueue();
+ clear(_actionQueue);
}
}
@@ -310,15 +301,14 @@ movie_root::setLevel(unsigned int num, Movie* movie)
log_debug("Replacing starting movie");
}
- if ( num == 0 )
- {
+ if (num == 0) {
+
log_debug("Loading into _level0");
// NOTE: this was tested but not automated, the
// test sets an interval and then loads something
// in _level0. The result is the interval is disabled.
- clearIntervalTimers();
-
+ _intervalTimers.clear();
// TODO: check what else we should do in these cases
// (like, unregistering all childs etc...)
@@ -504,13 +494,13 @@ movie_root::reset()
_liveChars.clear();
// wipe out queued actions
- clearActionQueue();
+ clear(_actionQueue);
// wipe out all levels
_movies.clear();
// remove all intervals
- clearIntervalTimers();
+ _intervalTimers.clear();
// remove all loadMovie requests
_movieLoader.clear();
@@ -609,7 +599,7 @@ movie_root::keyEvent(key::code k, bool down)
{
log_error(_("ActionLimits hit notifying key listeners: %s."),
e.what());
- clearActionQueue();
+ clear(_actionQueue);
}
}
@@ -803,24 +793,24 @@ movie_root::doMouseDrag()
dragChar->setMatrix(local);
}
-unsigned int
-movie_root::add_interval_timer(std::auto_ptr<Timer> timer)
+boost::uint32_t
+movie_root::addIntervalTimer(std::auto_ptr<Timer> timer)
{
assert(timer.get());
assert(testInvariant());
- int id = ++_lastTimerId;
+ size_t id = ++_lastTimerId;
assert(_intervalTimers.find(id) == _intervalTimers.end());
- _intervalTimers[id] = timer.release();
+ _intervalTimers.insert(id, timer);
return id;
}
bool
-movie_root::clear_interval_timer(unsigned int x)
+movie_root::clearIntervalTimer(boost::uint32_t x)
{
TimerMap::iterator it = _intervalTimers.find(x);
- if ( it == _intervalTimers.end() ) return false;
+ if (it == _intervalTimers.end()) return false;
// We do not remove the element here because
// we might have been called during execution
@@ -883,11 +873,11 @@ movie_root::advance()
// The PP does not disable scripts when the stack limit is reached,
// but rather struggles on.
log_error(_("Action limit hit during advance: %s"), al.what());
- clearActionQueue();
+ clear(_actionQueue);
}
catch (const ActionParserException& e) {
log_error(_("Buffer overread during advance: %s"), e.what());
- clearActionQueue();
+ clear(_actionQueue);
}
return advanced;
@@ -1009,7 +999,7 @@ movie_root::notify_mouse_listeners(const event_id& event)
catch (ActionLimitException &e) {
log_error(_("ActionLimits hit notifying mouse events: %s."),
e.what());
- clearActionQueue();
+ clear(_actionQueue);
}
}
@@ -1336,7 +1326,7 @@ movie_root::minPopulatedPriorityQueue() const
size_t
movie_root::processActionQueue(size_t lvl)
{
- ActionQueue& q = _actionQueue[lvl];
+ ActionQueue::value_type& q = _actionQueue[lvl];
assert(minPopulatedPriorityQueue() == lvl);
@@ -1397,7 +1387,7 @@ movie_root::flushHigherPriorityActionQueues()
if ( _disableScripts )
{
/// cleanup anything pushed later..
- clearActionQueue();
+ clear(_actionQueue);
return;
}
@@ -1433,7 +1423,7 @@ movie_root::processActionQueue()
{
if (_disableScripts) {
/// cleanup anything pushed later..
- clearActionQueue();
+ clear(_actionQueue);
return;
}
@@ -1451,7 +1441,7 @@ movie_root::processActionQueue()
void
movie_root::removeQueuedConstructor(DisplayObject* target)
{
- ActionQueue& pr = _actionQueue[PRIORITY_CONSTRUCT];
+ ActionQueue::value_type& pr = _actionQueue[PRIORITY_CONSTRUCT];
pr.erase_if(RemoveTargetCode(target));
}
@@ -1642,11 +1632,15 @@ movie_root::executeTimers()
unsigned long now = _vm.getTime();
+ // This does not own its Timers and is strictly temporary; the
+ // original _intervalTimers map must keep all references Timers
+ // alive until the end of this function.
typedef std::multimap<unsigned int, Timer*> ExpiredTimers;
+
ExpiredTimers expiredTimers;
- for (TimerMap::iterator it=_intervalTimers.begin(),
- itEnd=_intervalTimers.end(); it != itEnd; ) {
+ for (TimerMap::iterator it = _intervalTimers.begin(),
+ itEnd = _intervalTimers.end(); it != itEnd; ) {
TimerMap::iterator nextIterator = it;
++nextIterator;
@@ -1655,7 +1649,6 @@ movie_root::executeTimers()
if (timer->cleared()) {
// this timer was cleared, erase it
- delete timer;
_intervalTimers.erase(it);
}
else {
@@ -1706,7 +1699,7 @@ movie_root::markReachableResources() const
// Mark resources reachable by queued action code
for (size_t lvl = 0; lvl < PRIORITY_SIZE; ++lvl)
{
- const ActionQueue& q = _actionQueue[lvl];
+ const ActionQueue::value_type& q = _actionQueue[lvl];
std::for_each(q.begin(), q.end(),
std::mem_fun_ref(&ExecutableCode::markReachableResources));
}
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index dd31703..478f41c 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -76,6 +76,7 @@
#include <bitset>
#include <boost/array.hpp>
#include <boost/ptr_container/ptr_deque.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
#include <boost/noncopyable.hpp>
#include "smart_ptr.h" // GNASH_USE_GC
@@ -107,7 +108,7 @@
// Forward declarations
namespace gnash {
- class ExecutableCode; // for ActionQueue
+ class ExecutableCode;
class URL;
class Timer;
class MovieClip;
@@ -337,8 +338,7 @@ public:
/// @return An integer indentifying the timer
/// for subsequent call to clear_interval_timer.
/// It will NEVER be zero.
- ///
- unsigned int add_interval_timer(std::auto_ptr<Timer> timer);
+ boost::uint32_t addIntervalTimer(std::auto_ptr<Timer> timer);
/// Register an object for loading data to.
//
@@ -365,16 +365,14 @@ public:
/// Remove timer identified by given integer
//
/// @return true on success, false on error (no such timer)
- ///
- bool clear_interval_timer(unsigned int x);
+ bool clearIntervalTimer(boost::uint32_t x);
/// Return 0-based frame index of originating root movie
//
/// TODO: drop this function (currently used by gprocessor)
/// or change it to to delegate to _level0 ?
///
- size_t get_current_frame() const
- {
+ size_t get_current_frame() const {
return _rootMovie->get_current_frame();
}
@@ -417,8 +415,7 @@ public:
/// 0-based!! delegates to originating root movie
//
/// TODO: drop this method. currently used by gprocessor.
- void goto_frame(size_t target_frame_number)
- {
+ void goto_frame(size_t target_frame_number) {
_rootMovie->goto_frame(target_frame_number);
}
@@ -585,6 +582,14 @@ public:
PRIORITY_SIZE
};
+ /// A number of queues of code to execute
+ //
+ /// This is a ptr_deque because it needs no insertion in the middle but
+ /// frequent push_back and pop_front. We also have to traverse it, so
+ /// a queue is not usable.
+ typedef boost::array<boost::ptr_deque<ExecutableCode>, PRIORITY_SIZE>
+ ActionQueue;
+
/// Push an executable code to the ActionQueue
void pushAction(std::auto_ptr<ExecutableCode> code, size_t lvl);
@@ -913,12 +918,6 @@ private:
/// Take care of dragging, if needed
void doMouseDrag();
- /// Delete all elements on the action queue and empty it.
- void clearActionQueue();
-
- /// Delete all elements on the timers list
- void clearIntervalTimers();
-
/// Execute expired timers
void executeAdvanceCallbacks();
@@ -985,8 +984,7 @@ private:
/// return.
size_t processActionQueue(size_t lvl);
- bool processingActions() const
- {
+ bool processingActions() const {
return (_processingActionLevel < PRIORITY_SIZE);
}
@@ -1030,14 +1028,7 @@ private:
/// The list of advanceable DisplayObject, in placement order
LiveChars _liveChars;
- /// A number of queues of code to execute
- //
- /// This is a ptr_deque because it needs no insertion in the middle but
- /// frequent push_back and pop_front. We also have to traverse it, so
- /// a queue is not usable.
- typedef boost::ptr_deque<ExecutableCode> ActionQueue;
-
- boost::array<ActionQueue, PRIORITY_SIZE> _actionQueue;
+ ActionQueue _actionQueue;
/// Process all actions in the queue
void processActionQueue();
@@ -1060,9 +1051,11 @@ private:
LoadCallbacks _loadCallbacks;
- typedef std::map<int, Timer*> TimerMap;
+ typedef boost::ptr_map<boost::uint32_t, Timer> TimerMap;
+
TimerMap _intervalTimers;
- unsigned int _lastTimerId;
+
+ size_t _lastTimerId;
/// bit-array for recording the unreleased keys
Keys _unreleasedKeys;
-----------------------------------------------------------------------
Summary of changes:
cygnal/cvm.cpp | 2 +-
gui/gui.cpp | 4 +-
libbase/extension.cpp | 18 +-
libbase/sharedlib.cpp | 2 +
libcore/DisplayObject.cpp | 535 ++++++++++++++++++++++---------------------
libcore/TextField.cpp | 24 +-
libcore/asobj/Global_as.cpp | 12 +-
libcore/movie_root.cpp | 258 ++++++++-------------
libcore/movie_root.h | 79 +++----
utilities/findwebcams.cpp | 65 +++--
utilities/processor.cpp | 2 +-
11 files changed, 469 insertions(+), 532 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. 0f01f719dba2a7db3a6d410eccf091d1c6338694,
Benjamin Wolsey <=