[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11614: Reverted postpone of bitmap
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11614: Reverted postpone of bitmap loading as it breaks a test showing that onLoadInit call finds known bitmap size. Rather than fixing this I think is better to change strategy on un-blocking bitmap loads as this attempt didn't consider blockage |
Date: |
Sun, 08 Nov 2009 13:53:30 +0100 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11614
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Sun 2009-11-08 13:53:30 +0100
message:
Reverted postpone of bitmap loading as it breaks a test showing that
onLoadInit call finds known bitmap size. Rather than fixing this I think is
better to change strategy on un-blocking bitmap loads as this attempt didn't
consider blockage
on DNS lookup, socket initialization and magic number parsing anyway..
modified:
libcore/BitmapMovie.cpp
libcore/BitmapMovie.h
libcore/impl.cpp
libcore/parser/BitmapMovieDefinition.cpp
libcore/parser/BitmapMovieDefinition.h
=== modified file 'libcore/BitmapMovie.cpp'
--- a/libcore/BitmapMovie.cpp 2009-11-06 22:19:35 +0000
+++ b/libcore/BitmapMovie.cpp 2009-11-08 12:53:30 +0000
@@ -21,7 +21,7 @@
namespace gnash {
-BitmapMovie::BitmapMovie(as_object* object, BitmapMovieDefinition* def,
+BitmapMovie::BitmapMovie(as_object* object, const BitmapMovieDefinition* def,
DisplayObject* parent)
:
Movie(object, def, parent),
@@ -29,20 +29,10 @@
{
assert(def);
assert(object);
-}
-
-void
-BitmapMovie::advance()
-{
- if ( ! _def->moreToLoad() )
- {
- Bitmap* bm = new Bitmap(getRoot(*object()), 0, _def, this);
-
- const int depth = 1 + DisplayObject::staticDepthOffset;
-
- placeDisplayObject(bm, depth);
- }
-
+ Bitmap* bm = new Bitmap(getRoot(*object), 0, def, this);
+
+ const int depth = 1 + DisplayObject::staticDepthOffset;
+ placeDisplayObject(bm, depth);
}
} // namespace gnash
=== modified file 'libcore/BitmapMovie.h'
--- a/libcore/BitmapMovie.h 2009-11-06 22:19:35 +0000
+++ b/libcore/BitmapMovie.h 2009-11-08 12:53:30 +0000
@@ -42,7 +42,7 @@
public:
- BitmapMovie(as_object* object, BitmapMovieDefinition* def,
+ BitmapMovie(as_object* object, const BitmapMovieDefinition* def,
DisplayObject* parent);
virtual ~BitmapMovie() {}
@@ -50,7 +50,7 @@
/// BitmapMovies do need an advance method.
//
/// This may be for play() or other inherited methods.
- virtual void advance();
+ virtual void advance() { MovieClip::advance(); }
virtual float frameRate() const {
return _def->get_frame_rate();
@@ -78,7 +78,7 @@
private:
- BitmapMovieDefinition* _def;
+ const BitmapMovieDefinition* const _def;
};
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2009-11-06 22:19:35 +0000
+++ b/libcore/impl.cpp 2009-11-08 12:53:30 +0000
@@ -46,7 +46,6 @@
#include <map>
#include <memory> // for auto_ptr
#include <algorithm>
-#include <boost/shared_ptr.hpp>
namespace gnash
{
@@ -77,10 +76,21 @@
try
{
+ std::auto_ptr<GnashImage> im(
+ ImageInput::readImageData(imageData, type));
+
+ if (!im.get()) {
+ log_error(_("Can't read image file from %s"), url);
+ return NULL;
+ }
+
Renderer* renderer = r.renderer();
+
BitmapMovieDefinition* mdef =
- new BitmapMovieDefinition(imageData, renderer, type, url);
+ new BitmapMovieDefinition(im, renderer, url);
+
return mdef;
+
}
catch (ParserException& e)
{
=== modified file 'libcore/parser/BitmapMovieDefinition.cpp'
--- a/libcore/parser/BitmapMovieDefinition.cpp 2009-11-06 22:19:35 +0000
+++ b/libcore/parser/BitmapMovieDefinition.cpp 2009-11-08 12:53:30 +0000
@@ -27,9 +27,6 @@
#include "Renderer.h"
#include "Global_as.h"
#include "namedStrings.h"
-#include "GnashException.h"
-#include <boost/shared_ptr.hpp>
-#include <sstream>
namespace gnash {
@@ -40,23 +37,6 @@
return new BitmapMovie(o, this, parent);
}
-BitmapMovieDefinition::BitmapMovieDefinition(
- boost::shared_ptr<IOChannel> imageData,
- Renderer* renderer, FileType type, const std::string& url)
- :
- _version(6),
- _framesize(0,0,512*20,512*20), // arbitrary default size (will change)
- _framecount(1),
- _framerate(12),
- _url(url),
- _bytesTotal(0),
- _bitmap(0),
- _inputStream(imageData),
- _inputFileType(type),
- _renderer(renderer)
-{
-}
-
BitmapMovieDefinition::BitmapMovieDefinition(std::auto_ptr<GnashImage> image,
Renderer* renderer, const std::string& url)
:
@@ -78,40 +58,6 @@
return 0;
}
-bool
-BitmapMovieDefinition::moreToLoad()
-{
- // TODO: use a thread for background loading here
-
- // no more to load if we don't have an input stream
- if ( ! _inputStream ) return false;
- // ..... or it's in bad state .....
- if ( _inputStream->bad() ) return false;
- // ..... or it's over .....
- if ( _inputStream->eof() ) return false;
-
- // This one blocks... (and may throw ?)
- log_debug("BitmapMovieDefinition starting image loading");
- std::auto_ptr<GnashImage> im(
- ImageInput::readImageData(_inputStream, _inputFileType));
-
- log_debug("BitmapMovieDefinition finished image loading");
- _inputStream.reset(); // we don't need this anymore
-
- if (!im.get()) {
- std::stringstream ss;
- ss << _("Can't read image file from") << _url;
- throw ParserException(ss.str());
- }
-
- _framesize.set_to_rect(0, 0, im->width()*20, im->height()*20);
- _bytesTotal = im->size();
-
- if ( _renderer ) _bitmap = _renderer->createBitmapInfo(im);
-
- return false;
-}
-
#ifdef GNASH_USE_GC
void
BitmapMovieDefinition::markReachableResources() const
=== modified file 'libcore/parser/BitmapMovieDefinition.h'
--- a/libcore/parser/BitmapMovieDefinition.h 2009-11-06 22:19:35 +0000
+++ b/libcore/parser/BitmapMovieDefinition.h 2009-11-08 12:53:30 +0000
@@ -25,8 +25,6 @@
#include "DynamicShape.h" // for destructor visibility by intrusive_ptr
#include "GnashImage.h"
#include "GnashNumeric.h"
-#include "IOChannel.h"
-#include "gnash.h" // for FileType enum
#include <string>
#include <memory> // for auto_ptr
@@ -62,21 +60,6 @@
BitmapMovieDefinition(std::auto_ptr<GnashImage> image, Renderer*
renderer,
const std::string& url);
- /// Construct a BitmapMovieDefinition for the given input
- //
- /// Will be initialized with the following values
- ///
- /// - SWF version 6
- /// - Framesize 0x0 (to be updated after parsing)
- /// - Single frame (unlabeled)
- /// - 12 FPS
- /// - 0 bytes size (for get_bytes_loaded()/get_bytes_total())
- /// - provided url
- ///
- BitmapMovieDefinition(boost::shared_ptr<IOChannel> image,
- Renderer* renderer, FileType type,
- const std::string& url);
-
virtual DisplayObject* createDisplayObject(Global_as&, DisplayObject*)
const;
@@ -141,9 +124,6 @@
return _bitmap.get();
}
- // Load more if needed, return false if finished loading all
- bool moreToLoad();
-
protected:
#ifdef GNASH_USE_GC
@@ -167,12 +147,6 @@
size_t _bytesTotal;
boost::intrusive_ptr<BitmapInfo> _bitmap;
-
- boost::shared_ptr<IOChannel> _inputStream;
-
- FileType _inputFileType;
-
- Renderer* _renderer;
};
} // namespace gnash
- [Gnash-commit] /srv/bzr/gnash/trunk r11614: Reverted postpone of bitmap loading as it breaks a test showing that onLoadInit call finds known bitmap size. Rather than fixing this I think is better to change strategy on un-blocking bitmap loads as this attempt didn't consider blockage,
Sandro Santilli <=