gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11519: Tidy up AS3 filter.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11519: Tidy up AS3 filter.
Date: Thu, 24 Sep 2009 10:23:51 +0200
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11519 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-09-24 10:23:51 +0200
message:
  Tidy up AS3 filter.
modified:
  libcore/asobj/flash/filters/DisplacementMapFilter_as.cpp
  libcore/asobj/flash/filters/filters_pkg.cpp
=== modified file 'libcore/asobj/flash/filters/DisplacementMapFilter_as.cpp'
--- a/libcore/asobj/flash/filters/DisplacementMapFilter_as.cpp  2009-08-18 
15:31:33 +0000
+++ b/libcore/asobj/flash/filters/DisplacementMapFilter_as.cpp  2009-09-24 
06:09:43 +0000
@@ -28,201 +28,173 @@
 #include "Global_as.h"
 #include "smart_ptr.h" // for boost intrusive_ptr
 #include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
 #include "Object.h" // for AS inheritance
-#include "VM.h" // for addStatics
+#include "BitmapFilter_as.h"
 
 #include <sstream>
 
 namespace gnash {
 
-static as_value DisplacementMapFilter_clone(const fn_call& fn);
-static as_value DisplacementMapFilter_alpha_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_color_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_componentX_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_componentY_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_mapBitmap_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_mapPoint_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_mode_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_scaleX_getset(const fn_call& fn);
-static as_value DisplacementMapFilter_scaleY_getset(const fn_call& fn);
-
-
-as_value DisplacementMapFilter_ctor(const fn_call& fn);
-
-static void
+namespace {
+
+    as_value displacementmapfilter_clone(const fn_call& fn);
+    as_value displacementmapfilter_alpha(const fn_call& fn);
+    as_value displacementmapfilter_color(const fn_call& fn);
+    as_value displacementmapfilter_componentX(const fn_call& fn);
+    as_value displacementmapfilter_componentY(const fn_call& fn);
+    as_value displacementmapfilter_mapBitmap(const fn_call& fn);
+    as_value displacementmapfilter_mapPoint(const fn_call& fn);
+    as_value displacementmapfilter_mode(const fn_call& fn);
+    as_value displacementmapfilter_scaleX(const fn_call& fn);
+    as_value displacementmapfilter_scaleY(const fn_call& fn);
+    as_value displacementmapfilter_ctor(const fn_call& fn);
+    void attachDisplacementMapFilterInterface(as_object& o);
+
+}
+
+/// TODO: this should probably look something like the other filter classes.
+class DisplacementMapFilter_as : public Relay
+{
+public:
+       DisplacementMapFilter_as() {}
+};
+
+// This is an AS3 class, and there are no tests for it.
+void
+displacementmapfilter_class_init(as_object& where, const ObjectURI& uri)
+{
+    registerBitmapClass(where, displacementmapfilter_ctor,
+            attachDisplacementMapFilterInterface, uri);
+}
+
+namespace {
+
+void
 attachDisplacementMapFilterInterface(as_object& o)
 {
     Global_as* gl = getGlobal(o);
-    o.init_member("clone", gl->createFunction(DisplacementMapFilter_clone));
-    o.init_property("alpha", DisplacementMapFilter_alpha_getset, 
DisplacementMapFilter_alpha_getset);
-    o.init_property("color", DisplacementMapFilter_color_getset, 
DisplacementMapFilter_color_getset);
-    o.init_property("componentX", DisplacementMapFilter_componentX_getset, 
DisplacementMapFilter_componentX_getset);
-    o.init_property("componentY", DisplacementMapFilter_componentY_getset, 
DisplacementMapFilter_componentY_getset);
-    o.init_property("mapBitmap", DisplacementMapFilter_mapBitmap_getset, 
DisplacementMapFilter_mapBitmap_getset);
-    o.init_property("mapPoint", DisplacementMapFilter_mapPoint_getset, 
DisplacementMapFilter_mapPoint_getset);
-    o.init_property("mode", DisplacementMapFilter_mode_getset, 
DisplacementMapFilter_mode_getset);
-    o.init_property("scaleX", DisplacementMapFilter_scaleX_getset, 
DisplacementMapFilter_scaleX_getset);
-    o.init_property("scaleY", DisplacementMapFilter_scaleY_getset, 
DisplacementMapFilter_scaleY_getset);
-}
-
-static void
-attachDisplacementMapFilterStaticProperties(as_object& /*o*/)
-{
-}
-
-static as_object*
-getDisplacementMapFilterInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-
-       if ( ! o )
-       {
-               // TODO: check if this class should inherit from Object
-               //       or from a different class
-               o = new as_object(getObjectInterface());
-               VM::get().addStatic(o.get());
-
-               attachDisplacementMapFilterInterface(*o);
-
-       }
-
-       return o.get();
-}
-
-class DisplacementMapFilter_as: public as_object
-{
-
-public:
-
-       DisplacementMapFilter_as()
-               :
-               as_object(getDisplacementMapFilterInterface())
-       {}
-};
-
-
-static as_value
-DisplacementMapFilter_clone(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_alpha_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_color_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_componentX_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_componentY_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_mapBitmap_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_mapPoint_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_mode_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_scaleX_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-DisplacementMapFilter_scaleY_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<DisplacementMapFilter_as> ptr = 
ensureType<DisplacementMapFilter_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-
-
-as_value
-DisplacementMapFilter_ctor(const fn_call& fn)
-{
-       boost::intrusive_ptr<as_object> obj = new DisplacementMapFilter_as;
-
-       if ( fn.nargs )
-       {
-               std::stringstream ss;
-               fn.dump_args(ss);
-               LOG_ONCE( log_unimpl("DisplacementMapFilter(%s): %s", ss.str(), 
_("arguments discarded")) );
-       }
-
-       return as_value(obj.get()); // will keep alive
-}
-
-// extern 
-void displacementmapfilter_class_init(as_object& where, const ObjectURI& uri)
-{
-       // This is going to be the DisplacementMapFilter "class"/"function"
-       // in the 'where' package
-       boost::intrusive_ptr<as_object> cl;
-        Global_as* gl = getGlobal(where);
-        as_object* proto = getDisplacementMapFilterInterface();
-        cl = gl->createClass(&DisplacementMapFilter_ctor, proto);
-       attachDisplacementMapFilterStaticProperties(*cl);
-
-       // Register _global.DisplacementMapFilter
-       where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
-            getNamespace(uri));
-}
+    o.init_member("clone", gl->createFunction(displacementmapfilter_clone));
+    o.init_property("alpha", displacementmapfilter_alpha, 
displacementmapfilter_alpha);
+    o.init_property("color", displacementmapfilter_color, 
displacementmapfilter_color);
+    o.init_property("componentX", displacementmapfilter_componentX, 
displacementmapfilter_componentX);
+    o.init_property("componentY", displacementmapfilter_componentY, 
displacementmapfilter_componentY);
+    o.init_property("mapBitmap", displacementmapfilter_mapBitmap, 
displacementmapfilter_mapBitmap);
+    o.init_property("mapPoint", displacementmapfilter_mapPoint, 
displacementmapfilter_mapPoint);
+    o.init_property("mode", displacementmapfilter_mode, 
displacementmapfilter_mode);
+    o.init_property("scaleX", displacementmapfilter_scaleX, 
displacementmapfilter_scaleX);
+    o.init_property("scaleY", displacementmapfilter_scaleY, 
displacementmapfilter_scaleY);
+}
+
+
+as_value
+displacementmapfilter_clone(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_alpha(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_color(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_componentX(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_componentY(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_mapBitmap(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_mapPoint(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_mode(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_scaleX(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_scaleY(const fn_call& fn)
+{
+       DisplacementMapFilter_as* ptr = 
+        ensureNativeType<DisplacementMapFilter_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+displacementmapfilter_ctor(const fn_call& fn)
+{
+       boost::intrusive_ptr<as_object> obj = 
ensureType<as_object>(fn.this_ptr);
+       obj->setRelay(new DisplacementMapFilter_as);
+    return as_value(); 
+}
+
+}
+
 
 } // end of gnash namespace

=== modified file 'libcore/asobj/flash/filters/filters_pkg.cpp'
--- a/libcore/asobj/flash/filters/filters_pkg.cpp       2009-09-22 08:31:25 
+0000
+++ b/libcore/asobj/flash/filters/filters_pkg.cpp       2009-09-24 05:59:01 
+0000
@@ -39,7 +39,9 @@
 
 namespace gnash {
 
-static as_value
+namespace {
+
+as_value
 get_flash_filters_package(const fn_call& fn)
 {
 
@@ -74,6 +76,8 @@
     return pkg;
 }
 
+} // anonymous namespace
+
 void
 flash_filters_package_init(as_object& where, const ObjectURI& uri)
 {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]