gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash server/BevelFilter.cpp server/BevelFilter...


From: Chad Musick
Subject: [Gnash-commit] gnash server/BevelFilter.cpp server/BevelFilter...
Date: Mon, 27 Aug 2007 03:06:43 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/08/27 03:06:43

Modified files:
        server         : BevelFilter.cpp BevelFilter.h BitmapFilter.h 
                         stream.cpp 
        server/asobj   : Makefile.am 
        server/parser  : filter_factory.cpp 
        server/vm      : ASHandlers.cpp ASHandlers.h 
        .              : ChangeLog 
Added files:
        server/asobj   : BevelFilter_as.cpp BevelFilter_as.h 
                         BitmapFilter_as.h BitmapFilter_as.cpp 

Log message:
        Make Filters more compatible with ActionScript -- this commit includes 
such
        changes for BitmapFilter and BevelFilter. More to follow.
        Remove some dead code from stream.cpp and fix some compiler dependant 
code
        in ASHandlers.  Fix a typing bug in filter_factory.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BevelFilter.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BevelFilter.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BitmapFilter.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/BevelFilter_as.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/BevelFilter_as.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/BitmapFilter_as.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/BitmapFilter_as.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/filter_factory.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.127&r2=1.128
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4108&r2=1.4109

Patches:
Index: server/BevelFilter.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/BevelFilter.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/BevelFilter.cpp      26 Aug 2007 15:14:10 -0000      1.1
+++ server/BevelFilter.cpp      27 Aug 2007 03:06:41 -0000      1.2
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: BevelFilter.cpp,v 1.1 2007/08/26 15:14:10 cmusick Exp $ */
+/* $Id: BevelFilter.cpp,v 1.2 2007/08/27 03:06:41 cmusick Exp $ */
 
 #include "BevelFilter.h"
 
@@ -30,6 +30,9 @@
     Filter p(new BevelFilter(m_distance, m_angle, m_highlightColor,
         m_highlightAlpha, m_shadowColor, m_shadowAlpha,
         m_blurX, m_blurY, m_strength, m_quality, m_type, m_knockout));
+    p->set_prototype(get_prototype());
+    p->copyProperties(*this);
+
     return p;
 }
 

Index: server/BevelFilter.h
===================================================================
RCS file: /sources/gnash/gnash/server/BevelFilter.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/BevelFilter.h        26 Aug 2007 15:14:10 -0000      1.1
+++ server/BevelFilter.h        27 Aug 2007 03:06:41 -0000      1.2
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: BevelFilter.h,v 1.1 2007/08/26 15:14:10 cmusick Exp $ */
+/* $Id: BevelFilter.h,v 1.2 2007/08/27 03:06:41 cmusick Exp $ */
 
 #ifndef GNASH_BEVELFILTER_H
 #define GNASH_BEVELFILTER_H
@@ -28,10 +28,14 @@
 
 namespace gnash {
 
+class BevelFilter_as; // Adapter class for AS use.
+
 // A bevel effect filter.
 class BevelFilter : public BitmapFilter
 {
 public:
+    friend class BevelFilter_as;
+
     typedef enum
     {
         OUTER_BEVEL = 1,
@@ -48,6 +52,13 @@
     // Guaranteed to return an object which can be cast to BlurFilter
     Filter const clone();
 
+    BevelFilter(as_object* o) : BitmapFilter(o),
+        m_distance(0.0f), m_angle(0.0f), m_highlightColor(0),
+        m_highlightAlpha(0), m_shadowColor(0), m_shadowAlpha(0),
+        m_blurX(0.0f), m_blurY(0.0f),  m_strength(0.0f), m_quality(0),
+        m_type(FULL_BEVEL), m_knockout(false)
+    { return; }
+
     BevelFilter() : 
         m_distance(0.0f), m_angle(0.0f), m_highlightColor(0),
         m_highlightAlpha(0), m_shadowColor(0), m_shadowAlpha(0),

Index: server/BitmapFilter.h
===================================================================
RCS file: /sources/gnash/gnash/server/BitmapFilter.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/BitmapFilter.h       26 Aug 2007 15:14:10 -0000      1.1
+++ server/BitmapFilter.h       27 Aug 2007 03:06:41 -0000      1.2
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: BitmapFilter.h,v 1.1 2007/08/26 15:14:10 cmusick Exp $ */
+/* $Id: BitmapFilter.h,v 1.2 2007/08/27 03:06:41 cmusick Exp $ */
 
 #ifndef GNASH_BITMAPFILTER_H
 #define GNASH_BITMAPFILTER_H
@@ -30,20 +30,26 @@
 
 class stream;
 class BitmapFilter;
-
+class BitmapFilter_as; // Adapter pattern to ActionScript
 typedef boost::intrusive_ptr<BitmapFilter> Filter;
 
 // The common base class for AS display filters.
 class BitmapFilter : public as_object
 {
 public:
+    friend class BitmapFilter_as;
+
     // Fill from a stream. See parser/filter_factory.cpp for the 
implementations.
-    virtual bool read(stream* in) = 0;
+    virtual bool read(stream* /*in*/) { return true; }
 
+    // Pass the interface up the chain.
+    BitmapFilter(as_object *interface) : as_object(interface) { return; }
+    // For non-ActionScript use.
+    BitmapFilter() { return; }
     virtual ~BitmapFilter() { return; }
 
     // Clone this object and return a copy of it. (AS accessible function.)
-    Filter const clone();
+    virtual Filter const clone() { return NULL; }
 };
 
 } // Namespace gnash

Index: server/stream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/stream.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/stream.cpp   26 Aug 2007 15:14:12 -0000      1.25
+++ server/stream.cpp   27 Aug 2007 03:06:41 -0000      1.26
@@ -116,14 +116,8 @@
 
        float   stream::read_fixed()
        {
-#if 0 /* Chad */
-               m_unused_bits = 0;
-               int32_t val = m_input->read_le32();
-               return (float) val / 65536.0f;
-#else
                align();
                return static_cast<float> (static_cast<double> 
(static_cast<long int> (m_input->read_le32())) / 65536.0f);
-#endif /* Chad */
        }
 
        // float is not large enough to hold a 32 bit value without doing the 
wrong thing with the sign.

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/asobj/Makefile.am    1 Jul 2007 10:54:28 -0000       1.41
+++ server/asobj/Makefile.am    27 Aug 2007 03:06:42 -0000      1.42
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-# $Id: Makefile.am,v 1.41 2007/07/01 10:54:28 bjacques Exp $
+# $Id: Makefile.am,v 1.42 2007/08/27 03:06:42 cmusick Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -43,6 +43,8 @@
 
 
 libgnashasobjs_la_SOURCES = \
+        BevelFilter_as.cpp \
+        BitmapFilter_as.cpp \
        Boolean.cpp     \
        Camera.cpp      \
        Color.cpp       \
@@ -76,6 +78,8 @@
        $(NULL)
 
 noinst_HEADERS = \
+        BevelFilter_as.h \
+        BitmapFilter_as.h \
        Boolean.h       \
        Camera.h        \
        Color.h         \

Index: server/parser/filter_factory.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/filter_factory.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/parser/filter_factory.cpp    26 Aug 2007 15:14:13 -0000      1.1
+++ server/parser/filter_factory.cpp    27 Aug 2007 03:06:42 -0000      1.2
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: filter_factory.cpp,v 1.1 2007/08/26 15:14:13 cmusick Exp $ */
+/* $Id: filter_factory.cpp,v 1.2 2007/08/27 03:06:42 cmusick Exp $ */
 
 #include "filter_factory.h"
 #include "BitmapFilter.h"
@@ -196,7 +196,7 @@
 
 bool GradientGlowFilter::read(stream* in)
 {
-    bool count = in->read_u8(); // How many colorings.
+    uint8_t count = in->read_u8(); // How many colorings.
 
     for (int i = 0; i < count; ++i)
     {
@@ -265,7 +265,7 @@
 
 bool GradientBevelFilter::read(stream* in)
 {
-    bool count = in->read_u8(); // How many colorings.
+    uint8_t count = in->read_u8(); // How many colorings.
 
     for (int i = 0; i < count; ++i)
     {

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -b -r1.127 -r1.128
--- server/vm/ASHandlers.cpp    25 Aug 2007 16:10:37 -0000      1.127
+++ server/vm/ASHandlers.cpp    27 Aug 2007 03:06:42 -0000      1.128
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: ASHandlers.cpp,v 1.127 2007/08/25 16:10:37 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.128 2007/08/27 03:06:42 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1386,7 +1386,7 @@
 }
 
 as_encoding_guess_t
-SWFHandlers::GuessEncoding(std::string &str, int &length, int *offsets)
+SWFHandlers::GuessEncoding(std::string &str, int &length, std::vector<int>& 
offsets)
 {
     const char *cstr = str.c_str();
     const char *i = cstr;
@@ -1409,7 +1409,7 @@
             continue;
         }
         ++length;
-        *(offsets + length - 1) = index;
+        offsets[length - 1] = index;
 
         if ((j & 0xC0) == 0x80)
             continue; // A 1 byte character.
@@ -1422,7 +1422,7 @@
         else if (j & 0x80)
             is_sought = false;
     }
-    *(offsets + length - 1) = index;
+    offsets[length - 1] = index;
     if (!width && is_sought) // No width left, so it's almost certainly UTF8.
         return ENCGUESS_UNICODE;
 
@@ -1448,7 +1448,7 @@
         }
 
         ++length;
-        *(offsets + length - 1) = index;
+        offsets[length - 1] = index;
 
         if ((j == 0x80) || (j == 0xA0) || (j >= 0xF0))
         {
@@ -1464,7 +1464,7 @@
         }
         
     }
-    *(offsets + length - 1) = index;
+    offsets[length - 1] = index;
     if (!width && is_sought) // No width left, so it's probably SHIFT_JIS.
         return ENCGUESS_JIS;
 
@@ -1491,7 +1491,8 @@
     else
     {
         int length;
-        (void) GuessEncoding(str, length, NULL);
+        std::vector<int> unused;
+        (void) GuessEncoding(str, length, unused);
         env.top(0).set_int(length);
     }
 }
@@ -1571,7 +1572,8 @@
 
     string str = string_val.to_string(&env);
     int length = 0;
-    int offsets[str.length() + 1];
+    std::vector<int> offsets;
+    offsets.reserve(str.length() + 1);
 
     as_encoding_guess_t encoding = GuessEncoding(str, length, offsets);
 

Index: server/vm/ASHandlers.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/vm/ASHandlers.h      20 Aug 2007 03:25:09 -0000      1.9
+++ server/vm/ASHandlers.h      27 Aug 2007 03:06:42 -0000      1.10
@@ -165,7 +165,8 @@
         // and the offsets to the characters in offsets, if offsets is not 
NULL.
         // If not NULL, offsets should be at least s.length().
         // offsets are not accurate if the return value is GUESSENC_OTHER
-        static as_encoding_guess_t GuessEncoding(std::string& s, int& length, 
int *offsets);
+        static as_encoding_guess_t GuessEncoding(std::string& s, int& length,
+            std::vector<int>& offsets);
 
        static void ActionEnd(ActionExec& thread);
        static void ActionNextFrame(ActionExec& thread);

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4108
retrieving revision 1.4109
diff -u -b -r1.4108 -r1.4109
--- ChangeLog   26 Aug 2007 20:56:50 -0000      1.4108
+++ ChangeLog   27 Aug 2007 03:06:42 -0000      1.4109
@@ -1,3 +1,17 @@
+2007-08-27 Chad Musick <address@hidden>
+
+       * server/BevelFilter.cpp,.h: Fuller conversion to AS compatible
+       * server/BitmapFilter.h: Fuller conversion to AS compatible
+       * server/stream.cpp: Remove dead code from read_fixed
+       * server/asobj/Makefile.am Add new files
+       * server/parser/filter_factory.cpp: Removed typo bug pointed out by
+         Zou.
+       * server/vm/ASHandlers.cpp,.h: Remove use of variable sized array.
+       * server/asobj/BevelFilter_as.cpp,.h: Adapter pattern object for using
+         BevelFilter inside of ActionScript (not yet put in global)
+       * server/asobj/BitmapFilter_as.cpp,.h: Adapater pattern object for
+         using BitmapFilter inside of ActionScript (not yet put in global)
+
 2007-08-26 Deanna Phillips <deanna>
 
        * doc/gnash.1: Updated.

Index: server/asobj/BevelFilter_as.cpp
===================================================================
RCS file: server/asobj/BevelFilter_as.cpp
diff -N server/asobj/BevelFilter_as.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/BevelFilter_as.cpp     27 Aug 2007 03:06:42 -0000      1.1
@@ -0,0 +1,362 @@
+// 
+//   Copyright (C) 2007 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
+
+/* $Id: BevelFilter_as.cpp,v 1.1 2007/08/27 03:06:42 cmusick Exp $ */
+
+#include "BitmapFilter_as.h"
+#include "BevelFilter.h"
+#include "VM.h"
+#include "builtin_function.h"
+
+namespace gnash {
+
+class BevelFilter_as
+{
+public:
+    static as_object* Interface(); // To a BitmapFilter
+    static void attachInterface(as_object& o); // Attach the interface.
+    static void attachProperties(as_object& o); // Attach the properties.
+
+    static void registerCtor(as_object& global); // public ctor
+    static as_value ctor(const fn_call& fn); // constructor for BitmapFilter
+
+    // Get set functions for ActionScript
+    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);
+
+private:
+    static boost::intrusive_ptr<as_object> s_interface;
+    static boost::intrusive_ptr<builtin_function> s_ctor;
+};
+
+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::attachInterface(as_object& /*o*/)
+{
+    // Filters are all properties.
+    return;
+}
+
+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> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_distance);
+    }
+    // setter
+    float distance = fn.arg(0).to_number<float>();
+    ptr->m_distance = distance;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::angle_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_angle);
+    }
+    // setter
+    float angle = fn.arg(0).to_number<float>();
+    ptr->m_angle = angle;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::highlightColor_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_highlightColor);
+    }
+    // setter
+    uint32_t highlightColor = fn.arg(0).to_number<uint32_t>();
+    ptr->m_highlightColor = highlightColor;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::highlightAlpha_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_highlightAlpha);
+    }
+    // setter
+    uint8_t highlightAlpha = fn.arg(0).to_number<uint8_t>();
+    ptr->m_highlightAlpha = highlightAlpha;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::shadowColor_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_shadowColor);
+    }
+    // setter
+    uint32_t shadowColor = fn.arg(0).to_number<uint32_t>();
+    ptr->m_shadowColor = shadowColor;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::shadowAlpha_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_shadowAlpha);
+    }
+    // setter
+    uint8_t shadowAlpha = fn.arg(0).to_number<uint8_t>();
+    ptr->m_shadowAlpha = shadowAlpha;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::blurX_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_blurX);
+    }
+    // setter
+    float blurX = fn.arg(0).to_number<float>();
+    ptr->m_blurX = blurX;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::blurY_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_blurY);
+    }
+    // setter
+    float blurY = fn.arg(0).to_number<float>();
+    ptr->m_blurY = blurY;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::strength_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_strength);
+    }
+    // setter
+    float strength = fn.arg(0).to_number<float>();
+    ptr->m_strength = strength;
+
+    return as_value();
+}
+
+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());
+
+    // TODO: Is this correct?
+    BevelFilter_as::attachInterface(*BevelFilter_as::s_ctor);
+
+    global.init_member("BevelFilter", BevelFilter_as::s_ctor.get());
+}
+
+as_value
+BevelFilter_as::quality_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_quality);
+    }
+    // setter
+    uint8_t quality = fn.arg(0).to_number<uint8_t>();
+    ptr->m_quality = quality;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::type_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        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
+    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::knockout_gs(const fn_call& fn)
+{
+    boost::intrusive_ptr<BevelFilter> ptr = 
ensureType<BevelFilter>(fn.this_ptr);
+
+    if (fn.nargs == 0) // getter
+    {
+        return as_value(ptr->m_knockout);
+    }
+    // setter
+    bool knockout = fn.arg(0).to_bool();
+    ptr->m_knockout = knockout;
+
+    return as_value();
+}
+
+as_value
+BevelFilter_as::ctor(const fn_call& /*fn*/)
+{
+    boost::intrusive_ptr<as_object> obj = new 
BevelFilter(BevelFilter_as::Interface());
+    BevelFilter_as::attachProperties(*obj);
+
+    return as_value(obj.get());
+}
+
+void bevelFilter_class_init(as_object& global)
+{
+   BevelFilter_as::registerCtor(global);
+}
+
+} // Namespace gnash
+

Index: server/asobj/BevelFilter_as.h
===================================================================
RCS file: server/asobj/BevelFilter_as.h
diff -N server/asobj/BevelFilter_as.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/BevelFilter_as.h       27 Aug 2007 03:06:42 -0000      1.1
@@ -0,0 +1,37 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef __GNASH_ASOBJ_BEVELFILTER_H__
+#define __GNASH_ASOBJ_BEVELFILTER_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+namespace gnash {
+
+class as_object;
+
+/// Initialize the global BitmapFilter class
+void bevelFilter_class_init(as_object& global);
+
+} // end of gnash namespace
+
+// __GNASH_ASOBJ_BEVELFILTER_H__
+#endif
+

Index: server/asobj/BitmapFilter_as.h
===================================================================
RCS file: server/asobj/BitmapFilter_as.h
diff -N server/asobj/BitmapFilter_as.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/BitmapFilter_as.h      27 Aug 2007 03:06:42 -0000      1.1
@@ -0,0 +1,40 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef __GNASH_ASOBJ_BITMAPFILTER_H__
+#define __GNASH_ASOBJ_BITMAPFILTER_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+namespace gnash {
+
+class as_object;
+
+/// Initialize the global BitmapFilter class
+void bitmapFilter_class_init(as_object& global);
+
+/// Get the interface, for inheritance.
+as_object *bitmapFilter_interface();
+
+} // end of gnash namespace
+
+// __GNASH_ASOBJ_BITMAPFILTER_H__
+#endif
+

Index: server/asobj/BitmapFilter_as.cpp
===================================================================
RCS file: server/asobj/BitmapFilter_as.cpp
diff -N server/asobj/BitmapFilter_as.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/BitmapFilter_as.cpp    27 Aug 2007 03:06:42 -0000      1.1
@@ -0,0 +1,108 @@
+// 
+//   Copyright (C) 2007 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
+
+/* $Id: BitmapFilter_as.cpp,v 1.1 2007/08/27 03:06:42 cmusick Exp $ */
+
+#include "BitmapFilter.h"
+#include "VM.h"
+#include "builtin_function.h"
+
+namespace gnash {
+
+class BitmapFilter_as
+{
+public:
+    static as_object* Interface(); // To a BitmapFilter
+    static void attachInterface(as_object& o); // Attach the interface.
+    static void registerCtor(as_object& global); // public ctor
+    static as_value ctor(const fn_call& fn); // constructor for BitmapFilter
+
+    static as_value bitmap_clone(const fn_call& fn);
+
+private:
+    static boost::intrusive_ptr<as_object> s_interface;
+    static boost::intrusive_ptr<builtin_function> s_ctor;
+};
+
+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::attachInterface(as_object& o)
+{
+    o.init_member("clone", new builtin_function(bitmap_clone));
+}
+
+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());
+
+    // TODO: Is this correct?
+    BitmapFilter_as::attachInterface(*BitmapFilter_as::s_ctor);
+
+    global.init_member("BitmapFilter", BitmapFilter_as::s_ctor.get());
+}
+
+as_value
+BitmapFilter_as::ctor(const fn_call& /*fn*/)
+{
+    boost::intrusive_ptr<as_object> obj = new 
BitmapFilter(BitmapFilter_as::Interface());
+    return as_value(obj.get());
+}
+
+as_value BitmapFilter_as::bitmap_clone(const fn_call& fn)
+{
+    boost::intrusive_ptr<BitmapFilter> filter = ensureType<BitmapFilter> 
(fn.this_ptr);
+    boost::intrusive_ptr<as_object> retval = filter->clone();
+    retval->set_prototype(filter->get_prototype());
+
+    return as_value(retval);
+}
+
+void bitmapFilter_class_init(as_object& global)
+{
+   BitmapFilter_as::registerCtor(global);
+}
+
+as_object*
+bitmapFilter_interface()
+{
+    return BitmapFilter_as::Interface();
+}
+
+} // Namespace gnash
+




reply via email to

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