[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/ActionExec.cpp server/mo...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/ActionExec.cpp server/mo... |
Date: |
Mon, 07 Aug 2006 20:43:38 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/08/07 20:43:38
Modified files:
. : ChangeLog
server : ActionExec.cpp movie_def_impl.cpp
movie_def_impl.h movie_definition.h
sprite_definition.h sprite_instance.cpp
Log message:
* server/sprite_instance.cpp: simplified code in advance_root
to use the new specialized
movie_definition::load_next_frame_chunk()
* server/movie_def_impl.cpp: implemented frame chunk loading,
with chunks currently set to 64 frames (FRAMELOAD_CHUNK def);
Added DEBUG_FRAMES_LOAD define.
* server/movie_definition.h, server/sprite_definition.h,
server/movie_def_impl.h:
Added load_next_frame_chunk() virtual method.
* server/ActionExec.cpp (skip_actions): simplified code.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.598&r2=1.599
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_def_impl.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_def_impl.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_definition.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_definition.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.29&r2=1.30
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.598
retrieving revision 1.599
diff -u -b -r1.598 -r1.599
--- ChangeLog 7 Aug 2006 18:56:14 -0000 1.598
+++ ChangeLog 7 Aug 2006 20:43:38 -0000 1.599
@@ -1,5 +1,14 @@
2006-08-07 Sandro Santilli <address@hidden>
+ * server/sprite_instance.cpp: simplified code in advance_root
+ to use the new specialized movie_definition::load_next_frame_chunk()
+ * server/movie_def_impl.cpp: implemented frame chunk loading,
+ with chunks currently set to 64 frames (FRAMELOAD_CHUNK def);
+ Added DEBUG_FRAMES_LOAD define.
+ * server/movie_definition.h, server/sprite_definition.h,
+ server/movie_def_impl.h:
+ Added load_next_frame_chunk() virtual method.
+ * server/ActionExec.cpp (skip_actions): simplified code.
* server/swf/ASHandlers.cpp (ActionBranchIfTrue):
assertion checking, minor cleanup.
* gui/gui.cpp: removed unused parameters warnings
Index: server/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/ActionExec.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/ActionExec.cpp 6 Aug 2006 02:00:54 -0000 1.21
+++ server/ActionExec.cpp 7 Aug 2006 20:43:38 -0000 1.22
@@ -201,37 +201,40 @@
void
ActionExec::skip_actions(size_t offset)
{
- pc = next_pc;
+ //pc = next_pc;
for(size_t i=0; i<offset; ++i)
{
+#if 1
// we need to check at every iteration because
// an action can be longer then a single byte
- if ( pc >= stop_pc )
+ if ( next_pc >= stop_pc )
{
log_error("End of DoAction block hit while skipping "
- " %u action tags - "
+ " %u action tags (pc:%u, stop_pc:%u) - "
"Malformed SWF ? (WaitForFrame, probably)",
- offset);
+ offset, next_pc, stop_pc);
+ next_pc = stop_pc;
return;
}
+#endif
// Get the opcode.
- uint8_t action_id = code[pc];
+ uint8_t action_id = code[next_pc];
// Set default next_pc offset, control flow action handlers
// will be able to reset it.
if ((action_id & 0x80) == 0) {
// action with no extra data
- next_pc = pc+1;
+ next_pc += 1;
} else {
// action with extra data
- int16_t length = code.read_int16(pc+1);
+ int16_t length = code.read_int16(next_pc+1);
assert( length >= 0 );
- next_pc = pc + length + 3;
+ next_pc += length + 3;
}
- pc = next_pc;
+ //pc = next_pc;
}
}
Index: server/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_def_impl.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/movie_def_impl.cpp 5 Aug 2006 18:10:26 -0000 1.17
+++ server/movie_def_impl.cpp 7 Aug 2006 20:43:38 -0000 1.18
@@ -64,6 +64,13 @@
// Increment this when the cache data format changes.
#define CACHE_FILE_VERSION 4
+// If != 0 this is the number of frames to load at each iteration
+// of the main loop. Loading in chunks greatly speeds the process up
+#define FRAMELOAD_CHUNK 64
+
+// Debug frames load
+#undef DEBUG_FRAMES_LOAD
+
namespace gnash
{
@@ -442,7 +449,7 @@
return true;
}
-#if 0 // debugging
+#if DEBUG_FRAMES_LOAD
else
{
log_msg("Loading of frame %u requested (we are at %u/%u)",
@@ -470,7 +477,7 @@
// show frame tag -- advance to the next frame.
log_parse(" show_frame\n");
++m_loading_frame;
-#if 0 // debugging
+#if DEBUG_FRAMES_LOAD
log_msg("Loaded frame %u/%u",
m_loading_frame, m_frame_count);
#endif
@@ -742,5 +749,47 @@
//dump_chars();
}
+// Load next chunk of this sprite frames.
+// This is possibly better defined in movie_definition
+void
+movie_def_impl::load_next_frame_chunk()
+{
+
+ size_t framecount = get_frame_count();
+ size_t lastloaded = get_loading_frame();
+
+ // nothing to do
+ if ( lastloaded == framecount ) return;
+
+ size_t nextframe = lastloaded+1;
+
+#if FRAMELOAD_CHUNK
+ nextframe += FRAMELOAD_CHUNK; // load in chunks of 10 frames
+ if ( nextframe > framecount ) nextframe = framecount;
+#endif
+ //log_msg("Framecount: %u, Lastloaded: %u", framecount, lastloaded);
+ if ( nextframe <= framecount )
+ {
+#ifdef DEBUG_FRAMES_LOAD // debugging
+ log_msg("Ensure load of frame %u/%u (last loaded is: %u)",
+ nextframe, framecount, lastloaded);
+#endif
+ if ( ! ensure_frame_loaded(nextframe) )
+ {
+ log_error("Could not advance to frame %d!",
+ nextframe);
+ // these kind of errors should be handled by callers
+ assert(0);
+ }
+ }
+#ifdef DEBUG_FRAMES_LOAD
+ else
+ {
+ log_msg("No more frames to load. Framecount: %u, Lastloaded:
%u, next to load: %u", framecount, lastloaded, nextframe);
+ }
+#endif
+}
+
+
} // namespace gnash
Index: server/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_def_impl.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/movie_def_impl.h 7 Aug 2006 17:47:46 -0000 1.15
+++ server/movie_def_impl.h 7 Aug 2006 20:43:38 -0000 1.16
@@ -461,6 +461,8 @@
///
bool ensure_frame_loaded(size_t framenum);
+ virtual void load_next_frame_chunk();
+
/// Fill up *fonts with fonts that we own.
void get_owned_fonts(std::vector<font*>* fonts);
Index: server/movie_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_definition.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/movie_definition.h 4 Aug 2006 17:23:49 -0000 1.9
+++ server/movie_definition.h 7 Aug 2006 20:43:38 -0000 1.10
@@ -256,6 +256,11 @@
/// @return false on error (like not enough frames available).
///
virtual bool ensure_frame_loaded(size_t framenum) = 0;
+
+ /// \brief
+ /// Load next chunk of this movie/sprite frames if available.
+ ///
+ virtual void load_next_frame_chunk() = 0;
};
} // namespace gnash
Index: server/sprite_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_definition.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/sprite_definition.h 5 Aug 2006 18:10:26 -0000 1.14
+++ server/sprite_definition.h 7 Aug 2006 20:43:38 -0000 1.15
@@ -343,6 +343,12 @@
//return m_movie_def->ensure_frame_loaded(framenum);
}
+ virtual void load_next_frame_chunk()
+ {
+ /// We load full sprite definitions at once, so
+ /// this function is a no-op.
+ }
+
/// Return the top-level movie definition
/// (the definition read from SWF stream)
movie_definition* get_movie_definition() {
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/sprite_instance.cpp 6 Aug 2006 02:00:54 -0000 1.29
+++ server/sprite_instance.cpp 7 Aug 2006 20:43:38 -0000 1.30
@@ -1222,38 +1222,15 @@
assert ( get_root()->get_root_movie() == this );
- // Load one more frame if available (even if not needed for
+ // Load next frame chunk if available (even if not needed for
// display of the next one) - this is to use idle time for loading.
//
// We do this inside advance_root to make sure
// it's only for a root sprite (not a sprite defined
// by DefineSprite!)
- //
+
movie_definition* md = get_movie_definition();
- size_t framecount = md->get_frame_count();
- size_t lastloaded = md->get_loading_frame();
- size_t nextframe = lastloaded+1;
-// If != 0 this is the number of frames to load at each iteration
-// of the main loop
-#define FRAMELOAD_CHUNK 0
-#if FRAMELOAD_CHUNK
- nextframe += FRAMELOAD_CHUNK; // load in chunks of 10 frames
-#endif
- //log_msg("Framecount: %u, Lastloaded: %u", framecount, lastloaded);
- if ( nextframe <= framecount )
- {
-#if 0 // debugging
- log_msg("Ensure load of frame %u/%u (last loaded is: %u)",
- nextframe, framecount, lastloaded);
-#endif
- if ( ! md->ensure_frame_loaded(nextframe) )
- {
- log_error("Could not advance to frame %d!",
- nextframe);
- // these kind of errors should be handled by callers
- assert(0);
- }
- }
+ md->load_next_frame_chunk();
m_time_remainder += delta_time;