[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10444: Cut out one of the classes i
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10444: Cut out one of the classes involved in bitmap storage and display. |
Date: |
Tue, 16 Dec 2008 17:10:07 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10444
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-12-16 17:10:07 +0100
message:
Cut out one of the classes involved in bitmap storage and display.
Preparatory to implementing MovieClip.attachBitmap.
removed:
libcore/parser/bitmap_character_def.cpp
libcore/parser/bitmap_character_def.h
renamed:
libcore/bitmap_info.h => libcore/BitmapInfo.h
modified:
backend/render_handler.h
backend/render_handler_agg.cpp
backend/render_handler_agg_bitmap.h
backend/render_handler_cairo.cpp
backend/render_handler_ogl.cpp
backend/render_handler_ogl.h
libcore/DynamicShape.h
libcore/FreetypeGlyphsProvider.h
libcore/Makefile.am
libcore/PropertyList.h
libcore/TextField.h
libcore/as_environment.h
libcore/as_function.h
libcore/as_object.h
libcore/as_value.h
libcore/asobj/Key_as.h
libcore/asobj/NetStream_as.h
libcore/event_id.h
libcore/fill_style.cpp
libcore/fill_style.h
libcore/impl.cpp
libcore/parser/BitmapMovieDefinition.cpp
libcore/parser/BitmapMovieDefinition.h
libcore/parser/Makefile.am
libcore/parser/SWFMovieDefinition.cpp
libcore/parser/SWFMovieDefinition.h
libcore/parser/movie_definition.h
libcore/parser/sprite_definition.h
libcore/render.cpp
libcore/render.h
libcore/styles.cpp
libcore/styles.h
libcore/swf/TextRecord.cpp
libcore/swf/tag_loaders.cpp
libcore/BitmapInfo.h
------------------------------------------------------------
revno: 10442.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 11:51:25 +0100
message:
Line length.
modified:
libcore/swf/tag_loaders.cpp
------------------------------------------------------------
revno: 10442.1.9
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 12:20:15 +0100
message:
Gut bitmap_info.
modified:
libcore/bitmap_info.h
------------------------------------------------------------
revno: 10442.1.10
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 13:20:22 +0100
message:
Remove as many DSOEXPORTs as possible.
modified:
libcore/DynamicShape.h
libcore/PropertyList.h
libcore/TextField.h
libcore/as_environment.h
libcore/as_function.h
libcore/as_object.h
libcore/as_value.h
libcore/asobj/Key_as.h
libcore/asobj/NetStream_as.h
libcore/event_id.h
libcore/fill_style.cpp
libcore/fill_style.h
libcore/styles.cpp
libcore/styles.h
libcore/swf/TextRecord.cpp
------------------------------------------------------------
revno: 10442.1.11
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 14:39:31 +0100
message:
Early returns, drop unused code, improve formatting.
modified:
libcore/swf/tag_loaders.cpp
------------------------------------------------------------
revno: 10442.1.12
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 15:02:37 +0100
message:
Minor changes.
modified:
libcore/impl.cpp
------------------------------------------------------------
revno: 10442.1.13
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 16:15:55 +0100
message:
Drop bitmap_character_def, which wasn't a character_def, as it's silly to
use two ref-counted classes in parallel for the same thing. Use BitmapInfo
(was: bitmap_info) on its own instead.
removed:
libcore/parser/bitmap_character_def.cpp
libcore/parser/bitmap_character_def.h
renamed:
libcore/bitmap_info.h => libcore/BitmapInfo.h
modified:
backend/render_handler.h
backend/render_handler_agg.cpp
backend/render_handler_agg_bitmap.h
backend/render_handler_cairo.cpp
backend/render_handler_ogl.cpp
backend/render_handler_ogl.h
libcore/FreetypeGlyphsProvider.h
libcore/Makefile.am
libcore/fill_style.cpp
libcore/fill_style.h
libcore/parser/BitmapMovieDefinition.cpp
libcore/parser/BitmapMovieDefinition.h
libcore/parser/Makefile.am
libcore/parser/SWFMovieDefinition.cpp
libcore/parser/SWFMovieDefinition.h
libcore/parser/movie_definition.h
libcore/parser/sprite_definition.h
libcore/render.cpp
libcore/render.h
libcore/styles.h
libcore/swf/tag_loaders.cpp
libcore/BitmapInfo.h
------------------------------------------------------------
revno: 10442.1.14
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-12-16 16:48:03 +0100
message:
Drop commented-out code.
modified:
libcore/fill_style.cpp
=== modified file 'backend/render_handler.h'
--- a/backend/render_handler.h 2008-10-27 16:05:13 +0000
+++ b/backend/render_handler.h 2008-12-16 15:15:55 +0000
@@ -152,7 +152,7 @@
// Forward declarations.
namespace gnash {
- class bitmap_info;
+ class BitmapInfo;
class rect;
class rgba;
class SWFMatrix;
@@ -224,7 +224,7 @@
/// Given an image, returns a pointer to a bitmap_info class
/// that can later be passed to fill_styleX_bitmap(), to set a
/// bitmap fill style.
- virtual bitmap_info* create_bitmap_info_rgb(ImageRGB* im) = 0;
+ virtual BitmapInfo* create_bitmap_info_rgb(ImageRGB* im) = 0;
/// \brief
/// Given an image, returns a pointer to a bitmap_info class
@@ -233,7 +233,7 @@
//
/// This version takes an image with an alpha channel.
///
- virtual bitmap_info* create_bitmap_info_rgba(ImageRGBA* im) = 0;
+ virtual BitmapInfo* create_bitmap_info_rgba(ImageRGBA* im) = 0;
/// Draws a video frame.
//
=== modified file 'backend/render_handler_agg.cpp'
--- a/backend/render_handler_agg.cpp 2008-11-14 00:46:35 +0000
+++ b/backend/render_handler_agg.cpp 2008-12-16 15:15:55 +0000
@@ -392,7 +392,7 @@
};
- gnash::bitmap_info* create_bitmap_info_rgb(ImageRGB* im)
+ gnash::BitmapInfo* create_bitmap_info_rgb(ImageRGB* im)
// Given an image, returns a pointer to a bitmap_info class
// that can later be passed to fill_styleX_bitmap(), to set a
// bitmap fill style.
@@ -403,8 +403,8 @@
}
- gnash::bitmap_info* create_bitmap_info_rgba(ImageRGBA* im)
- // Given an image, returns a pointer to a bitmap_info class
+ gnash::BitmapInfo* create_bitmap_info_rgba(ImageRGBA* im)
+ // Given an image, returns a pointer to a BitmapInfo class
// that can later be passed to fill_style_bitmap(), to set a
// bitmap fill style.
//
@@ -415,7 +415,7 @@
}
- gnash::bitmap_info* create_bitmap_info_empty()
+ gnash::BitmapInfo* create_bitmap_info_empty()
// Create a placeholder bitmap_info. Used when
// DO_NOT_LOAD_BITMAPS is set; then later on the host program
// can use movie_definition::get_bitmap_info_count() and
=== modified file 'backend/render_handler_agg_bitmap.h'
--- a/backend/render_handler_agg_bitmap.h 2008-06-27 03:50:30 +0000
+++ b/backend/render_handler_agg_bitmap.h 2008-12-16 15:15:55 +0000
@@ -25,7 +25,7 @@
/// Bitmap class used internally by the AGG renderer. There's no reason to
/// use it outside. It does not much except providing all necessary
information.
-class agg_bitmap_info_base : public bitmap_info
+class agg_bitmap_info_base : public BitmapInfo
{
public:
=== modified file 'backend/render_handler_cairo.cpp'
--- a/backend/render_handler_cairo.cpp 2008-10-27 16:05:13 +0000
+++ b/backend/render_handler_cairo.cpp 2008-12-16 15:15:55 +0000
@@ -138,7 +138,7 @@
}
-class bitmap_info_cairo : public bitmap_info, boost::noncopyable
+class bitmap_info_cairo : public BitmapInfo, boost::noncopyable
{
public:
bitmap_info_cairo(boost::uint8_t* data, int width, int height,
@@ -419,7 +419,7 @@
{
}
- virtual bitmap_info* create_bitmap_info_rgb(ImageRGB* im)
+ virtual BitmapInfo* create_bitmap_info_rgb(ImageRGB* im)
{
int buf_size = im->width() * im->height() * 4;
boost::uint8_t* buffer = new boost::uint8_t[buf_size];
@@ -430,7 +430,7 @@
CAIRO_FORMAT_RGB24);
}
- virtual bitmap_info* create_bitmap_info_rgba(ImageRGBA* im)
+ virtual BitmapInfo* create_bitmap_info_rgba(ImageRGBA* im)
{
int buf_size = im->width() * im->height() * 4;
boost::uint8_t* buffer = new boost::uint8_t[buf_size];
=== modified file 'backend/render_handler_ogl.cpp'
--- a/backend/render_handler_ogl.cpp 2008-10-27 16:05:13 +0000
+++ b/backend/render_handler_ogl.cpp 2008-12-16 15:15:55 +0000
@@ -641,12 +641,12 @@
#endif
}
- virtual bitmap_info* create_bitmap_info_rgb(ImageRGB* im)
+ virtual BitmapInfo* create_bitmap_info_rgb(ImageRGB* im)
{
return new bitmap_info_ogl(im, GL_RGB, ogl_accessible());
}
- virtual bitmap_info* create_bitmap_info_rgba(ImageRGBA* im)
+ virtual BitmapInfo* create_bitmap_info_rgba(ImageRGBA* im)
{
return new bitmap_info_ogl(im, GL_RGBA, ogl_accessible());
}
=== modified file 'backend/render_handler_ogl.h'
--- a/backend/render_handler_ogl.h 2008-10-27 16:05:13 +0000
+++ b/backend/render_handler_ogl.h 2008-12-16 15:15:55 +0000
@@ -145,7 +145,7 @@
};
-class bitmap_info_ogl : public bitmap_info
+class bitmap_info_ogl : public BitmapInfo
{
public:
bitmap_info_ogl(GnashImage* image, GLenum pixelformat,
=== renamed file 'libcore/bitmap_info.h' => 'libcore/BitmapInfo.h'
--- a/libcore/bitmap_info.h 2008-10-27 16:05:13 +0000
+++ b/libcore/BitmapInfo.h 2008-12-16 15:15:55 +0000
@@ -24,26 +24,17 @@
namespace gnash {
-/// Your render_handler creates bitmap_info's for gnash. You
-/// need to subclass bitmap_info in order to add the
+/// Your render_handler creates BitmapInfos for gnash. You
+/// need to subclass BitmapInfo in order to add the
/// information and functionality your app needs to render
/// using textures.
-class DSOEXPORT bitmap_info : public ref_counted
+class DSOEXPORT BitmapInfo : public ref_counted
{
public:
- unsigned int m_texture_id; // nuke?
- int m_original_width; // nuke?
- int m_original_height; // nuke?
-
- bitmap_info()
- :
-// m_suspended_image(NULL),
- m_texture_id(0),
- m_original_width(0),
- m_original_height(0)
- {
- }
+ BitmapInfo() {}
+
+ virtual ~BitmapInfo() {}
};
=== modified file 'libcore/DynamicShape.h'
--- a/libcore/DynamicShape.h 2008-11-14 10:31:33 +0000
+++ b/libcore/DynamicShape.h 2008-12-16 12:20:22 +0000
@@ -23,6 +23,11 @@
#include "shape_character_def.h" // for inheritance
#include "styles.h" // for cap_style_e and join_style_e enums
+
+namespace gnash {
+ class fill_style;
+}
+
namespace gnash {
/// \brief
=== modified file 'libcore/FreetypeGlyphsProvider.h'
--- a/libcore/FreetypeGlyphsProvider.h 2008-10-27 16:05:13 +0000
+++ b/libcore/FreetypeGlyphsProvider.h 2008-12-16 15:15:55 +0000
@@ -35,7 +35,6 @@
// Forward declarations
namespace gnash {
- class bitmap_info;
class shape_character_def;
}
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2008-11-17 16:52:55 +0000
+++ b/libcore/Makefile.am 2008-12-16 15:15:55 +0000
@@ -137,7 +137,7 @@
as_prop_flags.h \
as_value.h \
asClass.h \
- bitmap_info.h \
+ BitmapInfo.h \
BitmapMovieInstance.h \
builtin_function.h \
Button.h \
=== modified file 'libcore/PropertyList.h'
--- a/libcore/PropertyList.h 2008-12-14 12:48:17 +0000
+++ b/libcore/PropertyList.h 2008-12-16 12:20:22 +0000
@@ -18,8 +18,6 @@
#ifndef GNASH_PROPERTYLIST_H
#define GNASH_PROPERTYLIST_H
-#include "dsodefs.h" // DSOEXPORT
-
#include "Property.h" // for templated functions
#include "as_prop_flags.h" // for templated functions
#include "as_value.h" // for templated functions
@@ -540,7 +538,7 @@
/// Mark all simple properties, getters and setters
/// as being reachable (for the GC)
- void DSOEXPORT setReachable() const;
+ void setReachable() const;
private:
container _props;
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2008-12-05 12:37:17 +0000
+++ b/libcore/TextField.h 2008-12-16 12:20:22 +0000
@@ -19,7 +19,8 @@
#define GNASH_TEXTFIELD_H
#include "character.h" // for inheritance
-#include "styles.h" // for fill_style and line_style
+#include "styles.h" // for line_style
+#include "fill_style.h"
#include "Range2d.h"
#include "rect.h" // for inlines
#include "Font.h" // for visibility of font add_ref/drop_ref
=== modified file 'libcore/as_environment.h'
--- a/libcore/as_environment.h 2008-11-20 07:30:09 +0000
+++ b/libcore/as_environment.h 2008-12-16 12:20:22 +0000
@@ -19,7 +19,6 @@
#define GNASH_AS_ENVIRONMENT_H
#include "smart_ptr.h" // GNASH_USE_GC
-#include "dsodefs.h" // DSOEXPORT
#include "as_value.h" // for composition (vector + frame_slot)
#include "StringPredicates.h" // for Variables
#include "as_object.h"
@@ -559,13 +558,13 @@
/// @param func
/// The function being called
///
- DSOEXPORT void pushCallFrame(as_function* func);
+ void pushCallFrame(as_function* func);
/// Remove current call frame from the stack
//
/// This should happen when an ActionScript function returns.
///
- DSOEXPORT void popCallFrame();
+ void popCallFrame();
/// Return the (possibly UNDEFINED) value of the named variable.
//
=== modified file 'libcore/as_function.h'
--- a/libcore/as_function.h 2008-10-20 10:09:22 +0000
+++ b/libcore/as_function.h 2008-12-16 12:20:22 +0000
@@ -59,7 +59,7 @@
///
///
///
-class DSOEXPORT as_function : public as_object
+class as_function : public as_object
{
public:
=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h 2008-12-14 12:48:17 +0000
+++ b/libcore/as_object.h 2008-12-16 12:20:22 +0000
@@ -22,7 +22,6 @@
#include "gnashconfig.h"
#endif
-#include "dsodefs.h" // DSOEXPORT
#include "smart_ptr.h" // GNASH_USE_GC
#include "string_table.h"
#include "ref_counted.h" // for inheritance (to drop)
@@ -118,7 +117,7 @@
/// Base-class for ActionScript script-defined objects.
/// This would likely be ActionScript's 'Object' class.
///
-class DSOEXPORT as_object
+class as_object
:
#ifdef GNASH_USE_GC
public GcResource
@@ -733,7 +732,7 @@
/// need to know wheter it was found or not.
///
as_value callMethod(string_table::key name);
- as_value callMethod(string_table::key name, const as_value& arg0);
+ DSOEXPORT as_value callMethod(string_table::key name, const as_value&
arg0);
as_value callMethod(string_table::key name, const as_value& arg0,
const as_value& arg1);
as_value callMethod(string_table::key name, const as_value& arg0,
=== modified file 'libcore/as_value.h'
--- a/libcore/as_value.h 2008-12-14 12:48:17 +0000
+++ b/libcore/as_value.h 2008-12-16 12:20:22 +0000
@@ -101,7 +101,7 @@
/// class. The instance keeps primitive types by value and
/// composite types by reference (smart pointer).
///
-class DSOEXPORT as_value
+class as_value
{
public:
@@ -144,7 +144,7 @@
};
/// Construct an UNDEFINED value
- as_value();
+ DSOEXPORT as_value();
/// Copy constructor.
as_value(const as_value& value);
@@ -224,7 +224,7 @@
/// @param vm
/// Virtual machine to use for initialization of the values
(string_table)
///
- bool readAMF0(boost::uint8_t *&b, boost::uint8_t *end, int inType,
+ DSOEXPORT bool readAMF0(boost::uint8_t *&b, boost::uint8_t *end, int
inType,
std::vector<as_object*>& objRefs, VM& vm);
/// Serialize value in AMF0 format.
@@ -320,7 +320,7 @@
// Used for operator<< to give useful information about an
// as_value object.
- std::string toDebugString() const;
+ DSOEXPORT std::string toDebugString() const;
/// Get a string representation for this value.
//
=== modified file 'libcore/asobj/Key_as.h'
--- a/libcore/asobj/Key_as.h 2008-10-19 13:16:05 +0000
+++ b/libcore/asobj/Key_as.h 2008-12-16 12:20:22 +0000
@@ -37,7 +37,7 @@
*
************************************************************************/
-class DSOEXPORT Key_as : public as_object
+class Key_as : public as_object
{
protected:
=== modified file 'libcore/asobj/NetStream_as.h'
--- a/libcore/asobj/NetStream_as.h 2008-12-05 07:35:49 +0000
+++ b/libcore/asobj/NetStream_as.h 2008-12-16 12:20:22 +0000
@@ -83,14 +83,14 @@
class CursoredBuffer
{
public:
- DSOEXPORT CursoredBuffer()
+ CursoredBuffer()
:
m_size(0),
m_data(NULL),
m_ptr(NULL)
{}
- DSOEXPORT ~CursoredBuffer()
+ ~CursoredBuffer()
{
delete [] m_data;
}
=== modified file 'libcore/event_id.h'
--- a/libcore/event_id.h 2008-08-21 10:06:20 +0000
+++ b/libcore/event_id.h 2008-12-16 12:20:22 +0000
@@ -21,7 +21,6 @@
#define GNASH_EVENT_ID_H
#include "string_table.h"
-#include "dsodefs.h"
#include "GnashKey.h" // for gnash::key::code
@@ -31,7 +30,7 @@
//
/// Implementation is currently in action.cpp
///
-class DSOEXPORT event_id
+class event_id
{
public:
/// These must match the function names in event_id::get_function_name()
=== modified file 'libcore/fill_style.cpp'
--- a/libcore/fill_style.cpp 2008-10-31 10:38:03 +0000
+++ b/libcore/fill_style.cpp 2008-12-16 15:48:03 +0000
@@ -51,8 +51,8 @@
:
m_type(SWF::FILL_SOLID),
m_color(), // FF.FF.FF.FF
- m_gradient_bitmap_info(0),
- m_bitmap_character(0),
+ _gradientBitmapInfo(0),
+ _bitmapInfo(0),
m_spread_mode(SWF::GRADIENT_SPREAD_PAD),
m_interpolation(SWF::GRADIENT_INTERPOL_NORMAL)
{
@@ -235,15 +235,11 @@
pOther->m_color = pOther->m_gradients[0].m_color;
}
- m_gradient_bitmap_info = create_gradient_bitmap();
+ _gradientBitmapInfo = create_gradient_bitmap();
if (is_morph)
{
- pOther->m_gradient_bitmap_info =
- pOther->need_gradient_bitmap();
- md.add_bitmap_info(pOther->m_gradient_bitmap_info.get());
+ pOther->_gradientBitmapInfo = pOther->need_gradient_bitmap();
}
- // Make sure our SWFMovieDefinition knows about this bitmap.
- md.add_bitmap_info(m_gradient_bitmap_info.get());
}
else if (m_type == SWF::FILL_TILED_BITMAP
|| m_type == SWF::FILL_CLIPPED_BITMAP
@@ -263,9 +259,9 @@
);
// Look up the bitmap character.
- m_bitmap_character = md.get_bitmap_character_def(bitmap_char_id);
+ _bitmapInfo = md.getBitmap(bitmap_char_id);
IF_VERBOSE_MALFORMED_SWF(
- if (!m_bitmap_character)
+ if (!_bitmapInfo)
{
LOG_ONCE(
log_swferror(_("Bitmap fill specifies '%d' as associated"
@@ -288,7 +284,7 @@
if (is_morph)
{
- pOther->m_bitmap_character = m_bitmap_character;
+ pOther->_bitmapInfo = _bitmapInfo;
m.read(in);
pOther->m_bitmap_matrix = m.invert();
}
@@ -307,7 +303,7 @@
}
-bitmap_info*
+BitmapInfo*
fill_style::get_bitmap_info() const
{
assert(m_type != SWF::FILL_SOLID);
@@ -318,9 +314,9 @@
case SWF::FILL_CLIPPED_BITMAP:
case SWF::FILL_TILED_BITMAP_HARD:
case SWF::FILL_CLIPPED_BITMAP_HARD:
- if (m_bitmap_character)
+ if (_bitmapInfo)
{
- return m_bitmap_character->get_bitmap_info();
+ return _bitmapInfo.get();
}
return NULL;
@@ -419,7 +415,7 @@
return m_gradients.back().m_color;
}
-gnash::bitmap_info*
+BitmapInfo*
fill_style::create_gradient_bitmap() const
{
assert(m_type == SWF::FILL_LINEAR_GRADIENT
@@ -486,23 +482,23 @@
break;
}
- bitmap_info* bi = render::createBitmapInfo(
+ BitmapInfo* bi = render::createBitmapInfo(
static_cast<std::auto_ptr<GnashImage> >(im));
return bi;
}
-gnash::bitmap_info*
+BitmapInfo*
fill_style::need_gradient_bitmap() const
{
- if (!m_gradient_bitmap_info) {
+ if (!_gradientBitmapInfo) {
fill_style* this_non_const = const_cast<fill_style*>(this);
- this_non_const->m_gradient_bitmap_info = create_gradient_bitmap();
+ this_non_const->_gradientBitmapInfo = create_gradient_bitmap();
}
- return m_gradient_bitmap_info.get();
+ return _gradientBitmapInfo.get();
}
@@ -540,11 +536,11 @@
m_gradients[j].m_color.set_lerp(a.m_gradients[j].m_color,
b.m_gradients[j].m_color, t);
}
- m_gradient_bitmap_info = NULL;
+ _gradientBitmapInfo = NULL;
// fill style bitmap ID
- m_bitmap_character = a.m_bitmap_character;
- assert(m_bitmap_character == b.m_bitmap_character);
+ _bitmapInfo = a._bitmapInfo;
+ assert(_bitmapInfo == b._bitmapInfo);
// fill style bitmap SWFMatrix
m_bitmap_matrix.set_lerp(a.m_bitmap_matrix, b.m_bitmap_matrix, t);
@@ -563,10 +559,10 @@
return m_gradients[index];
}
-fill_style::fill_style(bitmap_character_def* bitmap, const SWFMatrix& mat)
+fill_style::fill_style(BitmapInfo* bitmap, const SWFMatrix& mat)
:
m_type(SWF::FILL_CLIPPED_BITMAP),
- m_bitmap_character(bitmap),
+ _bitmapInfo(bitmap),
m_bitmap_matrix(mat)
{
}
@@ -585,7 +581,7 @@
m_type = SWF::FILL_LINEAR_GRADIENT;
m_gradients = gradients;
m_gradient_matrix = mat;
- m_gradient_bitmap_info = 0;
+ _gradientBitmapInfo = 0;
}
void
@@ -595,7 +591,7 @@
m_type = SWF::FILL_RADIAL_GRADIENT;
m_gradients = gradients;
m_gradient_matrix = mat;
- m_gradient_bitmap_info = 0;
+ _gradientBitmapInfo = 0;
}
@@ -603,8 +599,8 @@
void
fill_style::markReachableResources() const
{
- if ( m_gradient_bitmap_info ) m_gradient_bitmap_info->setReachable();
- if ( m_bitmap_character ) m_bitmap_character->setReachable();
+ if ( _gradientBitmapInfo ) _gradientBitmapInfo->setReachable();
+ if ( _bitmapInfo ) _bitmapInfo->setReachable();
}
#endif // GNASH_USE_GC
=== modified file 'libcore/fill_style.h'
--- a/libcore/fill_style.h 2008-10-30 13:15:12 +0000
+++ b/libcore/fill_style.h 2008-12-16 15:15:55 +0000
@@ -23,7 +23,7 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "SWFMatrix.h"
-#include "bitmap_character_def.h"
+#include "BitmapInfo.h"
#include "swf.h"
#include "RGBA.h" // for rgba type
@@ -32,6 +32,7 @@
namespace gnash {
class SWFStream;
+class movie_definition;
class gradient_record
{
@@ -77,7 +78,7 @@
/// @param mat
/// The SWFMatrix to apply to the bitmap.
///
- fill_style(bitmap_character_def* bitmap, const SWFMatrix& mat);
+ fill_style(BitmapInfo* bitmap, const SWFMatrix& mat);
void setSolid(const rgba& color);
@@ -136,14 +137,14 @@
fill_style *pOther);
/// \brief
- /// Make a bitmap_info* corresponding to our gradient.
+ /// Make a BitmapInfo* corresponding to our gradient.
/// We can use this to set the gradient fill style.
- gnash::bitmap_info* create_gradient_bitmap() const;
+ BitmapInfo* create_gradient_bitmap() const;
/// \brief
- /// Makes sure that m_gradient_bitmap_info is not NULL. Calls
- /// create_gradient_bitmap() if necessary and returns
m_gradient_bitmap_info.
- gnash::bitmap_info* need_gradient_bitmap() const;
+ /// Makes sure that _gradientBitmapInfo is not NULL. Calls
+ /// create_gradient_bitmap() if necessary and returns
_gradientBitmapInfo.
+ BitmapInfo* need_gradient_bitmap() const;
rgba get_color() const { return m_color; }
@@ -171,7 +172,7 @@
/// to a character defined in the characters dictionary.
/// (it happens..)
///
- bitmap_info* get_bitmap_info() const;
+ BitmapInfo* get_bitmap_info() const;
/// Returns the bitmap transformation SWFMatrix
SWFMatrix getBitmapMatrix() const;
@@ -196,7 +197,7 @@
//
/// fill_style specific reachable resources are:
///
- /// - gradient bitmap info (m_gradient_bitmap_info)
+ /// - gradient bitmap info (_gradientBitmapInfo)
/// - bitmap character (m_bitmap_character)
///
void markReachableResources() const;
@@ -218,9 +219,9 @@
rgba m_color;
SWFMatrix m_gradient_matrix;
float m_focal_point; // For focal fill gradients.
- std::vector<gradient_record> m_gradients;
- boost::intrusive_ptr<gnash::bitmap_info> m_gradient_bitmap_info;
- boost::intrusive_ptr<bitmap_character_def> m_bitmap_character;
+ std::vector<gradient_record> m_gradients;
+ boost::intrusive_ptr<BitmapInfo> _gradientBitmapInfo;
+ boost::intrusive_ptr<BitmapInfo> _bitmapInfo;
SWFMatrix m_bitmap_matrix;
SWF::gradient_spread_mode m_spread_mode;
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2008-12-04 07:28:59 +0000
+++ b/libcore/impl.cpp 2008-12-16 14:02:37 +0000
@@ -64,9 +64,18 @@
#include <memory> // for auto_ptr
#include <algorithm>
+
namespace gnash
{
+// Forward declarations
+namespace {
+ FileType getFileType(IOChannel& in);
+ SWFMovieDefinition* createSWFMovie(std::auto_ptr<IOChannel> in,
+ const std::string& url, const RunInfo& runInfo,
+ bool startLoaderThread);
+}
+
static void clear_library();
// Associate the specified tag type with the given tag loader
@@ -225,11 +234,13 @@
register_tag_loader(SWF::REFLEX, reflex_loader); // 777
}
-// Create a movie_definition from a png stream
-// NOTE: this method assumes this *is* a png stream
+// Create a movie_definition from an image format stream
+// NOTE: this method assumes this *is* the format described in the
+// FileType type
// TODO: The pp won't display PNGs for SWF7 or below.
static movie_definition*
-createBitmapMovie(std::auto_ptr<IOChannel> in, const std::string& url,
FileType type)
+createBitmapMovie(std::auto_ptr<IOChannel> in, const std::string& url,
+ FileType type)
{
assert (in.get());
@@ -239,7 +250,9 @@
try
{
- std::auto_ptr<GnashImage> im(ImageInput::readImageData(imageData,
type));
+ std::auto_ptr<GnashImage> im(
+ ImageInput::readImageData(imageData, type));
+
if (!im.get())
{
log_error(_("Can't read image file from %s"), url);
@@ -258,102 +271,6 @@
}
-/// Get type of file looking at first bytes
-FileType
-getFileType(IOChannel* in)
-{
- in->seek(0);
-
- char buf[3];
-
- if (3 < in->read(buf, 3))
- {
- log_error(_("Can't read file header"));
- in->seek(0);
- return GNASH_FILETYPE_UNKNOWN;
- }
-
- // This is the magic number {0xff, 0xd8, 0xff} for JPEG format files
- if (std::equal(buf, buf + 3, "\xff\xd8\xff"))
- {
- in->seek(0);
- return GNASH_FILETYPE_JPEG;
- }
-
- // This is the magic number for any PNG format file
- // buf[3] == 'G' (we didn't read so far)
- if (std::equal(buf, buf + 3, "\x89PN"))
- {
- in->seek(0);
- return GNASH_FILETYPE_PNG;
- }
-
- // This is the magic number for any GIF format file
- if (std::equal(buf, buf + 3, "GIF"))
- {
- in->seek(0);
- return GNASH_FILETYPE_GIF;
- }
-
- // This is for SWF (FWS or CWS)
- if (std::equal(buf, buf + 3, "FWS") || std::equal(buf, buf + 3, "CWS"))
- {
- in->seek(0);
- return GNASH_FILETYPE_SWF;
- }
-
- // Take one guess at what this is. (It's an FLV-format file).
- if (std::equal(buf, buf + 3, "FLV")) {
- return GNASH_FILETYPE_FLV;
- }
-
- // Check if it is an swf embedded in a player (.exe-file)
- if (std::equal(buf, buf + 2, "MZ")) {
-
- if ( 3 < in->read(buf, 3) )
- {
- log_error(_("Can't read 3 bytes after an MZ (.exe) header"));
- in->seek(0);
- return GNASH_FILETYPE_UNKNOWN;
- }
-
- while ((buf[0]!='F' && buf[0]!='C') || buf[1]!='W' || buf[2]!='S')
- {
- buf[0] = buf[1];
- buf[1] = buf[2];
- buf[2] = in->read_byte();
- if (in->eof())
- {
- log_error(_("Could not find SWF inside an exe file"));
- in->seek(0);
- return GNASH_FILETYPE_UNKNOWN;
- }
- }
- in->seek(in->tell()-3); // position to start of the swf itself
- return GNASH_FILETYPE_SWF;
- }
-
- log_error("unknown file type, buf is %c%c%c", buf[0], buf[1], buf[2]);
- return GNASH_FILETYPE_UNKNOWN;
-}
-
-// Create a SWFMovieDefinition from an SWF stream
-// NOTE: this method assumes this *is* an SWF stream
-//
-static SWFMovieDefinition*
-create_swf_movie(std::auto_ptr<IOChannel> in, const std::string& url,
- const RunInfo& runInfo, bool startLoaderThread)
-{
-
- std::auto_ptr<SWFMovieDefinition> m (new SWFMovieDefinition(runInfo));
-
- const std::string& absURL = URL(url).str();
-
- if (!m->readHeader(in, absURL)) return 0;
- if (startLoaderThread && !m->completeLoad()) return 0;
-
- return m.release();
-}
movie_definition*
create_movie(std::auto_ptr<IOChannel> in, const std::string& url,
@@ -364,7 +281,7 @@
ensure_loaders_registered();
// see if it's a jpeg or an swf
- FileType type = getFileType(in.get());
+ FileType type = getFileType(*in);
switch (type)
{
@@ -384,11 +301,12 @@
case GNASH_FILETYPE_SWF:
- return create_swf_movie(in, url, runInfo, startLoaderThread);
+ return createSWFMovie(in, url, runInfo, startLoaderThread);
case GNASH_FILETYPE_FLV:
log_unimpl(_("FLV can't be loaded directly as a movie"));
return NULL;
+
default:
log_error(_("unknown file type (%s)"), type);
break;
@@ -429,13 +347,115 @@
}
+
+namespace {
+
+/// Get type of file looking at first bytes
+FileType
+getFileType(IOChannel& in)
+{
+ in.seek(0);
+
+ char buf[3];
+
+ if (3 < in.read(buf, 3))
+ {
+ log_error(_("Can't read file header"));
+ in.seek(0);
+ return GNASH_FILETYPE_UNKNOWN;
+ }
+
+ // This is the magic number {0xff, 0xd8, 0xff} for JPEG format files
+ if (std::equal(buf, buf + 3, "\xff\xd8\xff"))
+ {
+ in.seek(0);
+ return GNASH_FILETYPE_JPEG;
+ }
+
+ // This is the magic number for any PNG format file
+ // buf[3] == 'G' (we didn't read so far)
+ if (std::equal(buf, buf + 3, "\x89PN"))
+ {
+ in.seek(0);
+ return GNASH_FILETYPE_PNG;
+ }
+
+ // This is the magic number for any GIF format file
+ if (std::equal(buf, buf + 3, "GIF"))
+ {
+ in.seek(0);
+ return GNASH_FILETYPE_GIF;
+ }
+
+ // This is for SWF (FWS or CWS)
+ if (std::equal(buf, buf + 3, "FWS") || std::equal(buf, buf + 3, "CWS"))
+ {
+ in.seek(0);
+ return GNASH_FILETYPE_SWF;
+ }
+
+ // Take one guess at what this is. (It's an FLV-format file).
+ if (std::equal(buf, buf + 3, "FLV")) {
+ return GNASH_FILETYPE_FLV;
+ }
+
+ // Check if it is an swf embedded in a player (.exe-file)
+ if (std::equal(buf, buf + 2, "MZ")) {
+
+ if ( 3 < in.read(buf, 3) )
+ {
+ log_error(_("Can't read 3 bytes after an MZ (.exe) header"));
+ in.seek(0);
+ return GNASH_FILETYPE_UNKNOWN;
+ }
+
+ while ((buf[0]!='F' && buf[0]!='C') || buf[1]!='W' || buf[2]!='S')
+ {
+ buf[0] = buf[1];
+ buf[1] = buf[2];
+ buf[2] = in.read_byte();
+ if (in.eof())
+ {
+ log_error(_("Could not find SWF inside an exe file"));
+ in.seek(0);
+ return GNASH_FILETYPE_UNKNOWN;
+ }
+ }
+ in.seek(in.tell() - 3); // position to start of the swf itself
+ return GNASH_FILETYPE_SWF;
+ }
+
+ log_error("unknown file type, buf is %c%c%c", buf[0], buf[1], buf[2]);
+ return GNASH_FILETYPE_UNKNOWN;
+}
+
+// Create a SWFMovieDefinition from an SWF stream
+// NOTE: this method assumes this *is* an SWF stream
+//
+SWFMovieDefinition*
+createSWFMovie(std::auto_ptr<IOChannel> in, const std::string& url,
+ const RunInfo& runInfo, bool startLoaderThread)
+{
+
+ std::auto_ptr<SWFMovieDefinition> m (new SWFMovieDefinition(runInfo));
+
+ const std::string& absURL = URL(url).str();
+
+ if (!m->readHeader(in, absURL)) return 0;
+ if (startLoaderThread && !m->completeLoad()) return 0;
+
+ return m.release();
+}
+
+}
+
//
// global gnash management
//
+// Maximum release of resources.
void clear()
- // Maximum release of resources.
{
// Ideally, we should make sure that function properly signals all threads
// about exiting and giving them a chance to cleanly exit.
=== modified file 'libcore/parser/BitmapMovieDefinition.cpp'
--- a/libcore/parser/BitmapMovieDefinition.cpp 2008-10-27 16:05:13 +0000
+++ b/libcore/parser/BitmapMovieDefinition.cpp 2008-12-16 15:15:55 +0000
@@ -34,7 +34,7 @@
{
if ( _shapedef ) return _shapedef.get();
- _bitmap = new bitmap_character_def(_image);
+ _bitmap = gnash::render::createBitmapInfo(_image);
// It's possible for this to fail.
if (!_bitmap.get()) return 0;
=== modified file 'libcore/parser/BitmapMovieDefinition.h'
--- a/libcore/parser/BitmapMovieDefinition.h 2008-10-27 16:05:13 +0000
+++ b/libcore/parser/BitmapMovieDefinition.h 2008-12-16 15:15:55 +0000
@@ -22,7 +22,7 @@
#include "movie_definition.h" // for inheritance
#include "rect.h" // for composition
#include "BitmapMovieInstance.h" // for create_movie_instance
-#include "bitmap_character_def.h" // for destructor visibility by intrusive_ptr
+#include "BitmapInfo.h" // for destructor visibility by intrusive_ptr
#include "DynamicShape.h" // for destructor visibility by intrusive_ptr
#include "GnashImage.h"
@@ -30,9 +30,6 @@
#include <memory> // for auto_ptr
// Forward declarations
-namespace gnash {
- class bitmap_character_def;
-}
namespace gnash
{
@@ -51,7 +48,7 @@
std::auto_ptr<GnashImage> _image;
- boost::intrusive_ptr<bitmap_character_def> _bitmap;
+ boost::intrusive_ptr<BitmapInfo> _bitmap;
boost::intrusive_ptr<DynamicShape> _shapedef;
=== modified file 'libcore/parser/Makefile.am'
--- a/libcore/parser/Makefile.am 2008-11-07 18:07:45 +0000
+++ b/libcore/parser/Makefile.am 2008-12-16 15:15:55 +0000
@@ -48,7 +48,6 @@
libgnashparser_la_SOURCES = \
abc_block.cpp \
action_buffer.cpp \
- bitmap_character_def.cpp \
BitmapMovieDefinition.cpp \
character_def.cpp \
SWFMovieDefinition.cpp \
@@ -61,7 +60,6 @@
abc_block.h \
action_buffer.h \
character_def.h \
- bitmap_character_def.h \
BitmapMovieDefinition.h \
morph2_character_def.h \
movie_definition.h \
=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp 2008-12-04 07:28:59 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp 2008-12-16 15:15:55 +0000
@@ -35,7 +35,6 @@
#include "log.h"
#include "MovieClip.h"
#include "movie_instance.h"
-#include "bitmap_character_def.h"
#include "swf/TagLoadersTable.h"
#include "movie_root.h"
#include "VM.h" // for assertions
@@ -278,25 +277,20 @@
return 0;
}
-bitmap_character_def* SWFMovieDefinition::get_bitmap_character_def(int
character_id)
+BitmapInfo*
+SWFMovieDefinition::getBitmap(int character_id)
{
- BitmapMap::iterator it = m_bitmap_characters.find(character_id);
- if ( it == m_bitmap_characters.end() ) return NULL;
+ Bitmaps::iterator it = _bitmaps.find(character_id);
+ if ( it == _bitmaps.end() ) return 0;
else return it->second.get();
}
void
-SWFMovieDefinition::add_bitmap_character_def(int character_id,
- bitmap_character_def* ch)
+SWFMovieDefinition::addBitmap(int id, boost::intrusive_ptr<BitmapInfo> im)
{
- assert(ch);
- //log_debug(_("Add bitmap character %d"), character_id);
- //m_bitmap_characters.add(character_id, ch);
- m_bitmap_characters.insert(std::make_pair(character_id,
boost::intrusive_ptr<bitmap_character_def>(ch)));
+ assert(im);
+ _bitmaps.insert(std::make_pair(id, im));
- // we can *NOT* generate bitmap_info until
- // a renderer is present
- add_bitmap_info(ch->get_bitmap_info());
}
sound_sample* SWFMovieDefinition::get_sound_sample(int character_id)
@@ -880,16 +874,12 @@
i->second->setReachable();
}
- for (BitmapMap::const_iterator i=m_bitmap_characters.begin(),
e=m_bitmap_characters.end(); i!=e; ++i)
+ for (Bitmaps::const_iterator i = _bitmaps.begin(), e = _bitmaps.end();
+ i != e; ++i)
{
i->second->setReachable();
}
- for (BitmapVect::const_iterator i=m_bitmap_list.begin(),
e=m_bitmap_list.end(); i!=e; ++i)
- {
- (*i)->setReachable();
- }
-
for (SoundSampleMap::const_iterator i=m_sound_samples.begin(),
e=m_sound_samples.end(); i!=e; ++i)
{
i->second->setReachable();
=== modified file 'libcore/parser/SWFMovieDefinition.h'
--- a/libcore/parser/SWFMovieDefinition.h 2008-11-20 16:26:31 +0000
+++ b/libcore/parser/SWFMovieDefinition.h 2008-12-16 15:15:55 +0000
@@ -32,8 +32,6 @@
#include "IOChannel.h"
#include "movie_definition.h" // for inheritance
#include "character_def.h" // for boost::intrusive_ptr visibility of dtor
-#include "bitmap_character_def.h" // for boost::intrusive_ptr visibility of
dtor
-#include "SWFStream.h" // for get_bytes_loaded and visitbility of dtor
(composition)
#include "StringPredicates.h" // for case-insensitive string comparision
(ExportMap)
#include "utility.h" // for TWIPS_TO_PIXELS
#include "rect.h"
@@ -50,7 +48,8 @@
// Forward declarations
namespace gnash {
class SWFMovieDefinition;
- class movie_root;
+ class SWFStream;
+ class movie_root;
class MovieClip;
class movie_instance;
namespace SWF {
@@ -231,23 +230,6 @@
return m_file_length;
}
- /// All bitmap_info's used by this movie should be
- /// registered with this API.
- virtual void add_bitmap_info(bitmap_info* bi)
- {
- m_bitmap_list.push_back(bi);
- }
-
- virtual int get_bitmap_info_count() const
- {
- return m_bitmap_list.size();
- }
-
- virtual bitmap_info* get_bitmap_info(int i) const
- {
- return m_bitmap_list[i].get();
- }
-
// See docs in movie_definition.h
virtual void export_resource(const std::string& symbol,
ExportableResource* res);
@@ -285,10 +267,10 @@
Font* get_font(const std::string& name, bool bold, bool italic) const;
// See dox in movie_definition.h
- bitmap_character_def* get_bitmap_character_def(int character_id);
+ BitmapInfo* getBitmap(int character_id);
// See dox in movie_definition.h
- void add_bitmap_character_def(int character_id,
bitmap_character_def* ch);
+ void addBitmap(int character_id, boost::intrusive_ptr<BitmapInfo> im);
// See dox in movie_definition.h
sound_sample* get_sound_sample(int character_id);
@@ -450,9 +432,8 @@
typedef std::map<int, boost::intrusive_ptr<Font> > FontMap;
FontMap m_fonts;
- typedef std::map<int, boost::intrusive_ptr<bitmap_character_def> >
- BitmapMap;
- BitmapMap m_bitmap_characters;
+ typedef std::map<int, boost::intrusive_ptr<BitmapInfo> > Bitmaps;
+ Bitmaps _bitmaps;
typedef std::map<int, boost::intrusive_ptr<sound_sample> >
SoundSampleMap;
SoundSampleMap m_sound_samples;
@@ -481,11 +462,6 @@
typedef std::vector<boost::intrusive_ptr<movie_definition> > ImportVect;
ImportVect m_import_source_movies;
- /// Bitmaps used in this movie; collected in one place to make
- /// it possible for the host to manage them as textures.
- typedef std::vector<boost::intrusive_ptr<bitmap_info> > BitmapVect;
- BitmapVect m_bitmap_list;
-
rect m_frame_size;
float m_frame_rate;
size_t m_frame_count;
@@ -574,7 +550,7 @@
//
/// Reachable resources are:
/// - fonts (m_fonts)
- /// - bitmap characters (m_bitmap_characters)
+ /// - bitmaps (_bitmaps)
/// - bitmaps (m_bitmap_list) [ what's the difference with bitmap
/// characters ?? ]
/// - sound samples (m_sound_samples)
=== removed file 'libcore/parser/bitmap_character_def.cpp'
--- a/libcore/parser/bitmap_character_def.cpp 2008-10-27 16:05:13 +0000
+++ b/libcore/parser/bitmap_character_def.cpp 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-//
-// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#include "bitmap_character_def.h"
-#include "gnash.h" // for bitmap_info
-#include "render.h" // createBitmapInfo
-#include "GnashImage.h" // GnashImage
-
-#include <vector>
-#include <string>
-#include <cassert>
-#include <memory> // for auto_ptr
-
-
-namespace gnash {
-
-bitmap_character_def::bitmap_character_def(std::auto_ptr<GnashImage> image)
- :
- _bitmap_info ( gnash::render::createBitmapInfo(image) )
-{
-}
-
-} // namespace gnash
=== removed file 'libcore/parser/bitmap_character_def.h'
--- a/libcore/parser/bitmap_character_def.h 2008-12-16 06:45:58 +0000
+++ b/libcore/parser/bitmap_character_def.h 1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
-//
-// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-#ifndef GNASH_BITMAP_CHARACTER_DEF_H
-#define GNASH_BITMAP_CHARACTER_DEF_H
-
-#include "smart_ptr.h" // GNASH_USE_GC
-#include "gnash.h" // for bitmap_info definition
-#include "ref_counted.h" // for character_def inheritance
-#include "smart_ptr.h"
-#include "bitmap_info.h" // for dtor visibility by intrusive_ptr
-#include "GC.h" // for GcResource (markReachableResources)
-
-#include <cassert>
-#include <memory> // for auto_ptr
-
-
-namespace gnash {
- class GnashImage;
-}
-
-namespace gnash {
-
-/// Definition of a bitmap character
-//
-/// This includes:
-///
-/// - SWF::DEFINEBITS
-/// - SWF::DEFINEBITSJPEG2
-/// - SWF::DEFINEBITSJPEG3
-/// - SWF::DEFINELOSSLESS
-/// - SWF::DEFINELOSSLESS2
-///
-/// The definition currently only takes an ImageRGB
-/// or ImageRGBA pointer. We should probably move
-/// the methods for actually reading such tags instead.
-///
-/// One problem with this class is that it relies on the
-/// availability of a render_handler in order to transform
-/// ImageRGB or image::ImageRGBA to a bitmap_info.
-///
-class bitmap_character_def : public ref_counted
-{
-
-public:
-
- /// Construct a bitmap_character_def from an ImageRGB
- //
- /// NOTE: uses currently registered render_handler to
- /// create a bitmap_info, don't call before a renderer
- /// has been registered
- ///
- bitmap_character_def(std::auto_ptr<GnashImage> image);
-
- bitmap_info* get_bitmap_info() {
- return _bitmap_info.get();
- }
-
-protected:
-
-#ifdef GNASH_USE_GC
- /// Mark reachable resources (for GC)
- //
- /// Reachable resources are:
- /// - bitmap info (_bitmap_info)
- ///
- void markReachableResources() const
- {
- if ( _bitmap_info ) _bitmap_info->setReachable();
- }
-#endif // GNASH_USE_GC
-
-private:
-
- boost::intrusive_ptr<bitmap_info> _bitmap_info;
-};
-
-
-
-} // end namespace gnash
-
-
-#endif // GNASH_BITMAP_CHARACTER_DEF_H
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
=== modified file 'libcore/parser/movie_definition.h'
--- a/libcore/parser/movie_definition.h 2008-11-20 16:26:31 +0000
+++ b/libcore/parser/movie_definition.h 2008-12-16 15:15:55 +0000
@@ -61,8 +61,7 @@
// Forward declarations
namespace gnash {
- class bitmap_character_def;
- class bitmap_info;
+ class BitmapInfo;
class movie_instance;
class MovieClip;
class ControlTag;
@@ -139,10 +138,6 @@
}
- virtual int get_bitmap_info_count() const { return 0; }
-
- virtual bitmap_info* get_bitmap_info(int /*i*/) const { return NULL; }
-
/// Return the list of execute tags for given frame number
//
/// @param frame_number
@@ -325,31 +320,30 @@
}
/// \brief
- /// Get a bitmap character from the dictionary.
+ /// Get a bitmap from the bitmap dictionary.
//
/// Note that only top-level movies (those belonging to a single
- /// SWF stream) have a characters dictionary, thus our
+ /// SWF stream) have a bitmap dictionary, thus our
/// SWFMovieDefinition. The other derived class, sprite_definition
- /// will seek for characters in it's base SWFMovieDefinition.
+ /// will seek for characters in its base SWFMovieDefinition.
///
- /// @return NULL if no character with the given ID is found, or
+ /// @return 0 if no character with the given ID is found, or
/// if the corresponding character is not a bitmap.
///
- /// The default implementation returns NULL.
+ /// The default implementation returns 0.
///
- virtual bitmap_character_def* get_bitmap_character_def(int
/*character_id*/)
+ virtual BitmapInfo* getBitmap(int /*character_id*/)
{
- return NULL;
+ return 0;
}
/// \brief
/// Add a bitmap character in the dictionary, with the specified
/// character id.
//
- /// The default implementation is a no-op
+ /// The default implementation is a no-op (deletes the image data).
///
- virtual void add_bitmap_character_def(int /*character_id*/,
- bitmap_character_def* /*ch*/)
+ virtual void addBitmap(int /*id*/, boost::intrusive_ptr<BitmapInfo>
/*im*/)
{
}
@@ -412,22 +406,6 @@
/// \brief
- /// All bitmap_info's used by this movie should be
- /// registered with this API.
- //
- /// This was likely used for 'caching' renderer-specific
- /// versions of bitmaps. I'm not sure it is really needed
- /// currently (caching on disk is broken).
- ///
- /// The default implementation is a no-op
- ///
- virtual void add_bitmap_info(bitmap_info* /*ch*/)
- {
- }
-
- // ...
-
- /// \brief
/// Return the URL of the SWF stream this definition has been read
/// from.
virtual const std::string& get_url() const = 0;
=== modified file 'libcore/parser/sprite_definition.h'
--- a/libcore/parser/sprite_definition.h 2008-11-20 16:26:31 +0000
+++ b/libcore/parser/sprite_definition.h 2008-12-16 15:15:55 +0000
@@ -160,14 +160,13 @@
}
/// Delegate call to associated root movie
- virtual bitmap_character_def* get_bitmap_character_def(int id)
+ virtual BitmapInfo* getBitmap(int id)
{
- return m_movie_def.get_bitmap_character_def(id);
+ return m_movie_def.getBitmap(id);
}
/// Overridden just for complaining about malformed SWF
- virtual void add_bitmap_character_def(int /*id*/,
- bitmap_character_def* /*ch*/)
+ virtual void addBitmap(int /*id*/, boost::intrusive_ptr<BitmapInfo>
/*im*/)
{
IF_VERBOSE_MALFORMED_SWF (
log_swferror(_("add_bitmap_character_def appears in sprite
tags"));
=== modified file 'libcore/render.cpp'
--- a/libcore/render.cpp 2008-10-27 16:05:13 +0000
+++ b/libcore/render.cpp 2008-12-16 15:15:55 +0000
@@ -48,21 +48,21 @@
namespace render
{
- /// A fake bitmap_info created when no renderer
+ /// A fake BitmapInfo created when no renderer
/// is registered.
///
/// Note that if you register a renderer *after* one of
- /// these bogus bitmap_info has been created and attached
+ /// these bogus BitmapInfo has been created and attached
/// as the cache of a movie element, things would likely
/// screw up.
///
- class bogus_bi : public bitmap_info
+ class bogus_bi : public BitmapInfo
{
public:
bogus_bi() {}
};
- bitmap_info* createBitmapInfo(std::auto_ptr<GnashImage> im)
+ BitmapInfo* createBitmapInfo(std::auto_ptr<GnashImage> im)
{
if (!s_render_handler)
=== modified file 'libcore/render.h'
--- a/libcore/render.h 2008-10-27 16:05:13 +0000
+++ b/libcore/render.h 2008-12-16 15:15:55 +0000
@@ -54,7 +54,7 @@
namespace render
{
/// See render_handler::create_bitmap_info_rgb (in
backend/render_handler.h)
- bitmap_info* createBitmapInfo(std::auto_ptr<GnashImage> im);
+ BitmapInfo* createBitmapInfo(std::auto_ptr<GnashImage> im);
/// See render_handler::drawVideoFrame (in
backend/render_handler.h)
void drawVideoFrame(GnashImage* frame, const SWFMatrix* mat,
const rect* bounds);
=== modified file 'libcore/styles.cpp'
--- a/libcore/styles.cpp 2008-09-04 15:32:42 +0000
+++ b/libcore/styles.cpp 2008-12-16 12:20:22 +0000
@@ -14,6 +14,7 @@
#include "movie_definition.h"
#include "swf.h"
#include "GnashException.h"
+#include "fill_style.h"
namespace gnash {
=== modified file 'libcore/styles.h'
--- a/libcore/styles.h 2008-10-20 17:06:14 +0000
+++ b/libcore/styles.h 2008-12-16 15:15:55 +0000
@@ -11,8 +11,6 @@
#include "impl.h"
#include "RGBA.h"
-#include "bitmap_character_def.h"
-#include "fill_style.h"
namespace gnash {
=== modified file 'libcore/swf/TextRecord.cpp'
--- a/libcore/swf/TextRecord.cpp 2008-11-09 12:44:18 +0000
+++ b/libcore/swf/TextRecord.cpp 2008-12-16 12:20:22 +0000
@@ -24,6 +24,7 @@
#include "swf.h"
#include "log.h"
#include "render.h"
+#include "fill_style.h"
#include "Font.h"
#include <vector>
=== modified file 'libcore/swf/tag_loaders.cpp'
--- a/libcore/swf/tag_loaders.cpp 2008-12-16 09:58:40 +0000
+++ b/libcore/swf/tag_loaders.cpp 2008-12-16 15:15:55 +0000
@@ -55,6 +55,9 @@
#include "SimpleBuffer.h"
#include "sound_handler.h"
+// TODO: pass the render handler with RunInfo and use that.
+#include "render.h"
+
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
@@ -261,7 +264,8 @@
catch (std::exception& e)
{
IF_VERBOSE_MALFORMED_SWF(
- log_swferror("Error creating header-only jpeg2 input: %s",
e.what());
+ log_swferror("Error creating header-only jpeg2 input: %s",
+ e.what());
);
return;
}
@@ -282,6 +286,15 @@
in.ensureBytes(2);
boost::uint16_t character_id = in.read_u16();
+ if (m.getBitmap(character_id))
+ {
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror(_("DEFINEBITS: Duplicate id (%d) for bitmap character "
+ "- discarding it"), character_id);
+ );
+ return;
+ }
+
// Read the image data.
JpegImageInput* j_in = m.get_jpeg_loader();
if ( ! j_in )
@@ -309,20 +322,10 @@
return;
}
-
- boost::intrusive_ptr<bitmap_character_def> ch = new
bitmap_character_def(im);
-
- if ( m.get_bitmap_character_def(character_id) )
- {
- IF_VERBOSE_MALFORMED_SWF(
- log_swferror(_("DEFINEBITS: Duplicate id (%d) for bitmap character "
- "- discarding it"), character_id);
- );
- }
- else
- {
- m.add_bitmap_character_def(character_id, ch.get());
- }
+ boost::intrusive_ptr<BitmapInfo> bi = render::createBitmapInfo(im);
+
+ // add bitmap to movie under character id.
+ m.addBitmap(character_id, bi);
}
@@ -341,26 +344,29 @@
character_id, in.tell());
);
- // Read the image data.
- if ( m.get_bitmap_character_def(character_id) )
+
+ if ( m.getBitmap(character_id) )
{
IF_VERBOSE_MALFORMED_SWF(
log_swferror(_("DEFINEBITSJPEG2: Duplicate id (%d) for bitmap "
"character - discarding it"), character_id);
);
- }
- else
- {
- boost::shared_ptr<IOChannel> ad( StreamAdapter::getFile(in,
- in.get_tag_end_position()).release() );
-
- std::auto_ptr<GnashImage> im (ImageInput::readImageData(ad,
- GNASH_FILETYPE_JPEG));
-
- boost::intrusive_ptr<bitmap_character_def> ch =
- new bitmap_character_def(im);
- m.add_bitmap_character_def(character_id, ch.get());
- }
+ return;
+ }
+
+ // Read the image data.else
+
+ boost::shared_ptr<IOChannel> ad( StreamAdapter::getFile(in,
+ in.get_tag_end_position()).release() );
+
+ std::auto_ptr<GnashImage> im (ImageInput::readImageData(ad,
+ GNASH_FILETYPE_JPEG));
+
+ boost::intrusive_ptr<BitmapInfo> bi = render::createBitmapInfo(im);
+
+ // add bitmap to movie under character id.
+ m.addBitmap(character_id, bi);
+
}
@@ -501,11 +507,11 @@
// ea8bbad50ccbc52dd734dfc93a7f06a7 6964trev3c.swf
im->mergeAlpha(buffer.get(), bufferLength);
- // Create bitmap character.
- boost::intrusive_ptr<bitmap_character_def> ch =
- new bitmap_character_def(static_cast<std::auto_ptr<GnashImage>
>(im));
+ boost::intrusive_ptr<BitmapInfo> bi =
+ render::createBitmapInfo(static_cast<std::auto_ptr<GnashImage> >(im));
- m.add_bitmap_character_def(character_id, ch.get());
+ // add bitmap to movie under character id.
+ m.addBitmap(character_id, bi);
#endif
}
@@ -542,7 +548,7 @@
// No need to parse any further if it already exists, as we aren't going
// to add it.
- if ( m.get_bitmap_character_def(character_id) )
+ if (m.getBitmap(character_id))
{
IF_VERBOSE_MALFORMED_SWF(
log_swferror(_("DEFINEBITSLOSSLESS: Duplicate id (%d) "
@@ -614,22 +620,23 @@
case 3:
{
// 8-bit data, preceded by a palette.
- boost::uint8_t* color_table = buffer.get();
+ boost::uint8_t* colorTable = buffer.get();
for (int j = 0; j < height; j++)
{
- boost::uint8_t* image_in_row = buffer.get() +
+ boost::uint8_t* inRow = buffer.get() +
colorTableSize * channels + j * pitch;
- boost::uint8_t* image_out_row = image->scanline(j);
+ boost::uint8_t* outRow = image->scanline(j);
for (int i = 0; i < width; i++)
{
- boost::uint8_t pixel = image_in_row[i * bytes_per_pixel];
- image_out_row[i * channels + 0] = color_table[pixel *
channels + 0];
- image_out_row[i * channels + 1] = color_table[pixel *
channels + 1];
- image_out_row[i * channels + 2] = color_table[pixel *
channels + 2];
+ boost::uint8_t pixel = inRow[i * bytes_per_pixel];
+ outRow[i * channels + 0] = colorTable[pixel * channels +
0];
+ outRow[i * channels + 1] = colorTable[pixel * channels +
1];
+ outRow[i * channels + 2] = colorTable[pixel * channels +
2];
if (alpha) {
- image_out_row[i * channels + 3] = color_table[pixel *
channels + 3];
+ outRow[i * channels + 3] =
+ colorTable[pixel * channels + 3];
}
}
}
@@ -641,23 +648,24 @@
for (int j = 0; j < height; j++)
{
- boost::uint8_t* image_in_row = buffer.get() + j * pitch;
- boost::uint8_t* image_out_row = image->scanline(j);
+ boost::uint8_t* inRow = buffer.get() + j * pitch;
+ boost::uint8_t* outRow = image->scanline(j);
for (int i = 0; i < width; i++)
{
- boost::uint16_t pixel = image_in_row[i * 2] |
- (image_in_row[i * 2 + 1] << 8);
+ boost::uint16_t pixel = inRow[i * 2] |
+ (inRow[i * 2 + 1] << 8);
- // How is the data packed??? Whoever wrote this was just
guessing
- // here that it's 565!
- image_out_row[i * channels + 0] = (pixel >> 8) & 0xF8;
// red
- image_out_row[i * channels + 1] = (pixel >> 3) & 0xFC;
// green
- image_out_row[i * channels + 2] = (pixel << 3) & 0xF8;
// blue
+ // How is the data packed??? Whoever wrote this was
+ // just guessing here that it's 565!
+ outRow[i * channels + 0] = (pixel >> 8) & 0xF8; // red
+ outRow[i * channels + 1] = (pixel >> 3) & 0xFC; // green
+ outRow[i * channels + 2] = (pixel << 3) & 0xF8; // blue
- // This was saved to the first byte before, but that can
hardly be correct.
+ // This was saved to the first byte before, but that
+ // can hardly be correct.
// Real examples of this format are rare to non-existent.
if (alpha) {
- image_out_row[i * channels + 3] = 255;
+ outRow[i * channels + 3] = 255;
}
}
}
@@ -674,8 +682,9 @@
for (int i = 0; i < width; ++i)
{
// Copy pixels 1-3.
- std::copy(&inRow[i * inChannels + 1], &inRow[i *
inChannels + 4],
- &outRow[i * channels]);
+ std::copy(&inRow[i * inChannels + 1],
+ &inRow[i * inChannels + 4], &outRow[i * channels]);
+
// Add the alpha channel if necessary.
if (alpha) {
outRow[i * channels + 3] = inRow[i * 4];
@@ -686,12 +695,10 @@
}
-
- boost::intrusive_ptr<bitmap_character_def> ch =
- new bitmap_character_def(image);
-
- // add image to movie, under character id.
- m.add_bitmap_character_def(character_id, ch.get());
+ boost::intrusive_ptr<BitmapInfo> bi = render::createBitmapInfo(image);
+
+ // add bitmap to movie under character id.
+ m.addBitmap(character_id, bi);
#endif // HAVE_ZLIB_H
}
@@ -699,7 +706,6 @@
// This is like null_loader except it prints a message to nag us to fix it.
void
fixme_loader(SWFStream& /*in*/, tag_type tag, movie_definition& /*m*/,
-
const RunInfo& /*r*/)
{
static std::map<tag_type, bool> warned;
@@ -724,7 +730,7 @@
log_parse(_(" shape_loader: id = %d"), character_id);
);
- shape_character_def* ch = new shape_character_def;
+ shape_character_def* ch = new shape_character_def;
ch->read(in, tag, true, m);
m.add_character(character_id, ch);
@@ -796,14 +802,6 @@
}
-
-//
-// end_tag
-//
-
-// end_tag doesn't actually need to exist.
-
-
//
// export
//
@@ -830,7 +828,8 @@
dynamic_cast<SWFMovieDefinition&>(m);
}
catch (std::bad_cast& e) {
- log_swferror(_("EXPORT tag inside DEFINESPRITE. Will export in
top-level symbol table."));
+ log_swferror(_("EXPORT tag inside DEFINESPRITE. Will export in "
+ "top-level symbol table."));
}
);
@@ -1418,26 +1417,4 @@
// indent-tabs-mode: t
// End:
-
-
-// VC6 is a recognized pile of crap and no one should
-// worry about trying to support it.
-
-class in_stream
-{
-public:
- const unsigned char* m_in_data;
- int m_current_bits;
- int m_unused_bits;
-
- in_stream(const unsigned char* data)
- :
- m_in_data(data),
- m_current_bits(0),
- m_unused_bits(0)
- {
- }
-};
-
-
} // namespace gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10444: Cut out one of the classes involved in bitmap storage and display.,
Benjamin Wolsey <=