[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10802: Drop the prophelper file and
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10802: Drop the prophelper file and write the filter classes out instead, so they |
Date: |
Thu, 16 Apr 2009 19:33:49 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10802
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-04-16 19:33:49 +0200
message:
Drop the prophelper file and write the filter classes out instead, so they
can be implemented and tested properly.
removed:
libcore/asobj/prophelper.h
modified:
libcore/ConvolutionFilter.h
libcore/DisplayObject.cpp
libcore/MovieClip.cpp
libcore/as_environment.cpp
libcore/asobj/Color_as.cpp
libcore/asobj/Makefile.am
libcore/asobj/flash/filters/BevelFilter_as.cpp
libcore/asobj/flash/filters/BitmapFilter_as.cpp
libcore/asobj/flash/filters/BlurFilter_as.cpp
libcore/asobj/flash/filters/ColorMatrixFilter_as.cpp
libcore/asobj/flash/filters/ConvolutionFilter_as.cpp
libcore/asobj/flash/filters/DropShadowFilter_as.cpp
libcore/asobj/flash/filters/GlowFilter_as.cpp
libcore/asobj/flash/filters/GradientBevelFilter_as.cpp
libcore/asobj/flash/filters/GradientGlowFilter_as.cpp
libcore/parser/SWFMovieDefinition.cpp
libcore/parser/filter_factory.cpp
libcore/vm/ASHandlers.cpp
------------------------------------------------------------
revno: 10799.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 13:44:18 +0200
message:
Tidy up.
modified:
libcore/parser/SWFMovieDefinition.cpp
------------------------------------------------------------
revno: 10799.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 14:04:53 +0200
message:
Cleanups.
modified:
libcore/vm/ASHandlers.cpp
------------------------------------------------------------
revno: 10799.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 14:11:44 +0200
message:
Don't use find_first_of() when we mean find().
modified:
libcore/as_environment.cpp
libcore/asobj/Color_as.cpp
------------------------------------------------------------
revno: 10799.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 14:33:43 +0200
message:
Tidy some functions up.
modified:
libcore/DisplayObject.cpp
libcore/MovieClip.cpp
------------------------------------------------------------
revno: 10799.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 16:32:04 +0200
message:
Don't use prophelper for ConvolutionFilter.
modified:
libcore/ConvolutionFilter.h
libcore/asobj/flash/filters/ConvolutionFilter_as.cpp
libcore/parser/filter_factory.cpp
------------------------------------------------------------
revno: 10799.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 16:42:17 +0200
message:
Don't use prophelper for BevelFilter.
modified:
libcore/asobj/flash/filters/BevelFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 16:47:26 +0200
message:
Don't use prophelper for BitmapFilter.
modified:
libcore/asobj/flash/filters/BitmapFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.9
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 16:56:56 +0200
message:
Don't use prophelper for BlurFilter.
modified:
libcore/asobj/flash/filters/BlurFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.10
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 17:06:59 +0200
message:
Don't use prophelper for GradientGlowFilter.
modified:
libcore/asobj/flash/filters/GradientGlowFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.11
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 17:16:22 +0200
message:
Don't use prophelper for ColorMatrixFilter.
modified:
libcore/asobj/flash/filters/ColorMatrixFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.12
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 17:27:36 +0200
message:
Don't use prophelper for GradientBevelFilter.
modified:
libcore/asobj/flash/filters/GradientBevelFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.13
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 18:16:43 +0200
message:
Don't use prophelper for GlowFilter.
modified:
libcore/asobj/flash/filters/GlowFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.14
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 18:56:54 +0200
message:
Don't use prophelper for DropShadowFilter.
modified:
libcore/asobj/flash/filters/DropShadowFilter_as.cpp
------------------------------------------------------------
revno: 10799.1.15
committer: Benjamin Wolsey <address@hidden>
branch nick: temp
timestamp: Thu 2009-04-16 18:57:06 +0200
message:
Drop the prophelper abomination so that the filter classes can be improved
and made to work.
removed:
libcore/asobj/prophelper.h
modified:
libcore/asobj/Makefile.am
=== modified file 'libcore/ConvolutionFilter.h'
--- a/libcore/ConvolutionFilter.h 2009-02-25 22:33:03 +0000
+++ b/libcore/ConvolutionFilter.h 2009-04-16 14:32:04 +0000
@@ -30,35 +30,51 @@
class ConvolutionFilter : public BitmapFilter
{
public:
- // Fill from a SWFStream. See parser/filter_factory.cpp for the
implementations.
+ // Fill from a SWFStream. See parser/filter_factory.cpp for
+ // the implementations.
virtual bool read(SWFStream& in);
- virtual ~ConvolutionFilter() { return; }
+ virtual ~ConvolutionFilter() {}
- ConvolutionFilter() :
- m_matrixX(), m_matrixY(), m_matrix(), m_divisor(), m_bias(),
- m_preserveAlpha(false), m_clamp(false), m_color(), m_alpha()
- { return; }
+ ConvolutionFilter()
+ :
+ _matrixX(),
+ _matrixY(),
+ _matrix(),
+ _divisor(),
+ _bias(),
+ _preserveAlpha(false),
+ _clamp(false),
+ _color(),
+ _alpha()
+ {}
ConvolutionFilter(boost::uint8_t matrixX, boost::uint8_t matrixY,
- std::vector<float> a_matrix,
- float divisor, float bias, bool preserveAlpha, bool clamp,
boost::uint32_t color,
- boost::uint8_t alpha) :
- m_matrixX(matrixX), m_matrixY(matrixY), m_matrix(a_matrix),
- m_divisor(divisor), m_bias(bias), m_preserveAlpha(preserveAlpha),
- m_clamp(clamp), m_color(color), m_alpha(alpha)
- { return; }
+ const std::vector<float>& _matrix, float divisor, float bias,
+ bool preserveAlpha, bool clamp, boost::uint32_t color,
+ boost::uint8_t alpha)
+ :
+ _matrixX(matrixX),
+ _matrixY(matrixY),
+ _matrix(_matrix),
+ _divisor(divisor),
+ _bias(bias),
+ _preserveAlpha(preserveAlpha),
+ _clamp(clamp),
+ _color(color),
+ _alpha(alpha)
+ {}
protected:
- boost::uint8_t m_matrixX; // Number of columns
- boost::uint8_t m_matrixY; // Number of rows
- std::vector<float> m_matrix; // The convolution matrix
- float m_divisor;
- float m_bias;
- bool m_preserveAlpha; // If true, don't convolute the alpha channel
- bool m_clamp; // Whether or not to clamp
- boost::uint32_t m_color; // For off-image pixels
- boost::uint8_t m_alpha; // For off-image pixels
+ boost::uint8_t _matrixX; // Number of columns
+ boost::uint8_t _matrixY; // Number of rows
+ std::vector<float> _matrix; // The convolution matrix
+ float _divisor;
+ float _bias;
+ bool _preserveAlpha; // If true, don't convolute the alpha channel
+ bool _clamp; // Whether or not to clamp
+ boost::uint32_t _color; // For off-image pixels
+ boost::uint8_t _alpha; // For off-image pixels
};
} // Namespace gnash
=== modified file 'libcore/DisplayObject.cpp'
--- a/libcore/DisplayObject.cpp 2009-04-15 05:33:51 +0000
+++ b/libcore/DisplayObject.cpp 2009-04-16 12:33:43 +0000
@@ -1224,10 +1224,7 @@
const DisplayObject* parent = ch->get_parent();
// Don't push the _root name on the stack
- if ( ! parent )
- {
- // it is completely legal to set root's _name
- //assert(ch->get_name().empty());
+ if (!parent) {
topLevel = ch;
break;
}
@@ -1238,8 +1235,7 @@
assert(topLevel);
- if ( path.empty() )
- {
+ if (path.empty()) {
if (&_vm.getRoot().getRootMovie() == this) return "/";
std::stringstream ss;
ss << "_level" << m_depth-DisplayObject::staticDepthOffset;
@@ -1248,20 +1244,16 @@
// Build the target string from the parents stack
std::string target;
- if (topLevel != &_vm.getRoot().getRootMovie() )
- {
+ if (topLevel != &_vm.getRoot().getRootMovie()) {
std::stringstream ss;
- ss << "_level" <<
topLevel->get_depth()-DisplayObject::staticDepthOffset;
+ ss << "_level" <<
+ topLevel->get_depth() - DisplayObject::staticDepthOffset;
target = ss.str();
}
- for ( Path::reverse_iterator
- it=path.rbegin(), itEnd=path.rend();
- it != itEnd;
- ++it )
- {
+ for (Path::reverse_iterator it=path.rbegin(), itEnd=path.rend();
+ it != itEnd; ++it) {
target += "/" + *it;
}
-
return target;
}
@@ -1269,9 +1261,6 @@
std::string
DisplayObject::getTargetPath() const
{
-
- // TODO: maybe cache computed target?
-
return computeTargetPath();
}
@@ -1295,23 +1284,21 @@
const DisplayObject* parent = ch->get_parent();
// Don't push the _root name on the stack
- if ( ! parent )
- {
+ if (!parent) {
+
std::stringstream ss;
- if (!dynamic_cast<const Movie*>(ch))
- {
+ 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" <<
ch->get_depth()-DisplayObject::staticDepthOffset;
+ else {
+ ss << "_level" <<
+ ch->get_depth() - DisplayObject::staticDepthOffset;
path.push_back(ss.str());
}
break;
@@ -1321,16 +1308,14 @@
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 )
- {
- if ( ! target.empty() ) target += ".";
+ for (Path::const_reverse_iterator it=path.rbegin(), itEnd=path.rend();
+ it != itEnd; ++it) {
+
+ if (!target.empty()) target += ".";
target += *it;
}
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2009-04-15 06:44:13 +0000
+++ b/libcore/MovieClip.cpp 2009-04-16 12:33:43 +0000
@@ -3786,10 +3786,9 @@
as_value
movieclip_getInstanceAtDepth(const fn_call& fn)
{
- boost::intrusive_ptr<MovieClip> movieclip =
- ensureType<MovieClip>(fn.this_ptr);
+ boost::intrusive_ptr<MovieClip> mc = ensureType<MovieClip>(fn.this_ptr);
- if ( fn.nargs < 1 )
+ if (fn.nargs < 1)
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("MovieClip.getInstanceAtDepth(): missing depth argument");
@@ -3798,8 +3797,10 @@
}
int depth = fn.arg(0).to_int();
- boost::intrusive_ptr<DisplayObject> ch =
movieclip->getDisplayObjectAtDepth(depth);
- if ( ! ch ) return as_value(); // we want 'undefined', not 'null'
+ boost::intrusive_ptr<DisplayObject> ch =
mc->getDisplayObjectAtDepth(depth);
+
+ // we want 'undefined', not 'null'
+ if (!ch) return as_value();
return as_value(ch.get());
}
=== modified file 'libcore/as_environment.cpp'
--- a/libcore/as_environment.cpp 2009-04-07 09:49:53 +0000
+++ b/libcore/as_environment.cpp 2009-04-16 12:11:44 +0000
@@ -102,7 +102,8 @@
else
{
// TODO: have this checked by parse_path as an optimization
- if ( varname.find_first_of('/') != std::string::npos &&
varname.find_first_of(':') == std::string::npos )
+ if (varname.find('/') != std::string::npos &&
+ varname.find(':') == std::string::npos)
{
// Consider it all a path ...
as_object* target = find_object(varname, &scopeStack);
=== modified file 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color_as.cpp 2009-04-03 09:18:40 +0000
+++ b/libcore/asobj/Color_as.cpp 2009-04-16 12:11:44 +0000
@@ -98,8 +98,7 @@
void setTransform(const cxform& newTrans)
{
- if ( ! checkSprite() ) return;
-
+ if (!checkSprite()) return;
_sprite->set_user_cxform(newTrans);
}
@@ -343,14 +342,14 @@
#ifdef GNASH_DEBUG_COLOR
std::stringstream ss;
as_value tmp;
- if ( trans->get_member(st.find("ra"), &tmp) ) ss << " ra:" <<
tmp.to_number();
- if ( trans->get_member(st.find("ga"), &tmp) ) ss << " ga:" <<
tmp.to_number();
- if ( trans->get_member(st.find("ba"), &tmp) ) ss << " ba:" <<
tmp.to_number();
- if ( trans->get_member(st.find("aa"), &tmp) ) ss << " aa:" <<
tmp.to_number();
- if ( trans->get_member(st.find("rb"), &tmp) ) ss << " rb:" <<
tmp.to_number();
- if ( trans->get_member(st.find("gb"), &tmp) ) ss << " gb:" <<
tmp.to_number();
- if ( trans->get_member(st.find("bb"), &tmp) ) ss << " bb:" <<
tmp.to_number();
- if ( trans->get_member(st.find("ab"), &tmp) ) ss << " ab:" <<
tmp.to_number();
+ if (trans->get_member(st.find("ra"), &tmp)) ss << " ra:" <<
tmp.to_number();
+ if (trans->get_member(st.find("ga"), &tmp)) ss << " ga:" <<
tmp.to_number();
+ if (trans->get_member(st.find("ba"), &tmp)) ss << " ba:" <<
tmp.to_number();
+ if (trans->get_member(st.find("aa"), &tmp)) ss << " aa:" <<
tmp.to_number();
+ if (trans->get_member(st.find("rb"), &tmp)) ss << " rb:" <<
tmp.to_number();
+ if (trans->get_member(st.find("gb"), &tmp)) ss << " gb:" <<
tmp.to_number();
+ if (trans->get_member(st.find("bb"), &tmp)) ss << " bb:" <<
tmp.to_number();
+ if (trans->get_member(st.find("ab"), &tmp)) ss << " ab:" <<
tmp.to_number();
log_debug("Color.setTransform(%s) : TESTING", ss.str());
#endif
=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2009-03-04 18:42:49 +0000
+++ b/libcore/asobj/Makefile.am 2009-04-16 16:57:06 +0000
@@ -135,7 +135,6 @@
Number_as.h \
Object.h \
PlayHead.h \
- prophelper.h \
Selection_as.h \
SharedObject_as.h \
Sound_as.h \
=== modified file 'libcore/asobj/flash/filters/BevelFilter_as.cpp'
--- a/libcore/asobj/flash/filters/BevelFilter_as.cpp 2009-02-25 22:33:03
+0000
+++ b/libcore/asobj/flash/filters/BevelFilter_as.cpp 2009-04-16 14:42:17
+0000
@@ -20,114 +20,322 @@
#include "BevelFilter.h"
#include "VM.h"
#include "builtin_function.h"
-
-// These _must_ be defined for prophelpers to work correctly.
-// This is enforced by the file itself.
-#define phelp_helper BevelFilter_as
-#include "prophelper.h"
#include "flash/filters/BitmapFilter_as.h"
+
namespace gnash {
class BevelFilter_as : public as_object, public BevelFilter
{
public:
- phelp_gs(distance);
- phelp_gs(angle);
- phelp_gs(highlightColor);
- phelp_gs(highlightAlpha);
- phelp_gs(shadowColor);
- phelp_gs(shadowAlpha);
- phelp_gs(blurX);
- phelp_gs(blurY);
- phelp_gs(strength);
- phelp_gs(quality);
- phelp_gs(type);
- phelp_gs(knockout);
+ static as_value distance_gs(const fn_call& fn);
+ static as_value angle_gs(const fn_call& fn);
+ static as_value highlightColor_gs(const fn_call& fn);
+ static as_value highlightAlpha_gs(const fn_call& fn);
+ static as_value shadowColor_gs(const fn_call& fn);
+ static as_value shadowAlpha_gs(const fn_call& fn);
+ static as_value blurX_gs(const fn_call& fn);
+ static as_value blurY_gs(const fn_call& fn);
+ static as_value strength_gs(const fn_call& fn);
+ static as_value quality_gs(const fn_call& fn);
+ static as_value type_gs(const fn_call& fn);
+ static as_value knockout_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
- phelp_i(bitmap_clone);
+ public: BevelFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), BevelFilter)
-
-// Replace BitmapFilter clone.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-// Begin attaching properties, then attach them, then end.
-phelp_gs_attach_begin
-phelp_gs_attach(distance);
-phelp_gs_attach(angle);
-phelp_gs_attach(highlightColor);
-phelp_gs_attach(highlightAlpha);
-phelp_gs_attach(shadowColor);
-phelp_gs_attach(shadowAlpha);
-phelp_gs_attach(blurX);
-phelp_gs_attach(blurY);
-phelp_gs_attach(strength);
-phelp_gs_attach(quality);
-phelp_gs_attach(type);
-phelp_gs_attach(knockout);
-phelp_gs_attach_end
-
-phelp_property(float, number<float>, distance)
-phelp_property(float, number<float>, angle)
-phelp_property(boost::uint32_t, number<boost::uint32_t>, highlightColor)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, highlightAlpha)
-phelp_property(boost::uint32_t, number<boost::uint32_t>, shadowColor)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, shadowAlpha)
-phelp_property(float, number<float>, blurX)
-phelp_property(float, number<float>, blurY)
-phelp_property(float, number<float>, strength)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, quality)
-phelp_property(bool, bool, knockout)
-
-easy_clone(BevelFilter_as)
+
+boost::intrusive_ptr<as_object> BevelFilter_as::s_interface;
+boost:: intrusive_ptr<builtin_function> BevelFilter_as::s_ctor;
+
+as_object*
+BevelFilter_as::Interface() {
+ if (BevelFilter_as::s_interface == NULL) {
+ BevelFilter_as::s_interface = new as_object (bitmapFilter_interface());
+ VM::get().addStatic(BevelFilter_as::s_interface.get());
+ BevelFilter_as::attachInterface(*BevelFilter_as::s_interface);
+ }
+ return BevelFilter_as::s_interface.get();
+}
+
+void
+BevelFilter_as::registerCtor(as_object& global) {
+ if (BevelFilter_as::s_ctor != NULL) return;
+ BevelFilter_as::s_ctor = new builtin_function(&BevelFilter_as::ctor,
BevelFilter_as::Interface());
+ VM::get().addStatic(BevelFilter_as::s_ctor.get());
+ BevelFilter_as::attachInterface(*BevelFilter_as::s_ctor);
+ global.init_member("BevelFilter" , BevelFilter_as::s_ctor.get());
+}
+
+void
+BevelFilter_class_init(as_object& global)
+{
+ BevelFilter_as::registerCtor(global);
+}
+
+
+void
+BevelFilter_as::attachInterface(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+
+void
+BevelFilter_as::attachProperties(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(BevelFilter_as::distance_gs, NULL);
+ o.init_property("distance" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::angle_gs, NULL);
+ o.init_property("angle" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::highlightColor_gs, NULL);
+ o.init_property("highlightColor" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::highlightAlpha_gs, NULL);
+ o.init_property("highlightAlpha" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::shadowColor_gs, NULL);
+ o.init_property("shadowColor" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::shadowAlpha_gs, NULL);
+ o.init_property("shadowAlpha" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::blurX_gs, NULL);
+ o.init_property("blurX" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::blurY_gs, NULL);
+ o.init_property("blurY" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::strength_gs, NULL);
+ o.init_property("strength" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::quality_gs, NULL);
+ o.init_property("quality" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::type_gs, NULL);
+ o.init_property("type" , *gs, *gs);
+
+ gs = new builtin_function(BevelFilter_as::knockout_gs, NULL);
+ o.init_property("knockout" , *gs, *gs);
+
+}
+
+as_value
+BevelFilter_as::distance_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_distance );
+ }
+
+ float sp_distance = fn.arg(0).to_number();
+ ptr->m_distance = sp_distance;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::angle_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_angle );
+ }
+ float sp_angle = fn.arg(0).to_number<float> ();
+ ptr->m_angle = sp_angle;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::highlightColor_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_highlightColor );
+ }
+ boost::uint32_t sp_highlightColor = fn.arg(0).to_number<boost::uint32_t>
();
+ ptr->m_highlightColor = sp_highlightColor;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::highlightAlpha_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_highlightAlpha );
+ }
+ boost::uint8_t sp_highlightAlpha = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_highlightAlpha = sp_highlightAlpha;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::shadowColor_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_shadowColor );
+ }
+ boost::uint32_t sp_shadowColor = fn.arg(0).to_number<boost::uint32_t> ();
+ ptr->m_shadowColor = sp_shadowColor;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::shadowAlpha_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_shadowAlpha );
+ }
+ boost::uint8_t sp_shadowAlpha = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_shadowAlpha = sp_shadowAlpha;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::blurX_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurX );
+ }
+ float sp_blurX = fn.arg(0).to_number<float> ();
+ ptr->m_blurX = sp_blurX;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::blurY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurY );
+ }
+ float sp_blurY = fn.arg(0).to_number<float> ();
+ ptr->m_blurY = sp_blurY;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::strength_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_strength );
+ }
+ float sp_strength = fn.arg(0).to_number<float> ();
+ ptr->m_strength = sp_strength;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::quality_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_quality );
+ }
+ boost::uint8_t sp_quality = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_quality = sp_quality;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::knockout_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_knockout );
+ }
+ bool sp_knockout = fn.arg(0).to_bool ();
+ ptr->m_knockout = sp_knockout;
+ return as_value();
+}
+
+as_value
+BevelFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<BevelFilter_as> obj = new BevelFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+}
as_value
BevelFilter_as::type_gs(const fn_call& fn)
{
boost::intrusive_ptr<BevelFilter_as> ptr =
ensureType<BevelFilter_as>(fn.this_ptr);
- if (fn.nargs == 0) // getter
+ if (fn.nargs == 0)
{
switch (ptr->m_type)
{
case BevelFilter::FULL_BEVEL:
return as_value("full");
+
break;
+
default:
case BevelFilter::INNER_BEVEL:
return as_value("inner");
+
break;
+
case BevelFilter::OUTER_BEVEL:
return as_value("outer");
+
break;
+
}
}
- // setter
+
std::string type = fn.arg(0).to_string();
+
if (type == "outer")
ptr->m_type = BevelFilter::OUTER_BEVEL;
+
if (type == "inner")
ptr->m_type = BevelFilter::INNER_BEVEL;
+
if (type == "full")
ptr->m_type = BevelFilter::FULL_BEVEL;
+
return as_value();
+
}
as_value
-BevelFilter_as::ctor(const fn_call& /*fn*/)
+BevelFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
BevelFilter_as(BevelFilter_as::Interface());
+
BevelFilter_as::attachProperties(*obj);
-
return as_value(obj.get());
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== modified file 'libcore/asobj/flash/filters/BitmapFilter_as.cpp'
--- a/libcore/asobj/flash/filters/BitmapFilter_as.cpp 2009-02-25 22:33:03
+0000
+++ b/libcore/asobj/flash/filters/BitmapFilter_as.cpp 2009-04-16 14:47:26
+0000
@@ -21,30 +21,64 @@
#include "VM.h"
#include "builtin_function.h"
-#define phelp_helper BitmapFilter_as
-#define phelp_class BitmapFilter
-#include "prophelper.h"
-
namespace gnash {
class BitmapFilter_as : public as_object, public BitmapFilter
{
public:
- phelp_i(bitmap_clone);
+ static as_value bitmap_clone(const fn_call& fn);
virtual boost::intrusive_ptr<as_object> clone();
+ BitmapFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
};
-phelp_base_imp( , BitmapFilter)
-
-phelp_i_attach_begin
-phelp_i_attach(clone, bitmap_clone);
-phelp_i_attach_end
-
-// Clone this object.
+boost::intrusive_ptr<as_object> BitmapFilter_as::s_interface;
+boost:: intrusive_ptr<builtin_function> BitmapFilter_as::s_ctor;
+
+as_object*
+BitmapFilter_as::Interface() {
+ if (BitmapFilter_as::s_interface == NULL) {
+ BitmapFilter_as::s_interface = new as_object;
+ VM::get().addStatic(BitmapFilter_as::s_interface.get());
+ BitmapFilter_as::attachInterface(*BitmapFilter_as::s_interface);
+ }
+ return BitmapFilter_as::s_interface.get();
+}
+
+void
+BitmapFilter_as::registerCtor(as_object& global) {
+ if (BitmapFilter_as::s_ctor != NULL) return;
+ BitmapFilter_as::s_ctor = new builtin_function(&BitmapFilter_as::ctor,
BitmapFilter_as::Interface());
+ VM::get().addStatic(BitmapFilter_as::s_ctor.get());
+ BitmapFilter_as::attachInterface(*BitmapFilter_as::s_ctor);
+ global.init_member("BitmapFilter" , BitmapFilter_as::s_ctor.get());
+}
+
+void
+BitmapFilter_class_init(as_object& global) {
+ BitmapFilter_as::registerCtor(global);
+}
+
+void
+BitmapFilter_as::attachInterface(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+ o.init_member("clone" , new builtin_function(bitmap_clone));
+}
+
+
boost::intrusive_ptr<as_object> BitmapFilter_as::clone()
{
boost::intrusive_ptr<as_object> o = new
BitmapFilter_as(BitmapFilter_as::Interface());
@@ -52,13 +86,14 @@
}
as_value
-BitmapFilter_as::ctor(const fn_call& /*fn*/)
+BitmapFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
BitmapFilter_as(BitmapFilter_as::Interface());
return as_value(obj);
}
-as_value BitmapFilter_as::bitmap_clone(const fn_call& fn)
+as_value
+BitmapFilter_as::bitmap_clone(const fn_call& fn)
{
boost::intrusive_ptr<BitmapFilter_as> to_copy =
ensureType<BitmapFilter_as> (fn.this_ptr);
boost::intrusive_ptr<BitmapFilter_as> filter = new
BitmapFilter_as(*to_copy);
@@ -75,5 +110,4 @@
return BitmapFilter_as::Interface();
}
-} // Namespace gnash
-
+}
=== modified file 'libcore/asobj/flash/filters/BlurFilter_as.cpp'
--- a/libcore/asobj/flash/filters/BlurFilter_as.cpp 2009-02-25 22:33:03
+0000
+++ b/libcore/asobj/flash/filters/BlurFilter_as.cpp 2009-04-16 14:56:56
+0000
@@ -21,9 +21,6 @@
#include "VM.h"
#include "builtin_function.h"
-// These _must_ be defined.
-#define phelp_helper BlurFilter_as
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -31,42 +28,139 @@
class BlurFilter_as : public as_object, public BlurFilter
{
public:
- phelp_gs(blurX);
- phelp_gs(blurY);
- phelp_gs(quality);
+ static as_value blurX_gs(const fn_call& fn);
+ static as_value blurY_gs(const fn_call& fn);
+ static as_value quality_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
- phelp_i(bitmap_clone);
+ BlurFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {
+ }
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), BlurFilter)
-
-// Filters are property based.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-phelp_gs_attach_begin
-phelp_gs_attach(blurX);
-phelp_gs_attach(blurY);
-phelp_gs_attach(quality);
-phelp_gs_attach_end
-
-phelp_property(float, number<float>, blurX)
-phelp_property(float, number<float>, blurY)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, quality)
-
-easy_clone(BlurFilter_as)
-
-as_value
-BlurFilter_as::ctor(const fn_call& /*fn*/)
+
+boost::intrusive_ptr<as_object> BlurFilter_as::s_interface;
+boost:: intrusive_ptr<builtin_function> BlurFilter_as::s_ctor;
+
+as_object*
+BlurFilter_as::Interface() {
+ if (BlurFilter_as::s_interface == NULL) {
+ BlurFilter_as::s_interface = new as_object(bitmapFilter_interface());
+ VM::get().addStatic(BlurFilter_as::s_interface.get());
+ BlurFilter_as::attachInterface(*BlurFilter_as::s_interface);
+ }
+ return BlurFilter_as::s_interface.get();
+}
+
+void
+BlurFilter_as::registerCtor(as_object& global)
+{
+ if (BlurFilter_as::s_ctor != NULL) return;
+ BlurFilter_as::s_ctor = new builtin_function(&BlurFilter_as::ctor,
BlurFilter_as::Interface());
+ VM::get().addStatic(BlurFilter_as::s_ctor.get());
+ BlurFilter_as::attachInterface(*BlurFilter_as::s_ctor);
+ global.init_member("BlurFilter" , BlurFilter_as::s_ctor.get());
+}
+
+void
+BlurFilter_class_init(as_object& global)
+{
+ BlurFilter_as::registerCtor(global);
+}
+
+
+void
+BlurFilter_as::attachInterface(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+void
+BlurFilter_as::attachProperties(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(BlurFilter_as::blurX_gs, NULL);
+ o.init_property("blurX" , *gs, *gs);
+
+ gs = new builtin_function(BlurFilter_as::blurY_gs, NULL);
+ o.init_property("blurY" , *gs, *gs);
+
+ gs = new builtin_function(BlurFilter_as::quality_gs, NULL);
+ o.init_property("quality" , *gs, *gs);
+
+}
+
+as_value
+BlurFilter_as::blurX_gs(const fn_call& fn)
+{
+
+ boost::intrusive_ptr<BlurFilter_as> ptr =
ensureType<BlurFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurX );
+ }
+ float sp_blurX = fn.arg(0).to_number<float> ();
+ ptr->m_blurX = sp_blurX;
+ return as_value();
+}
+
+as_value
+BlurFilter_as::blurY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BlurFilter_as> ptr =
ensureType<BlurFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurY );
+ }
+ float sp_blurY = fn.arg(0).to_number<float> ();
+ ptr->m_blurY = sp_blurY;
+ return as_value();
+}
+
+as_value
+BlurFilter_as::quality_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<BlurFilter_as> ptr =
ensureType<BlurFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_quality );
+ }
+ boost::uint8_t sp_quality = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_quality = sp_quality;
+ return as_value();
+}
+
+as_value
+BlurFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<BlurFilter_as> ptr =
ensureType<BlurFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<BlurFilter_as> obj = new BlurFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+}
+
+as_value
+BlurFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
BlurFilter_as(BlurFilter_as::Interface());
+
BlurFilter_as::attachProperties(*obj);
-
return as_value(obj);
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== modified file 'libcore/asobj/flash/filters/ColorMatrixFilter_as.cpp'
--- a/libcore/asobj/flash/filters/ColorMatrixFilter_as.cpp 2009-02-25
22:33:03 +0000
+++ b/libcore/asobj/flash/filters/ColorMatrixFilter_as.cpp 2009-04-16
15:16:22 +0000
@@ -20,9 +20,6 @@
#include "ColorMatrixFilter.h"
#include "VM.h"
#include "builtin_function.h"
-
-#define phelp_helper ColorMatrixFilter_as
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -30,37 +27,98 @@
class ColorMatrixFilter_as : public as_object, public ColorMatrixFilter
{
public:
- phelp_gs(matrix);
-
- phelp_i(bitmap_clone);
-
+ static as_value matrix_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
+
+ ColorMatrixFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), ColorMatrixFilter)
-
-// Filters are purely property based.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-phelp_gs_attach_begin
-phelp_gs_attach(matrix);
-phelp_gs_attach_end
-
-phelp_array_property(matrix)
-
-easy_clone(ColorMatrixFilter_as)
-
-as_value
-ColorMatrixFilter_as::ctor(const fn_call& /*fn*/)
+
+boost::intrusive_ptr<as_object> ColorMatrixFilter_as::s_interface;
+boost:: intrusive_ptr<builtin_function> ColorMatrixFilter_as::s_ctor;
+
+as_object* ColorMatrixFilter_as::Interface() {
+ if (ColorMatrixFilter_as::s_interface == NULL) {
+ ColorMatrixFilter_as::s_interface = new as_object
(bitmapFilter_interface());
+ VM::get().addStatic(ColorMatrixFilter_as::s_interface.get());
+
ColorMatrixFilter_as::attachInterface(*ColorMatrixFilter_as::s_interface);
+ }
+ return ColorMatrixFilter_as::s_interface.get();
+}
+
+void
+ColorMatrixFilter_as::registerCtor(as_object& global)
+{
+ if (ColorMatrixFilter_as::s_ctor != NULL) return;
+ ColorMatrixFilter_as::s_ctor = new
builtin_function(&ColorMatrixFilter_as::ctor,
ColorMatrixFilter_as::Interface());
+ VM::get().addStatic(ColorMatrixFilter_as::s_ctor.get());
+ ColorMatrixFilter_as::attachInterface(*ColorMatrixFilter_as::s_ctor);
+ global.init_member("ColorMatrixFilter" ,
ColorMatrixFilter_as::s_ctor.get());
+}
+
+void
+ColorMatrixFilter_class_init(as_object& global)
+{
+ ColorMatrixFilter_as::registerCtor(global);
+}
+
+
+void
+ColorMatrixFilter_as::attachInterface(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+void
+ColorMatrixFilter_as::attachProperties(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(ColorMatrixFilter_as::matrix_gs, NULL);
+ o.init_property("matrix" , *gs, *gs);
+}
+
+as_value
+ColorMatrixFilter_as::matrix_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ColorMatrixFilter_as> ptr =
ensureType<ColorMatrixFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+as_value
+ColorMatrixFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<ColorMatrixFilter_as> ptr =
ensureType<ColorMatrixFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<ColorMatrixFilter_as> obj = new
ColorMatrixFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+}
+
+as_value
+ColorMatrixFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
ColorMatrixFilter_as(ColorMatrixFilter_as::Interface());
+
ColorMatrixFilter_as::attachProperties(*obj);
-
return as_value(obj.get());
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== modified file 'libcore/asobj/flash/filters/ConvolutionFilter_as.cpp'
--- a/libcore/asobj/flash/filters/ConvolutionFilter_as.cpp 2009-02-25
22:33:03 +0000
+++ b/libcore/asobj/flash/filters/ConvolutionFilter_as.cpp 2009-04-16
14:32:04 +0000
@@ -21,9 +21,6 @@
#include "VM.h"
#include "builtin_function.h"
-#define phelp_helper ConvolutionFilter_as
-#define phelp_class ConvolutionFilter
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -31,59 +28,224 @@
class ConvolutionFilter_as : public as_object, public ConvolutionFilter
{
public:
- phelp_gs(matrixX);
- phelp_gs(matrixY);
- phelp_gs(matrix);
- phelp_gs(divisor);
- phelp_gs(bias);
- phelp_gs(preserveAlpha);
- phelp_gs(clamp);
- phelp_gs(color);
- phelp_gs(alpha);
-
- phelp_i(bitmap_clone);
+ static as_value matrixX_gs(const fn_call& fn);
+ static as_value matrixY_gs(const fn_call& fn);
+ static as_value matrix_gs(const fn_call& fn);
+ static as_value divisor_gs(const fn_call& fn);
+ static as_value bias_gs(const fn_call& fn);
+ static as_value preserveAlpha_gs(const fn_call& fn);
+ static as_value clamp_gs(const fn_call& fn);
+ static as_value color_gs(const fn_call& fn);
+ static as_value alpha_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
+
+ ConvolutionFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {
+ }
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+static boost::intrusive_ptr<as_object> s_interface;
+static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), ConvolutionFilter)
-
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-phelp_gs_attach_begin
-phelp_gs_attach(matrixX);
-phelp_gs_attach(matrixY);
-phelp_gs_attach(matrix);
-phelp_gs_attach(divisor);
-phelp_gs_attach(bias);
-phelp_gs_attach(preserveAlpha);
-phelp_gs_attach(clamp);
-phelp_gs_attach(color);
-phelp_gs_attach(alpha);
-phelp_gs_attach_end
-
-phelp_property(boost::uint8_t, number<boost::uint8_t>, matrixX)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, matrixY)
-phelp_property(float, number<float>, divisor)
-phelp_property(float, number<float>, bias)
-phelp_property(bool, bool, preserveAlpha)
-phelp_property(bool, bool, clamp)
-phelp_property(boost::uint32_t, number<boost::uint32_t>, color)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, alpha)
-phelp_array_property(matrix)
-
-easy_clone(ConvolutionFilter_as)
-
-as_value
-ConvolutionFilter_as::ctor(const fn_call& /*fn*/)
+boost::intrusive_ptr<as_object> ConvolutionFilter_as::s_interface;
+
+boost::intrusive_ptr<builtin_function> ConvolutionFilter_as::s_ctor;
+
+as_object*
+ConvolutionFilter_as::Interface()
+{
+ if (ConvolutionFilter_as::s_interface == NULL) {
+ ConvolutionFilter_as::s_interface = new as_object
(bitmapFilter_interface());
+ VM::get().addStatic(ConvolutionFilter_as::s_interface.get());
+
ConvolutionFilter_as::attachInterface(*ConvolutionFilter_as::s_interface);
+ }
+ return ConvolutionFilter_as::s_interface.get();
+}
+
+void
+ConvolutionFilter_as::registerCtor(as_object& global)
+{
+ if (ConvolutionFilter_as::s_ctor != NULL) return;
+ ConvolutionFilter_as::s_ctor = new
builtin_function(&ConvolutionFilter_as::ctor,
ConvolutionFilter_as::Interface());
+ VM::get().addStatic(ConvolutionFilter_as::s_ctor.get());
+ ConvolutionFilter_as::attachInterface(*ConvolutionFilter_as::s_ctor);
+ global.init_member("ConvolutionFilter" ,
ConvolutionFilter_as::s_ctor.get());
+}
+
+void
+ConvolutionFilter_class_init(as_object& global)
+{
+ ConvolutionFilter_as::registerCtor(global);
+}
+
+void
+ConvolutionFilter_as::attachInterface(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+}
+
+void
+ConvolutionFilter_as::attachProperties(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(ConvolutionFilter_as::matrixX_gs, NULL);
+ o.init_property("matrixX" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::matrixY_gs, NULL);
+ o.init_property("matrixY" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::matrix_gs, NULL);
+ o.init_property("matrix" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::divisor_gs, NULL);
+ o.init_property("divisor" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::bias_gs, NULL);
+ o.init_property("bias" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::preserveAlpha_gs, NULL);
+ o.init_property("preserveAlpha" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::clamp_gs, NULL);
+ o.init_property("clamp" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::color_gs, NULL);
+ o.init_property("color" , *gs, *gs);
+
+ gs = new builtin_function(ConvolutionFilter_as::alpha_gs, NULL);
+ o.init_property("alpha" , *gs, *gs);
+
+}
+
+as_value
+ConvolutionFilter_as::matrixX_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_matrixX );
+ }
+ boost::uint8_t sp_matrixX = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->_matrixX = sp_matrixX;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::matrixY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_matrixY );
+ }
+ boost::uint8_t sp_matrixY = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->_matrixY = sp_matrixY;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::divisor_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_divisor );
+ }
+ float sp_divisor = fn.arg(0).to_number<float> ();
+ ptr->_divisor = sp_divisor;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::bias_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) { return as_value(ptr->_bias );
+ }
+ float sp_bias = fn.arg(0).to_number<float> ();
+ ptr->_bias = sp_bias;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::preserveAlpha_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_preserveAlpha);
+ }
+ bool sp_preserveAlpha = fn.arg(0).to_bool();
+ ptr->_preserveAlpha = sp_preserveAlpha;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::clamp_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_clamp );
+ }
+ bool sp_clamp = fn.arg(0).to_bool ();
+ ptr->_clamp = sp_clamp;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::color_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_color );
+ }
+ boost::uint32_t sp_color = fn.arg(0).to_number<boost::uint32_t> ();
+ ptr->_color = sp_color;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::alpha_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->_alpha );
+ }
+ boost::uint8_t sp_alpha = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->_alpha = sp_alpha;
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::matrix_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+as_value
+ConvolutionFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<ConvolutionFilter_as> ptr =
ensureType<ConvolutionFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<ConvolutionFilter_as> obj = new
ConvolutionFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+}
+
+as_value
+ConvolutionFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
ConvolutionFilter_as(ConvolutionFilter_as::Interface());
ConvolutionFilter_as::attachProperties(*obj);
-
return as_value(obj.get());
}
-} // Namespace gnash
-
+}
=== modified file 'libcore/asobj/flash/filters/DropShadowFilter_as.cpp'
--- a/libcore/asobj/flash/filters/DropShadowFilter_as.cpp 2009-02-25
22:33:03 +0000
+++ b/libcore/asobj/flash/filters/DropShadowFilter_as.cpp 2009-04-16
16:56:54 +0000
@@ -20,11 +20,6 @@
#include "DropShadowFilter.h"
#include "VM.h"
#include "builtin_function.h"
-
-// These _must_ be defined.
-#define phelp_helper DropShadowFilter_as
-#define phelp_class DropShadowFilter
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -32,67 +27,278 @@
class DropShadowFilter_as : public as_object, public DropShadowFilter
{
public:
- phelp_gs(distance);
- phelp_gs(angle);
- phelp_gs(color);
- phelp_gs(alpha);
- phelp_gs(blurX);
- phelp_gs(blurY);
- phelp_gs(strength);
- phelp_gs(quality);
- phelp_gs(inner);
- phelp_gs(knockout);
- phelp_gs(hideObject);
-
- phelp_i(bitmap_clone);
-
+ static as_value distance_gs(const fn_call& fn);
+ static as_value angle_gs(const fn_call& fn);
+ static as_value color_gs(const fn_call& fn);
+ static as_value alpha_gs(const fn_call& fn);
+ static as_value blurX_gs(const fn_call& fn);
+ static as_value blurY_gs(const fn_call& fn);
+ static as_value strength_gs(const fn_call& fn);
+ static as_value quality_gs(const fn_call& fn);
+ static as_value inner_gs(const fn_call& fn);
+ static as_value knockout_gs(const fn_call& fn);
+ static as_value hideObject_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
+
+
+ DropShadowFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
+
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), DropShadowFilter)
-
-// Filters are property based.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-phelp_gs_attach_begin
-phelp_gs_attach(distance);
-phelp_gs_attach(angle);
-phelp_gs_attach(color);
-phelp_gs_attach(alpha);
-phelp_gs_attach(blurX);
-phelp_gs_attach(blurY);
-phelp_gs_attach(strength);
-phelp_gs_attach(quality);
-phelp_gs_attach(inner);
-phelp_gs_attach(knockout);
-phelp_gs_attach(hideObject);
-phelp_gs_attach_end
-
-phelp_property(float, number<float>, distance)
-phelp_property(float, number<float>, angle)
-phelp_property(boost::uint32_t, number<boost::uint32_t>, color)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, alpha)
-phelp_property(float, number<float>, blurX)
-phelp_property(float, number<float>, blurY)
-phelp_property(float, number<float>, strength)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, quality)
-phelp_property(bool, bool, inner)
-phelp_property(bool, bool, knockout)
-phelp_property(bool, bool, hideObject)
-
-easy_clone(DropShadowFilter_as)
-
-as_value
-DropShadowFilter_as::ctor(const fn_call& /*fn*/)
+
+boost::intrusive_ptr<as_object> DropShadowFilter_as::s_interface;
+
+boost:: intrusive_ptr<builtin_function> DropShadowFilter_as::s_ctor;
+
+as_object*
+DropShadowFilter_as::Interface() {
+ if (DropShadowFilter_as::s_interface == NULL) {
+ DropShadowFilter_as::s_interface = new as_object
(bitmapFilter_interface());
+ VM::get().addStatic(DropShadowFilter_as::s_interface.get());
+ DropShadowFilter_as::attachInterface(*DropShadowFilter_as::s_interface);
+ }
+ return DropShadowFilter_as::s_interface.get();
+}
+
+void
+DropShadowFilter_as::registerCtor(as_object& global) {
+ if (DropShadowFilter_as::s_ctor != NULL) return;
+ DropShadowFilter_as::s_ctor = new
builtin_function(&DropShadowFilter_as::ctor, DropShadowFilter_as::Interface());
+ VM::get().addStatic(DropShadowFilter_as::s_ctor.get());
+ DropShadowFilter_as::attachInterface(*DropShadowFilter_as::s_ctor);
+ global.init_member("DropShadowFilter" , DropShadowFilter_as::s_ctor.get());
+}
+
+void
+DropShadowFilter_class_init(as_object& global)
+{
+ DropShadowFilter_as::registerCtor(global);
+}
+
+
+void DropShadowFilter_as::attachInterface(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+void
+DropShadowFilter_as::attachProperties(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(DropShadowFilter_as::distance_gs, NULL);
+ o.init_property("distance" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::angle_gs, NULL);
+ o.init_property("angle" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::color_gs, NULL);
+ o.init_property("color" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::alpha_gs, NULL);
+ o.init_property("alpha" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::blurX_gs, NULL);
+ o.init_property("blurX" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::blurY_gs, NULL);
+ o.init_property("blurY" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::strength_gs, NULL);
+ o.init_property("strength" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::quality_gs, NULL);
+ o.init_property("quality" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::inner_gs, NULL);
+ o.init_property("inner" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::knockout_gs, NULL);
+ o.init_property("knockout" , *gs, *gs);
+
+ gs = new builtin_function(DropShadowFilter_as::hideObject_gs, NULL);
+ o.init_property("hideObject" , *gs, *gs);
+
+}
+
+as_value
+DropShadowFilter_as::distance_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_distance );
+ }
+ float sp_distance = fn.arg(0).to_number<float> ();
+ ptr->m_distance = sp_distance;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::angle_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_angle );
+ }
+ float sp_angle = fn.arg(0).to_number<float> ();
+ ptr->m_angle = sp_angle;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::color_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_color );
+ }
+ boost::uint32_t sp_color = fn.arg(0).to_number<boost::uint32_t> ();
+ ptr->m_color = sp_color;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::alpha_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_alpha );
+ }
+ boost::uint8_t sp_alpha = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_alpha = sp_alpha;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::blurX_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurX );
+ }
+ float sp_blurX = fn.arg(0).to_number<float> ();
+ ptr->m_blurX = sp_blurX;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::blurY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurY );
+ }
+ float sp_blurY = fn.arg(0).to_number<float> ();
+ ptr->m_blurY = sp_blurY;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::strength_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_strength );
+ }
+ float sp_strength = fn.arg(0).to_number<float> ();
+ ptr->m_strength = sp_strength;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::quality_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_quality );
+ }
+ boost::uint8_t sp_quality = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_quality = sp_quality;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::inner_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_inner );
+ }
+ bool sp_inner = fn.arg(0).to_bool ();
+ ptr->m_inner = sp_inner;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::knockout_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_knockout );
+ }
+ bool sp_knockout = fn.arg(0).to_bool ();
+ ptr->m_knockout = sp_knockout;
+ return as_value();
+}
+
+
+as_value
+DropShadowFilter_as::hideObject_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_hideObject );
+ }
+ bool sp_hideObject = fn.arg(0).to_bool ();
+ ptr->m_hideObject = sp_hideObject;
+ return as_value();
+}
+
+as_value
+DropShadowFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<DropShadowFilter_as> ptr =
ensureType<DropShadowFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<DropShadowFilter_as> obj = new
DropShadowFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+ }
+
+as_value
+DropShadowFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
DropShadowFilter_as(DropShadowFilter_as::Interface());
+
DropShadowFilter_as::attachProperties(*obj);
+
return as_value(obj.get());
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== modified file 'libcore/asobj/flash/filters/GlowFilter_as.cpp'
--- a/libcore/asobj/flash/filters/GlowFilter_as.cpp 2009-02-25 22:33:03
+0000
+++ b/libcore/asobj/flash/filters/GlowFilter_as.cpp 2009-04-16 16:16:43
+0000
@@ -20,11 +20,6 @@
#include "GlowFilter.h"
#include "VM.h"
#include "builtin_function.h"
-
-// These _must_ be defined.
-#define phelp_helper GlowFilter_as
-#define phelp_class GlowFilter
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -32,57 +27,216 @@
class GlowFilter_as : public as_object, public GlowFilter
{
public:
- phelp_gs(color);
- phelp_gs(alpha);
- phelp_gs(blurX);
- phelp_gs(blurY);
- phelp_gs(strength);
- phelp_gs(quality);
- phelp_gs(inner);
- phelp_gs(knockout);
-
- phelp_i(bitmap_clone);
+ static as_value color_gs(const fn_call& fn);
+
+ static as_value alpha_gs(const fn_call& fn);
+
+ static as_value blurX_gs(const fn_call& fn);
+
+ static as_value blurY_gs(const fn_call& fn);
+
+ static as_value strength_gs(const fn_call& fn);
+
+ static as_value quality_gs(const fn_call& fn);
+
+ static as_value inner_gs(const fn_call& fn);
+
+ static as_value knockout_gs(const fn_call& fn);
+
+
+ static as_value bitmap_clone(const fn_call& fn);
+
+ GlowFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), GlowFilter)
-
-// Filters are property based.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-phelp_gs_attach_begin
-phelp_gs_attach(color);
-phelp_gs_attach(alpha);
-phelp_gs_attach(blurX);
-phelp_gs_attach(blurY);
-phelp_gs_attach(strength);
-phelp_gs_attach(quality);
-phelp_gs_attach(inner);
-phelp_gs_attach(knockout);
-phelp_gs_attach_end
-
-phelp_property(boost::uint32_t, number<boost::uint32_t>, color)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, alpha)
-phelp_property(float, number<float>, blurX)
-phelp_property(float, number<float>, blurY)
-phelp_property(float, number<float>, strength)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, quality)
-phelp_property(bool, bool, inner)
-phelp_property(bool, bool, knockout)
-
-easy_clone(GlowFilter_as)
-
-as_value
-GlowFilter_as::ctor(const fn_call& /*fn*/)
+
+boost::intrusive_ptr<as_object> GlowFilter_as::s_interface;
+boost:: intrusive_ptr<builtin_function> GlowFilter_as::s_ctor;
+
+as_object*
+GlowFilter_as::Interface() {
+ if (GlowFilter_as::s_interface == NULL) {
+ GlowFilter_as::s_interface = new as_object (bitmapFilter_interface());
+ VM::get().addStatic(GlowFilter_as::s_interface.get());
+ GlowFilter_as::attachInterface(*GlowFilter_as::s_interface);
+ }
+ return GlowFilter_as::s_interface.get();
+}
+
+void
+GlowFilter_as::registerCtor(as_object& global) {
+ if (GlowFilter_as::s_ctor != NULL) return;
+ GlowFilter_as::s_ctor = new builtin_function(&GlowFilter_as::ctor,
GlowFilter_as::Interface());
+ VM::get().addStatic(GlowFilter_as::s_ctor.get());
+ GlowFilter_as::attachInterface(*GlowFilter_as::s_ctor);
+ global.init_member("GlowFilter" , GlowFilter_as::s_ctor.get());
+}
+
+void
+GlowFilter_class_init(as_object& global)
+{
+ GlowFilter_as::registerCtor(global);
+}
+
+
+void
+GlowFilter_as::attachInterface(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+void
+GlowFilter_as::attachProperties(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(GlowFilter_as::color_gs, NULL);
+ o.init_property("color" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::alpha_gs, NULL);
+ o.init_property("alpha" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::blurX_gs, NULL);
+ o.init_property("blurX" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::blurY_gs, NULL);
+ o.init_property("blurY" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::strength_gs, NULL);
+ o.init_property("strength" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::quality_gs, NULL);
+ o.init_property("quality" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::inner_gs, NULL);
+ o.init_property("inner" , *gs, *gs);
+
+ gs = new builtin_function(GlowFilter_as::knockout_gs, NULL);
+ o.init_property("knockout" , *gs, *gs);
+
+}
+
+as_value GlowFilter_as::color_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_color );
+ }
+ boost::uint32_t sp_color = fn.arg(0).to_number<boost::uint32_t> ();
+ ptr->m_color = sp_color;
+ return as_value();
+}
+as_value
+GlowFilter_as::alpha_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_alpha );
+ }
+ boost::uint8_t sp_alpha = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_alpha = sp_alpha;
+ return as_value();
+}
+as_value
+GlowFilter_as::blurX_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurX );
+ }
+ float sp_blurX = fn.arg(0).to_number<float> ();
+ ptr->m_blurX = sp_blurX;
+ return as_value();
+}
+as_value
+GlowFilter_as::blurY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurY );
+ }
+ float sp_blurY = fn.arg(0).to_number<float> ();
+ ptr->m_blurY = sp_blurY;
+ return as_value();
+}
+as_value
+GlowFilter_as::strength_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_strength );
+ }
+ float sp_strength = fn.arg(0).to_number<float> ();
+ ptr->m_strength = sp_strength;
+ return as_value();
+}
+as_value
+GlowFilter_as::quality_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_quality );
+ }
+ boost::uint8_t sp_quality = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_quality = sp_quality;
+ return as_value();
+}
+as_value
+GlowFilter_as::inner_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_inner );
+ }
+ bool sp_inner = fn.arg(0).to_bool ();
+ ptr->m_inner = sp_inner;
+ return as_value();
+}
+as_value
+GlowFilter_as::knockout_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_knockout );
+ }
+ bool sp_knockout = fn.arg(0).to_bool ();
+ ptr->m_knockout = sp_knockout;
+ return as_value();
+ }
+
+as_value GlowFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<GlowFilter_as> ptr =
ensureType<GlowFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<GlowFilter_as> obj = new GlowFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+ }
+
+as_value
+GlowFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
GlowFilter_as(GlowFilter_as::Interface());
+
GlowFilter_as::attachProperties(*obj);
+
return as_value(obj.get());
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== modified file 'libcore/asobj/flash/filters/GradientBevelFilter_as.cpp'
--- a/libcore/asobj/flash/filters/GradientBevelFilter_as.cpp 2009-02-25
22:33:03 +0000
+++ b/libcore/asobj/flash/filters/GradientBevelFilter_as.cpp 2009-04-16
15:27:36 +0000
@@ -20,12 +20,6 @@
#include "GradientBevelFilter.h"
#include "VM.h"
#include "builtin_function.h"
-
-// These _must_ be defined for prophelpers to work correctly.
-// This is enforced by the file itself.
-#define phelp_helper GradientBevelFilter_as
-#define phelp_class GradientBevelFilter
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -33,101 +27,287 @@
class GradientBevelFilter_as : public as_object, public GradientBevelFilter
{
public:
- phelp_gs(distance);
- phelp_gs(angle);
- phelp_gs(colors);
- phelp_gs(alphas);
- phelp_gs(ratios);
- phelp_gs(blurX);
- phelp_gs(blurY);
- phelp_gs(strength);
- phelp_gs(quality);
- phelp_gs(type); // No automation
- phelp_gs(knockout);
-
- phelp_i(bitmap_clone);
-
+ static as_value distance_gs(const fn_call& fn);
+ static as_value angle_gs(const fn_call& fn);
+ static as_value colors_gs(const fn_call& fn);
+ static as_value alphas_gs(const fn_call& fn);
+ static as_value ratios_gs(const fn_call& fn);
+ static as_value blurX_gs(const fn_call& fn);
+ static as_value blurY_gs(const fn_call& fn);
+ static as_value strength_gs(const fn_call& fn);
+ static as_value quality_gs(const fn_call& fn);
+ static as_value type_gs(const fn_call& fn);
+ static as_value knockout_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
+
+
+ GradientBevelFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), GradientBevelFilter)
-
-// Filters are purely property based.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-// Begin attaching properties, then attach them, then end.
-phelp_gs_attach_begin
-phelp_gs_attach(distance);
-phelp_gs_attach(angle);
-phelp_gs_attach(colors);
-phelp_gs_attach(alphas);
-phelp_gs_attach(ratios);
-phelp_gs_attach(blurX);
-phelp_gs_attach(blurY);
-phelp_gs_attach(strength);
-phelp_gs_attach(quality);
-phelp_gs_attach(type);
-phelp_gs_attach(knockout);
-phelp_gs_attach_end
-
-phelp_property(float, number<float>, distance)
-phelp_property(float, number<float>, angle)
-phelp_array_property(colors)
-phelp_array_property(alphas)
-phelp_array_property(ratios)
-phelp_property(float, number<float>, blurX)
-phelp_property(float, number<float>, blurY)
-phelp_property(float, number<float>, strength)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, quality)
-// Type is not automatable.
-phelp_property(bool, bool, knockout)
-
-easy_clone(GradientBevelFilter_as)
+
+boost::intrusive_ptr<as_object> GradientBevelFilter_as::s_interface;
+boost::intrusive_ptr<builtin_function> GradientBevelFilter_as::s_ctor;
+
+as_object*
+GradientBevelFilter_as::Interface() {
+ if (GradientBevelFilter_as::s_interface == NULL) {
+ GradientBevelFilter_as::s_interface = new as_object
(bitmapFilter_interface());
+ VM::get().addStatic(GradientBevelFilter_as::s_interface.get());
+
GradientBevelFilter_as::attachInterface(*GradientBevelFilter_as::s_interface);
+ }
+
+ return GradientBevelFilter_as::s_interface.get();
+}
+
+void
+GradientBevelFilter_as::registerCtor(as_object& global) {
+ if (GradientBevelFilter_as::s_ctor != NULL) return;
+ GradientBevelFilter_as::s_ctor = new
builtin_function(&GradientBevelFilter_as::ctor,
GradientBevelFilter_as::Interface());
+ VM::get().addStatic(GradientBevelFilter_as::s_ctor.get());
+ GradientBevelFilter_as::attachInterface(*GradientBevelFilter_as::s_ctor);
+ global.init_member("GradientBevelFilter" ,
GradientBevelFilter_as::s_ctor.get());
+}
+
+void
+GradientBevelFilter_class_init(as_object& global)
+{
+ GradientBevelFilter_as::registerCtor(global);
+}
+
+
+void
+GradientBevelFilter_as::attachInterface(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+
+void
+GradientBevelFilter_as::attachProperties(as_object& o) {
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(GradientBevelFilter_as::distance_gs, NULL);
+ o.init_property("distance" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::angle_gs, NULL);
+ o.init_property("angle" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::colors_gs, NULL);
+ o.init_property("colors" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::alphas_gs, NULL);
+ o.init_property("alphas" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::ratios_gs, NULL);
+ o.init_property("ratios" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::blurX_gs, NULL);
+ o.init_property("blurX" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::blurY_gs, NULL);
+ o.init_property("blurY" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::strength_gs, NULL);
+ o.init_property("strength" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::quality_gs, NULL);
+ o.init_property("quality" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::type_gs, NULL);
+ o.init_property("type" , *gs, *gs);
+
+ gs = new builtin_function(GradientBevelFilter_as::knockout_gs, NULL);
+ o.init_property("knockout" , *gs, *gs);
+
+}
+
+as_value
+GradientBevelFilter_as::distance_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_distance );
+ }
+ float sp_distance = fn.arg(0).to_number<float> ();
+ ptr->m_distance = sp_distance;
+ return as_value();
+}
+
+as_value
+GradientBevelFilter_as::angle_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_angle );
+ }
+ float sp_angle = fn.arg(0).to_number<float> ();
+ ptr->m_angle = sp_angle;
+ return as_value();
+}
+
+
+as_value
+GradientBevelFilter_as::colors_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+
+as_value
+GradientBevelFilter_as::alphas_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+
+as_value
+GradientBevelFilter_as::ratios_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+
+as_value
+GradientBevelFilter_as::blurX_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurX );
+ }
+ float sp_blurX = fn.arg(0).to_number<float> ();
+ ptr->m_blurX = sp_blurX;
+ return as_value();
+}
+
+
+as_value
+GradientBevelFilter_as::blurY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurY );
+ }
+ float sp_blurY = fn.arg(0).to_number<float> ();
+ ptr->m_blurY = sp_blurY;
+ return as_value();
+}
+
+
+as_value
+GradientBevelFilter_as::strength_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_strength );
+ }
+ float sp_strength = fn.arg(0).to_number<float> ();
+ ptr->m_strength = sp_strength;
+ return as_value();
+}
+
+as_value
+GradientBevelFilter_as::quality_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_quality );
+ }
+ boost::uint8_t sp_quality = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_quality = sp_quality;
+ return as_value();
+}
+
+as_value
+GradientBevelFilter_as::knockout_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_knockout );
+ }
+ bool sp_knockout = fn.arg(0).to_bool ();
+ ptr->m_knockout = sp_knockout;
+ return as_value();
+}
+
+as_value
+GradientBevelFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<GradientBevelFilter_as> obj = new
GradientBevelFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+}
as_value
GradientBevelFilter_as::type_gs(const fn_call& fn)
{
boost::intrusive_ptr<GradientBevelFilter_as> ptr =
ensureType<GradientBevelFilter_as>(fn.this_ptr);
- if (fn.nargs == 0) // getter
+ if (fn.nargs == 0)
{
switch (ptr->m_type)
{
case GradientBevelFilter::FULL_BEVEL:
return as_value("full");
break;
+
default:
case GradientBevelFilter::INNER_BEVEL:
return as_value("inner");
break;
+
case GradientBevelFilter::OUTER_BEVEL:
return as_value("outer");
break;
+
}
}
- // setter
+
std::string type = fn.arg(0).to_string();
+
if (type == "outer")
ptr->m_type = GradientBevelFilter::OUTER_BEVEL;
+
if (type == "inner")
ptr->m_type = GradientBevelFilter::INNER_BEVEL;
+
if (type == "full")
ptr->m_type = GradientBevelFilter::FULL_BEVEL;
+
return as_value();
+
}
as_value
-GradientBevelFilter_as::ctor(const fn_call& /*fn*/)
+GradientBevelFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
GradientBevelFilter_as(GradientBevelFilter_as::Interface());
+
GradientBevelFilter_as::attachProperties(*obj);
-
return as_value(obj.get());
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== modified file 'libcore/asobj/flash/filters/GradientGlowFilter_as.cpp'
--- a/libcore/asobj/flash/filters/GradientGlowFilter_as.cpp 2009-02-25
22:33:03 +0000
+++ b/libcore/asobj/flash/filters/GradientGlowFilter_as.cpp 2009-04-16
15:06:59 +0000
@@ -20,12 +20,6 @@
#include "GradientGlowFilter.h"
#include "VM.h"
#include "builtin_function.h"
-
-// These _must_ be defined for prophelpers to work correctly.
-// This is enforced by the file itself.
-#define phelp_helper GradientGlowFilter_as
-#define phelp_class GradientGlowFilter
-#include "prophelper.h"
#include "BitmapFilter_as.h"
namespace gnash {
@@ -33,101 +27,286 @@
class GradientGlowFilter_as : public as_object, public GradientGlowFilter
{
public:
- phelp_gs(distance);
- phelp_gs(angle);
- phelp_gs(colors);
- phelp_gs(alphas);
- phelp_gs(ratios);
- phelp_gs(blurX);
- phelp_gs(blurY);
- phelp_gs(strength);
- phelp_gs(quality);
- phelp_gs(type); // No automation
- phelp_gs(knockout);
-
- phelp_i(bitmap_clone);
-
+ static as_value distance_gs(const fn_call& fn);
+ static as_value angle_gs(const fn_call& fn);
+ static as_value colors_gs(const fn_call& fn);
+ static as_value alphas_gs(const fn_call& fn);
+ static as_value ratios_gs(const fn_call& fn);
+ static as_value blurX_gs(const fn_call& fn);
+ static as_value blurY_gs(const fn_call& fn);
+ static as_value strength_gs(const fn_call& fn);
+ static as_value quality_gs(const fn_call& fn);
+ static as_value type_gs(const fn_call& fn);
+ static as_value knockout_gs(const fn_call& fn);
+ static as_value bitmap_clone(const fn_call& fn);
+
+ GradientGlowFilter_as(as_object *obj)
+ :
+ as_object(obj)
+ {}
+
+ static as_object* Interface();
+ static void attachInterface(as_object& o);
+ static void attachProperties(as_object& o);
+ static void registerCtor(as_object& global);
+ static as_value ctor(const fn_call& fn);
+
private:
- phelp_base_def;
+ static boost::intrusive_ptr<as_object> s_interface;
+ static boost::intrusive_ptr<builtin_function> s_ctor;
+
};
-phelp_base_imp((bitmapFilter_interface()), GradientGlowFilter)
-
-// Filters are purely property based.
-phelp_i_attach_begin
-phelp_i_replace(clone, bitmap_clone);
-phelp_i_attach_end
-
-// Begin attaching properties, then attach them, then end.
-phelp_gs_attach_begin
-phelp_gs_attach(distance);
-phelp_gs_attach(angle);
-phelp_gs_attach(colors);
-phelp_gs_attach(alphas);
-phelp_gs_attach(ratios);
-phelp_gs_attach(blurX);
-phelp_gs_attach(blurY);
-phelp_gs_attach(strength);
-phelp_gs_attach(quality);
-phelp_gs_attach(type);
-phelp_gs_attach(knockout);
-phelp_gs_attach_end
-
-phelp_property(float, number<float>, distance)
-phelp_property(float, number<float>, angle)
-phelp_array_property(colors)
-phelp_array_property(alphas)
-phelp_array_property(ratios)
-phelp_property(float, number<float>, blurX)
-phelp_property(float, number<float>, blurY)
-phelp_property(float, number<float>, strength)
-phelp_property(boost::uint8_t, number<boost::uint8_t>, quality)
-// Type is not automatable.
-phelp_property(bool, bool, knockout)
-
-easy_clone(GradientGlowFilter_as)
+
+boost::intrusive_ptr<as_object> GradientGlowFilter_as::s_interface;
+
+boost:: intrusive_ptr<builtin_function> GradientGlowFilter_as::s_ctor;
+
+as_object*
+GradientGlowFilter_as::Interface()
+{
+ if (GradientGlowFilter_as::s_interface == NULL) {
+ GradientGlowFilter_as::s_interface = new as_object
(bitmapFilter_interface());
+ VM::get().addStatic(GradientGlowFilter_as::s_interface.get());
+
GradientGlowFilter_as::attachInterface(*GradientGlowFilter_as::s_interface);
+ }
+ return GradientGlowFilter_as::s_interface.get();
+}
+
+void
+GradientGlowFilter_as::registerCtor(as_object& global)
+{
+ if (GradientGlowFilter_as::s_ctor != NULL) return;
+ GradientGlowFilter_as::s_ctor = new
builtin_function(&GradientGlowFilter_as::ctor,
GradientGlowFilter_as::Interface());
+ VM::get().addStatic(GradientGlowFilter_as::s_ctor.get());
+ GradientGlowFilter_as::attachInterface(*GradientGlowFilter_as::s_ctor);
+ global.init_member("GradientGlowFilter" ,
GradientGlowFilter_as::s_ctor.get());
+}
+
+void
+GradientGlowFilter_class_init(as_object& global)
+{
+ GradientGlowFilter_as::registerCtor(global);
+}
+
+
+void
+GradientGlowFilter_as::attachInterface(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ o.set_member(VM::get().getStringTable().find("clone"), new
builtin_function(bitmap_clone));
+
+}
+
+
+void
+GradientGlowFilter_as::attachProperties(as_object& o)
+{
+ boost::intrusive_ptr<builtin_function> gs;
+
+ gs = new builtin_function(GradientGlowFilter_as::distance_gs, NULL);
+ o.init_property("distance" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::angle_gs, NULL);
+ o.init_property("angle" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::colors_gs, NULL);
+ o.init_property("colors" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::alphas_gs, NULL);
+ o.init_property("alphas" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::ratios_gs, NULL);
+ o.init_property("ratios" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::blurX_gs, NULL);
+ o.init_property("blurX" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::blurY_gs, NULL);
+ o.init_property("blurY" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::strength_gs, NULL);
+ o.init_property("strength" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::quality_gs, NULL);
+ o.init_property("quality" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::type_gs, NULL);
+ o.init_property("type" , *gs, *gs);
+
+ gs = new builtin_function(GradientGlowFilter_as::knockout_gs, NULL);
+ o.init_property("knockout" , *gs, *gs);
+
+}
+
+as_value
+GradientGlowFilter_as::distance_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_distance );
+ }
+ float sp_distance = fn.arg(0).to_number<float> ();
+ ptr->m_distance = sp_distance;
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::angle_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_angle );
+ }
+ float sp_angle = fn.arg(0).to_number<float> ();
+ ptr->m_angle = sp_angle;
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::colors_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+
+as_value
+GradientGlowFilter_as::alphas_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::ratios_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::blurX_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurX );
+ }
+ float sp_blurX = fn.arg(0).to_number<float> ();
+ ptr->m_blurX = sp_blurX;
+ return as_value();
+}
+
+
+as_value
+GradientGlowFilter_as::blurY_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_blurY );
+ }
+ float sp_blurY = fn.arg(0).to_number<float> ();
+ ptr->m_blurY = sp_blurY;
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::strength_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_strength );
+ }
+ float sp_strength = fn.arg(0).to_number<float> ();
+ ptr->m_strength = sp_strength;
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::quality_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_quality );
+ }
+ boost::uint8_t sp_quality = fn.arg(0).to_number<boost::uint8_t> ();
+ ptr->m_quality = sp_quality;
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::knockout_gs(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ if (fn.nargs == 0) {
+ return as_value(ptr->m_knockout );
+ }
+ bool sp_knockout = fn.arg(0).to_bool ();
+ ptr->m_knockout = sp_knockout;
+ return as_value();
+}
+
+as_value
+GradientGlowFilter_as::bitmap_clone(const fn_call& fn)
+{
+ boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
+ boost::intrusive_ptr<GradientGlowFilter_as> obj = new
GradientGlowFilter_as(*ptr);
+ boost::intrusive_ptr<as_object> r = obj;
+ r->set_prototype(ptr->get_prototype());
+ r->copyProperties(*ptr);
+ return as_value(r);
+}
as_value
GradientGlowFilter_as::type_gs(const fn_call& fn)
{
boost::intrusive_ptr<GradientGlowFilter_as> ptr =
ensureType<GradientGlowFilter_as>(fn.this_ptr);
- if (fn.nargs == 0) // getter
+ if (fn.nargs == 0)
{
switch (ptr->m_type)
{
case GradientGlowFilter::FULL_GLOW:
return as_value("full");
break;
+
default:
case GradientGlowFilter::INNER_GLOW:
return as_value("inner");
break;
+
case GradientGlowFilter::OUTER_GLOW:
return as_value("outer");
break;
+
}
}
- // setter
+
std::string type = fn.arg(0).to_string();
+
if (type == "outer")
ptr->m_type = GradientGlowFilter::OUTER_GLOW;
+
if (type == "inner")
ptr->m_type = GradientGlowFilter::INNER_GLOW;
+
if (type == "full")
ptr->m_type = GradientGlowFilter::FULL_GLOW;
+
return as_value();
+
}
as_value
-GradientGlowFilter_as::ctor(const fn_call& /*fn*/)
+GradientGlowFilter_as::ctor(const fn_call& )
{
boost::intrusive_ptr<as_object> obj = new
GradientGlowFilter_as(GradientGlowFilter_as::Interface());
+
GradientGlowFilter_as::attachProperties(*obj);
-
return as_value(obj.get());
-}
-
-} // Namespace gnash
-
+
+}
+
+}
=== removed file 'libcore/asobj/prophelper.h'
--- a/libcore/asobj/prophelper.h 2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/prophelper.h 1970-01-01 00:00:00 +0000
@@ -1,195 +0,0 @@
-//
-// Copyright (C) 2007, 2008, 2009 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
-//
-
-// A few defines to make life easier on standard properties.
-// #include this where you need it, not at the top.
-// First invoke: start_properties(phelp_helper, phelp_class) with
-// the helper class (adapter) name and the object class name.
-// sp_type -- the C++ type of the member
-// sp_convert -- the conversion function from as_value
-// sp_name -- the name of the property.
-// Defines a function in phelp_helper with sp_name##_gs as its name
-// that depends on m_##sp_name being the member of the class which
-// corresponds to the sp_name property in ActionScript.
-// See BlurFilter_as.cpp for usage.
-//
-#ifdef phelp_done
-#undef phelp_helper
-#undef phelp_property
-#undef phelp_array_property
-#undef phelp_base_def
-#undef phelp_base_imp
-#undef phelp_gs
-#undef phelp_gs_attach
-#undef phelp_gs_attach_begin
-#undef phelp_gs_attach_end
-#undef phelp_gs_attach_empty
-#undef phelp_i
-#undef phelp_i_attach
-#undef phelp_i_attach_begin
-#undef phelp_i_attach_end
-#undef phelp_i_attach_empty
-#else /* phelp_done */
-#ifdef phelp_helper
-
-#define phelp_property(sp_type, sp_convert, sp_name) \
-as_value \
-phelp_helper::sp_name##_gs(const fn_call& fn) \
-{ \
- boost::intrusive_ptr<phelp_helper> ptr =
ensureType<phelp_helper>(fn.this_ptr); \
-\
- if (fn.nargs == 0) /* getter */ \
- { \
- return as_value(ptr->m_##sp_name ); \
- } \
- /* setter */ \
- sp_type sp_##sp_name = fn.arg(0).to_##sp_convert (); \
- ptr->m_##sp_name = sp_##sp_name; \
-\
- return as_value(); \
-}
-
-#define phelp_array_property(sp_name) \
-as_value \
-phelp_helper::sp_name##_gs(const fn_call& fn) \
-{ \
- boost::intrusive_ptr<phelp_helper> ptr =
ensureType<phelp_helper>(fn.this_ptr); \
- return as_value(); \
-}
-#if 0
- boost::intrusive_ptr<phelp_helper> ptr =
ensureType<phelp_helper>(fn.this_ptr); \
-\
- if (fn.nargs == 0) /* getter */ \
- { \
- boost::intrusive_ptr<as_object> tmp =
ensureType<as_object>(ptr->m_##sp_name); \
- return as_value(tmp); \
- } \
- /* setter */ \
- boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object(); \
- boost::intrusive_ptr<as_array_object> ap =
ensureType<as_array_object>(obj); \
- ptr->m_##sp_name = ap; \
-\
- return as_value(); \
-}
-#endif /* 0 */
-
-#define phelp_base_def \
-public: \
- phelp_helper(as_object *obj) : as_object(obj) { return; } \
- static as_object* Interface(); \
- static void attachInterface(as_object& o); \
- static void attachProperties(as_object& o); \
-\
- static void registerCtor(as_object& global); \
-\
- static as_value ctor(const fn_call& fn); \
-private: \
- static boost::intrusive_ptr<as_object> s_interface; \
- static boost::intrusive_ptr<builtin_function> s_ctor
-
-#define phelp_base_imp(sp_interface, sp_regname) \
-boost::intrusive_ptr<as_object> phelp_helper::s_interface; \
-boost:: intrusive_ptr<builtin_function> phelp_helper::s_ctor; \
-\
-as_object* \
-phelp_helper::Interface() \
-{ \
- if (phelp_helper::s_interface == NULL) \
- { \
- phelp_helper::s_interface = new as_object sp_interface; \
- VM::get().addStatic(phelp_helper::s_interface.get()); \
-\
- phelp_helper::attachInterface(*phelp_helper::s_interface); \
- } \
-\
- return phelp_helper::s_interface.get(); \
-} \
-\
-void \
-phelp_helper::registerCtor(as_object& global) \
-{ \
- if (phelp_helper::s_ctor != NULL) \
- return; \
-\
- phelp_helper::s_ctor = new builtin_function(&phelp_helper::ctor, \
- phelp_helper::Interface()); \
- VM::get().addStatic(phelp_helper::s_ctor.get()); \
-\
- /* TODO: Is this correct? */ \
- phelp_helper::attachInterface(*phelp_helper::s_ctor); \
-\
- global.init_member(#sp_regname , phelp_helper::s_ctor.get()); \
-} \
-\
-void sp_regname##_class_init(as_object& global) \
-{ \
- phelp_helper::registerCtor(global); \
-}
-
-#define phelp_i(sp_name) \
- static as_value sp_name(const fn_call& fn)
-
-#define phelp_gs(sp_name) \
- static as_value sp_name##_gs(const fn_call& fn)
-
-#define phelp_gs_attach_begin \
-void \
-phelp_helper::attachProperties(as_object& o) \
-{ \
- boost::intrusive_ptr<builtin_function> gs;
-
-#define phelp_gs_attach_end \
-}
-
-#define phelp_gs_attach_empty \
-void \
-phelp_helper::attachProperties(as_object& /* o */) \
-{ \
- return; \
-}
-
-#define phelp_gs_attach(sp_name) \
- gs = new builtin_function(phelp_helper::sp_name##_gs, NULL); \
- o.init_property(#sp_name , *gs, *gs)
-
-#define phelp_i_attach_begin \
-void \
-phelp_helper::attachInterface(as_object& o) \
-{ \
- boost::intrusive_ptr<builtin_function> gs;
-
-#define phelp_i_attach_end \
-}
-
-#define phelp_i_attach_empty \
-void \
-phelp_helper::attachInterface(as_object& /* o */) \
-{ \
-}
-
-#define phelp_i_attach(sp_name, sp_code_name) \
- o.init_member(#sp_name , new builtin_function(sp_code_name))
-
-#define phelp_i_replace(sp_name, sp_code_name) \
- o.set_member(VM::get().getStringTable().find(#sp_name), new
builtin_function(sp_code_name))
-
-#else /* phelp_helper */
-#error phelp_helper must be defined.
-#endif /* phelp_helper */
-#endif /* phelp_done */
-
=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp 2009-04-15 16:12:31 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp 2009-04-16 11:44:18 +0000
@@ -217,9 +217,6 @@
deleteAllChecked(pl);
}
- // It's supposed to be cleaned up in read()
- // TODO: join with loader thread instead ?
- //assert(m_jpeg_in->get() == NULL);
}
void
@@ -241,7 +238,7 @@
#ifndef GNASH_USE_GC
assert(ch == NULL || ch->get_ref_count() > 1);
#endif
- return ch.get(); // mm... why don't we return the boost::intrusive_ptr?
+ return ch.get();
}
void
@@ -278,9 +275,8 @@
BitmapInfo*
SWFMovieDefinition::getBitmap(int id) const
{
- Bitmaps::const_iterator it = _bitmaps.find(id);
+ const Bitmaps::const_iterator it = _bitmaps.find(id);
if (it == _bitmaps.end()) return 0;
-
return it->second.get();
}
@@ -289,7 +285,6 @@
{
assert(im);
_bitmaps.insert(std::make_pair(id, im));
-
}
sound_sample*
@@ -608,7 +603,7 @@
else if (_tag_loaders.get(tag, &lf)) {
// call the tag loader. The tag loader should add
// DisplayObjects or tags to the movie data structure.
- (*lf)(str, tag, *this, _runInfo);
+ lf(str, tag, *this, _runInfo);
}
else {
// no tag loader for this tag type.
=== modified file 'libcore/parser/filter_factory.cpp'
--- a/libcore/parser/filter_factory.cpp 2009-02-25 22:33:03 +0000
+++ b/libcore/parser/filter_factory.cpp 2009-04-16 14:32:04 +0000
@@ -275,33 +275,34 @@
return true;
}
-bool ConvolutionFilter::read(SWFStream& in)
+bool
+ConvolutionFilter::read(SWFStream& in)
{
in.ensureBytes(2 + 8);
- m_matrixX = in.read_u8(); // 1 byte
- m_matrixY = in.read_u8(); // 1 byte
-
- m_divisor = in.read_long_float(); // 4 bytes
- m_bias = in.read_long_float(); // 4 bytes
-
- size_t SWFMatrixCount = m_matrixX * m_matrixY;
+ _matrixX = in.read_u8(); // 1 byte
+ _matrixY = in.read_u8(); // 1 byte
+
+ _divisor = in.read_long_float(); // 4 bytes
+ _bias = in.read_long_float(); // 4 bytes
+
+ size_t SWFMatrixCount = _matrixX * _matrixY;
in.ensureBytes(SWFMatrixCount*4 + 4 + 1);
- m_matrix.reserve(SWFMatrixCount);
+ _matrix.reserve(SWFMatrixCount);
for (size_t i = 0; i < SWFMatrixCount; ++i)
{
- m_matrix.push_back(in.read_long_float());
+ _matrix.push_back(in.read_long_float());
}
- m_color = in.read_u8() << (16 + in.read_u8()) << (8 + in.read_u8());
- m_alpha = in.read_u8();
+ _color = in.read_u8() << (16 + in.read_u8()) << (8 + in.read_u8());
+ _alpha = in.read_u8();
static_cast<void> (in.read_uint(6)); // Throw away.
- m_clamp = in.read_bit();
- m_preserveAlpha = in.read_bit();
+ _clamp = in.read_bit();
+ _preserveAlpha = in.read_bit();
IF_VERBOSE_PARSE(
log_parse(" ConvolutionFilter ");
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-04-14 16:13:21 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-04-16 12:04:53 +0000
@@ -3359,19 +3359,18 @@
IF_VERBOSE_ACTION (
- log_action(_(" method name: %s"), method_name);
- log_action(_(" method object/func: %s"), obj_value);
- log_action(_(" method nargs: %d"), nargs);
+ log_action(_(" method name: %s"), method_name);
+ log_action(_(" method object/func: %s"), obj_value);
+ log_action(_(" method nargs: %d"), nargs);
);
std::string method_string = method_name.to_string();
- as_value method_val;
+
+ bool hasMethodName = ((!method_name.is_undefined()) &&
+ (!method_string.empty()) );
+
boost::intrusive_ptr<as_object> obj = obj_value.to_object();
-
- bool hasMethodName = ( (!method_name.is_undefined()) &&
(!method_string.empty()) );
-
- if ( ! obj )
- {
+ if (!obj) {
// SWF integrity check
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionCallMethod invoked with "
@@ -3390,39 +3389,41 @@
}
as_object* super = obj->get_super(hasMethodName ? method_string.c_str() :
0);
- if ( ! hasMethodName )
- {
+ as_value method_val;
+
+ if (!hasMethodName) {
// We'll be calling the super constructor here
method_val = obj_value;
- if ( ! method_val.is_function() )
+ if (!method_val.is_function())
{
-//#ifdef GNASH_DEBUG
log_debug(_("Function object given to ActionCallMethod"
" is not a function (%s), will try to use"
- " its 'constructor' member (but should instead invoke
it's [[Call]] method"),
- obj_value);
-//#endif
+ " its 'constructor' member (but should instead "
+ "invoke its [[Call]] method"), obj_value);
- // TODO: all this crap should go into an as_object::getConstructor
instead
+ // TODO: all this crap should go into an
+ // as_object::getConstructor instead
as_value ctor;
if (!obj->get_member(NSV::PROP_CONSTRUCTOR, &ctor) )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("ActionCallMethod: object has no constructor"));
+ log_aserror(_("ActionCallMethod: object has no "
+ "constructor"));
);
env.drop(nargs);
- env.push(as_value());
+ env.push(as_value());
return;
}
- if ( ! ctor.is_function() )
+ if (!ctor.is_function())
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("ActionCallMethod: object constructor is not a
function"));
+ log_aserror(_("ActionCallMethod: object constructor "
+ "is not a function"));
);
env.drop(nargs);
- env.push(as_value());
+ env.push(as_value());
return;
}
method_val = ctor;
@@ -3430,6 +3431,7 @@
}
else
{
+
if ( ! thread.getObjectMember(*obj, method_string, method_val) )
{
IF_VERBOSE_ASCODING_ERRORS(
@@ -3468,12 +3470,7 @@
env.push(result);
// Now, if there was an exception, proceed to the end of the block.
- if (result.is_exception())
- {
- thread.skipRemainingBuffer();
- }
- // This is to check stack status after call method
- //log_debug(_("at doActionCallMethod() end, stack: ")); env.dump_stack();
+ if (result.is_exception()) thread.skipRemainingBuffer();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10802: Drop the prophelper file and write the filter classes out instead, so they,
Benjamin Wolsey <=