[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10479: Minor cleanups to Color clas
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10479: Minor cleanups to Color class and others. |
Date: |
Tue, 23 Dec 2008 08:41:12 -0700 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10479
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-12-23 08:41:12 -0700
message:
Minor cleanups to Color class and others.
renamed:
libcore/asobj/Color.cpp => libcore/asobj/Color_as.cpp
libcore/asobj/Color.h => libcore/asobj/Color_as.h
modified:
libcore/asobj/ClassHierarchy.cpp
libcore/asobj/Error_as.cpp
libcore/asobj/Global.cpp
libcore/asobj/Makefile.am
libcore/asobj/Color_as.cpp
libcore/asobj/Color_as.h
------------------------------------------------------------
revno: 10478.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-22 07:57:10 -0700
message:
Clean up Color class.
renamed:
libcore/asobj/Color.cpp => libcore/asobj/Color_as.cpp
libcore/asobj/Color.h => libcore/asobj/Color_as.h
modified:
libcore/asobj/ClassHierarchy.cpp
libcore/asobj/Error_as.cpp
libcore/asobj/Global.cpp
libcore/asobj/Makefile.am
libcore/asobj/Color_as.cpp
libcore/asobj/Color_as.h
=== modified file 'libcore/asobj/ClassHierarchy.cpp'
--- a/libcore/asobj/ClassHierarchy.cpp 2008-12-19 20:47:50 +0000
+++ b/libcore/asobj/ClassHierarchy.cpp 2008-12-22 14:57:10 +0000
@@ -26,7 +26,7 @@
#include "Accessibility_as.h"
#include "Boolean.h"
#include "Camera.h"
-#include "Color.h"
+#include "Color_as.h"
#include "ContextMenu.h"
#include "CustomActions.h"
#include "Date.h"
=== renamed file 'libcore/asobj/Color.cpp' => 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color.cpp 2008-10-25 10:38:32 +0000
+++ b/libcore/asobj/Color_as.cpp 2008-12-22 14:57:10 +0000
@@ -21,7 +21,7 @@
#include "gnashconfig.h"
#endif
-#include "Color.h"
+#include "Color_as.h"
#include "as_object.h" // for inheritance
#include "log.h"
#include "fn_call.h"
@@ -38,66 +38,31 @@
namespace gnash {
-static as_value color_getrgb(const fn_call& fn);
-static as_value color_gettransform(const fn_call& fn);
-static as_value color_setrgb(const fn_call& fn);
-static as_value color_settransform(const fn_call& fn);
-static as_value color_ctor(const fn_call& fn);
-
-void registerColorNative(as_object& o)
-{
- VM& vm = o.getVM();
-
- vm.registerNative(color_setrgb, 700, 0);
- vm.registerNative(color_settransform, 700, 1);
- vm.registerNative(color_getrgb, 700, 2);
- vm.registerNative(color_gettransform, 700, 3);
-}
-
-static void
-attachColorInterface(as_object& o)
-{
- VM& vm = o.getVM();
-
- const int flags = as_prop_flags::dontEnum |
- as_prop_flags::dontDelete |
- as_prop_flags::readOnly;
-
- // Color.setRGB
- o.init_member("setRGB", vm.getNative(700, 0), flags);
- // Color.setTransform
- o.init_member("setTransform", vm.getNative(700, 1), flags);
- // Color.getRGB
- o.init_member("getRGB", vm.getNative(700, 2), flags);
- // Color.getTransform
- o.init_member("getTransform", vm.getNative(700, 3), flags);
-
-}
-
-static as_object*
-getColorInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( ! o )
- {
- o = new as_object(getObjectInterface());
- attachColorInterface(*o);
- }
- return o.get();
-}
-
-class color_as_object: public as_object
+// Forward declarations.
+namespace {
+ as_value color_getrgb(const fn_call& fn);
+ as_value color_gettransform(const fn_call& fn);
+ as_value color_setrgb(const fn_call& fn);
+ as_value color_settransform(const fn_call& fn);
+ as_value color_ctor(const fn_call& fn);
+
+ as_object* getColorInterface();
+}
+
+
+
+class Color_as: public as_object
{
public:
- color_as_object()
+ Color_as()
:
as_object(getColorInterface()),
_sprite(0)
{}
- color_as_object(MovieClip* sp)
+ Color_as(MovieClip* sp)
:
as_object(getColorInterface()),
_sprite(sp)
@@ -159,10 +124,68 @@
};
-static as_value
+void registerColorNative(as_object& o)
+{
+ VM& vm = o.getVM();
+
+ vm.registerNative(color_setrgb, 700, 0);
+ vm.registerNative(color_settransform, 700, 1);
+ vm.registerNative(color_getrgb, 700, 2);
+ vm.registerNative(color_gettransform, 700, 3);
+}
+
+// extern (used by Global.cpp)
+void color_class_init(as_object& global)
+{
+ // This is going to be the global Color "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&color_ctor, getColorInterface());
+ }
+
+ // Register _global.Color
+ global.init_member("Color", cl.get());
+
+}
+
+
+namespace {
+
+void
+attachColorInterface(as_object& o)
+{
+ VM& vm = o.getVM();
+
+ const int flags = as_prop_flags::dontEnum |
+ as_prop_flags::dontDelete |
+ as_prop_flags::readOnly;
+
+ o.init_member("setRGB", vm.getNative(700, 0), flags);
+ o.init_member("setTransform", vm.getNative(700, 1), flags);
+ o.init_member("getRGB", vm.getNative(700, 2), flags);
+ o.init_member("getTransform", vm.getNative(700, 3), flags);
+
+}
+
+as_object*
+getColorInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object(getObjectInterface());
+ attachColorInterface(*o);
+ }
+ return o.get();
+}
+
+
+as_value
color_getrgb(const fn_call& fn)
{
- boost::intrusive_ptr<color_as_object> obj =
ensureType<color_as_object>(fn.this_ptr);
+ boost::intrusive_ptr<Color_as> obj = ensureType<Color_as>(fn.this_ptr);
MovieClip* sp = obj->getSprite();
if ( ! sp ) return as_value();
@@ -178,10 +201,10 @@
return as_value(rgb);
}
-static as_value
+as_value
color_gettransform(const fn_call& fn)
{
- boost::intrusive_ptr<color_as_object> obj =
ensureType<color_as_object>(fn.this_ptr);
+ boost::intrusive_ptr<Color_as> obj = ensureType<Color_as>(fn.this_ptr);
MovieClip* sp = obj->getSprite();
if ( ! sp )
@@ -193,7 +216,7 @@
return as_value();
}
- cxform cx = obj->getTransform();
+ const cxform& cx = obj->getTransform();
// Convert to as_object
@@ -212,10 +235,10 @@
return ret;
}
-static as_value
+as_value
color_setrgb(const fn_call& fn)
{
- boost::intrusive_ptr<color_as_object> obj =
ensureType<color_as_object>(fn.this_ptr);
+ boost::intrusive_ptr<Color_as> obj = ensureType<Color_as>(fn.this_ptr);
if ( fn.nargs < 1 )
{
@@ -244,8 +267,9 @@
return as_value();
}
-static inline void
-parseColorTransProp (as_object& obj, string_table::key key, boost::int16_t
*target, bool scale)
+inline void
+parseColorTransProp (as_object& obj, string_table::key key,
+ boost::int16_t *target, bool scale)
{
as_value tmp;
double d;
@@ -263,10 +287,10 @@
}
}
-static as_value
+as_value
color_settransform(const fn_call& fn)
{
- boost::intrusive_ptr<color_as_object> obj =
ensureType<color_as_object>(fn.this_ptr);
+ boost::intrusive_ptr<Color_as> obj = ensureType<Color_as>(fn.this_ptr);
if ( fn.nargs < 1 )
{
@@ -281,7 +305,8 @@
{
IF_VERBOSE_ASCODING_ERRORS(
std::stringstream ss; fn.dump_args(ss);
- log_aserror(_("Color.setTransform(%s) : first argument doesn't
cast to an object"), ss.str());
+ log_aserror(_("Color.setTransform(%s) : first argument doesn't "
+ "cast to an object"), ss.str());
);
return as_value();
}
@@ -291,7 +316,8 @@
{
IF_VERBOSE_ASCODING_ERRORS(
std::stringstream ss; fn.dump_args(ss);
- log_aserror(_("Color.setTransform(%s) : no or unloaded sprite
associated with the Color object"), ss.str());
+ log_aserror(_("Color.setTransform(%s) : no or unloaded sprite "
+ "associated with the Color object"), ss.str());
);
return as_value();
}
@@ -331,7 +357,7 @@
return as_value();
}
-static as_value
+as_value
color_ctor(const fn_call& fn)
{
MovieClip* sp=0;
@@ -355,10 +381,11 @@
if ( ! sp )
{
std::stringstream ss; fn.dump_args(ss);
- log_aserror(_("new Color(%s) : first argument
evaluates to character %s which is a %s (not a sprite)"),
- ss.str(), ch->getTarget(),
typeName(*ch));
+ log_aserror(_("new Color(%s) : first argument
evaluates "
+ "to character %s which is a %s (not a
sprite)"),
+ ss.str(), ch->getTarget(),
typeName(*ch));
}
- )
+ );
}
else
{
@@ -371,26 +398,10 @@
}
}
- boost::intrusive_ptr<as_object> obj = new color_as_object(sp);
+ boost::intrusive_ptr<as_object> obj = new Color_as(sp);
return as_value(obj.get()); // will keep alive
}
-// extern (used by Global.cpp)
-void color_class_init(as_object& global)
-{
- // This is going to be the global Color "class"/"function"
- static boost::intrusive_ptr<builtin_function> cl;
-
- if ( cl == NULL )
- {
- cl=new builtin_function(&color_ctor, getColorInterface());
- }
-
- // Register _global.Color
- global.init_member("Color", cl.get());
-
-}
-
-
+} // anonymous namespace
} // end of gnash namespace
=== renamed file 'libcore/asobj/Color.h' => 'libcore/asobj/Color_as.h'
--- a/libcore/asobj/Color.h 2008-04-17 09:22:21 +0000
+++ b/libcore/asobj/Color_as.h 2008-12-22 14:57:10 +0000
@@ -16,10 +16,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifndef __GNASH_ASOBJ_COLOR_H__
-#define __GNASH_ASOBJ_COLOR_H__
-
-#include <memory> // for auto_ptr
+#ifndef GNASH_ASOBJ_COLOR_H
+#define GNASH_ASOBJ_COLOR_H
namespace gnash {
@@ -32,6 +30,5 @@
} // end of gnash namespace
-// __GNASH_ASOBJ_COLOR_H__
#endif
=== modified file 'libcore/asobj/Error_as.cpp'
--- a/libcore/asobj/Error_as.cpp 2008-06-29 15:53:24 +0000
+++ b/libcore/asobj/Error_as.cpp 2008-12-22 14:57:10 +0000
@@ -50,11 +50,6 @@
o.init_property("name", Error_name_getset, Error_name_getset);
}
-static void
-attachErrorStaticProperties(as_object& /*o*/)
-{
-
-}
static as_object*
getErrorInterface()
@@ -161,7 +156,6 @@
// in the 'where' package
boost::intrusive_ptr<builtin_function> cl;
cl = new builtin_function(&Error_ctor, getErrorInterface());
- attachErrorStaticProperties(*cl);
// Register _global.Error
where.init_member("Error", cl.get());
=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp 2008-12-19 20:47:50 +0000
+++ b/libcore/asobj/Global.cpp 2008-12-22 14:57:10 +0000
@@ -30,7 +30,7 @@
#include "AsBroadcaster.h"
#include "Boolean.h"
#include "Camera.h"
-#include "Color.h"
+#include "Color_as.h"
#include "ContextMenu.h"
#include "CustomActions.h"
#include "Date.h" // for registerDateNative
=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2008-12-19 20:47:50 +0000
+++ b/libcore/asobj/Makefile.am 2008-12-22 14:57:10 +0000
@@ -47,7 +47,7 @@
Boolean.cpp \
Camera.cpp \
ClassHierarchy.cpp \
- Color.cpp \
+ Color_as.cpp \
ContextMenu.cpp \
CustomActions.cpp\
Date.cpp \
@@ -112,7 +112,7 @@
Boolean.h \
Camera.h \
ClassHierarchy.h \
- Color.h \
+ Color_as.h \
ContextMenu.h \
CustomActions.h \
Date.h \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10479: Minor cleanups to Color class and others.,
Benjamin Wolsey <=