gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10913: Comments, tests, debugging.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10913: Comments, tests, debugging.
Date: Mon, 25 May 2009 14:15:45 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 10913
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-05-25 14:15:45 +0200
message:
  Comments, tests, debugging.
modified:
  libcore/asobj/flash/display/BitmapData_as.cpp
  libcore/swf/DefineShapeTag.cpp
  libcore/swf/ShapeRecord.cpp
  libcore/vm/Machine.cpp
  libcore/vm/Machine.h
  testsuite/actionscript.all/BitmapData.as
    ------------------------------------------------------------
    revno: 10911.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Mon 2009-05-25 11:01:28 +0200
    message:
      Line breaks.
    modified:
      libcore/asobj/flash/display/BitmapData_as.cpp
    ------------------------------------------------------------
    revno: 10911.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Mon 2009-05-25 11:01:34 +0200
    message:
      Fix typos, line breaks.
    modified:
      libcore/vm/Machine.cpp
      libcore/vm/Machine.h
    ------------------------------------------------------------
    revno: 10911.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Mon 2009-05-25 11:25:27 +0200
    message:
      Test setPixel and setPixel32.
    modified:
      testsuite/actionscript.all/BitmapData.as
    ------------------------------------------------------------
    revno: 10911.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Mon 2009-05-25 11:45:58 +0200
    message:
      Clean up parsing.
    modified:
      libcore/swf/DefineShapeTag.cpp
      libcore/swf/ShapeRecord.cpp
=== modified file 'libcore/asobj/flash/display/BitmapData_as.cpp'
--- a/libcore/asobj/flash/display/BitmapData_as.cpp     2009-05-20 10:37:32 
+0000
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp     2009-05-25 09:01:28 
+0000
@@ -525,7 +525,8 @@
 as_value
 BitmapData_setPixel(const fn_call& fn)
 {
-       boost::intrusive_ptr<BitmapData_as> ptr = 
ensureType<BitmapData_as>(fn.this_ptr);
+       boost::intrusive_ptr<BitmapData_as> ptr =
+        ensureType<BitmapData_as>(fn.this_ptr);
        UNUSED(ptr);
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
@@ -534,7 +535,8 @@
 as_value
 BitmapData_setPixel32(const fn_call& fn)
 {
-       boost::intrusive_ptr<BitmapData_as> ptr = 
ensureType<BitmapData_as>(fn.this_ptr);
+       boost::intrusive_ptr<BitmapData_as> ptr =
+        ensureType<BitmapData_as>(fn.this_ptr);
        UNUSED(ptr);
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
@@ -552,12 +554,14 @@
 as_value
 BitmapData_height(const fn_call& fn)
 {
-       boost::intrusive_ptr<BitmapData_as> ptr = 
ensureType<BitmapData_as>(fn.this_ptr);
+       boost::intrusive_ptr<BitmapData_as> ptr =
+        ensureType<BitmapData_as>(fn.this_ptr);
 
     // Read-only
     if (fn.nargs) return as_value();
     
-    // Returns the immutable height of the bitmap or -1 if dispose() has been 
called.
+    // Returns the immutable height of the bitmap or -1 if dispose() has
+    // been called.
     if (ptr->getBitmapData().empty()) return -1;
        return as_value(ptr->getHeight());
 }
@@ -598,7 +602,8 @@
 as_value
 BitmapData_transparent(const fn_call& fn)
 {
-       boost::intrusive_ptr<BitmapData_as> ptr = 
ensureType<BitmapData_as>(fn.this_ptr);
+       boost::intrusive_ptr<BitmapData_as> ptr =
+        ensureType<BitmapData_as>(fn.this_ptr);
 
     // Read-only
     if (fn.nargs) return as_value();
@@ -611,7 +616,8 @@
 as_value
 BitmapData_width(const fn_call& fn)
 {
-       boost::intrusive_ptr<BitmapData_as> ptr = 
ensureType<BitmapData_as>(fn.this_ptr);
+       boost::intrusive_ptr<BitmapData_as> ptr =
+        ensureType<BitmapData_as>(fn.this_ptr);
 
     // Read-only
     if (fn.nargs) return as_value();
@@ -626,7 +632,8 @@
 as_value
 BitmapData_loadBitmap(const fn_call& fn)
 {
-       boost::intrusive_ptr<BitmapData_as> ptr = 
ensureType<BitmapData_as>(fn.this_ptr);
+       boost::intrusive_ptr<BitmapData_as> ptr =
+        ensureType<BitmapData_as>(fn.this_ptr);
        UNUSED(ptr);
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
@@ -644,8 +651,7 @@
 BitmapData_ctor(const fn_call& fn)
 {
 
-       if ( fn.nargs < 2)
-       {
+       if (fn.nargs < 2) {
            // TODO: should fail if not enough arguments are passed.
         return as_value();
        }
@@ -684,15 +690,18 @@
 {
     o.init_member("applyFilter", new builtin_function(BitmapData_applyFilter));
     o.init_member("clone", new builtin_function(BitmapData_clone));
-    o.init_member("colorTransform", new 
builtin_function(BitmapData_colorTransform));
+    o.init_member("colorTransform", new builtin_function(
+                BitmapData_colorTransform));
     o.init_member("copyChannel", new builtin_function(BitmapData_copyChannel));
     o.init_member("copyPixels", new builtin_function(BitmapData_copyPixels));
     o.init_member("dispose", new builtin_function(BitmapData_dispose));
     o.init_member("draw", new builtin_function(BitmapData_draw));
     o.init_member("fillRect", new builtin_function(BitmapData_fillRect));
     o.init_member("floodFill", new builtin_function(BitmapData_floodFill));
-    o.init_member("generateFilterRect", new 
builtin_function(BitmapData_generateFilterRect));
-    o.init_member("getColorBoundsRect", new 
builtin_function(BitmapData_getColorBoundsRect));
+    o.init_member("generateFilterRect", new builtin_function(
+                BitmapData_generateFilterRect));
+    o.init_member("getColorBoundsRect", new builtin_function(
+                BitmapData_getColorBoundsRect));
     o.init_member("getPixel", new builtin_function(BitmapData_getPixel));
     o.init_member("getPixel32", new builtin_function(BitmapData_getPixel32));
     o.init_member("hitTest", new builtin_function(BitmapData_hitTest));
@@ -700,14 +709,16 @@
     o.init_member("noise", new builtin_function(BitmapData_noise));
     o.init_member("paletteMap", new builtin_function(BitmapData_paletteMap));
     o.init_member("perlinNoise", new builtin_function(BitmapData_perlinNoise));
-    o.init_member("pixelDissolve", new 
builtin_function(BitmapData_pixelDissolve));
+    o.init_member("pixelDissolve", new builtin_function(
+                BitmapData_pixelDissolve));
     o.init_member("scroll", new builtin_function(BitmapData_scroll));
     o.init_member("setPixel", new builtin_function(BitmapData_setPixel));
     o.init_member("setPixel32", new builtin_function(BitmapData_setPixel32));
     o.init_member("threshold", new builtin_function(BitmapData_threshold));
     o.init_property("height", BitmapData_height, BitmapData_height);
     o.init_property("rectangle", BitmapData_rectangle, BitmapData_rectangle);
-    o.init_property("transparent", BitmapData_transparent, 
BitmapData_transparent);
+    o.init_property("transparent", BitmapData_transparent,
+            BitmapData_transparent);
     o.init_property("width", BitmapData_width, BitmapData_width);
 
 }
@@ -724,15 +735,11 @@
 {
        static boost::intrusive_ptr<as_object> o;
 
-       if ( ! o )
-       {
-               // TODO: check if this class should inherit from Object
-               //       or from a different class
+       if (!o) {
                o = new as_object(getObjectInterface());
                VM::get().addStatic(o.get());
 
                attachBitmapDataInterface(*o);
-
        }
 
        return o.get();

=== modified file 'libcore/swf/DefineShapeTag.cpp'
--- a/libcore/swf/DefineShapeTag.cpp    2009-05-14 11:45:23 +0000
+++ b/libcore/swf/DefineShapeTag.cpp    2009-05-25 09:45:58 +0000
@@ -93,7 +93,8 @@
 
 void
 DefineShapeTag::markReachableResources() const
-{}
+{
+}
 
 } // namespace SWF
 } // namespace gnash

=== modified file 'libcore/swf/ShapeRecord.cpp'
--- a/libcore/swf/ShapeRecord.cpp       2009-04-07 14:32:06 +0000
+++ b/libcore/swf/ShapeRecord.cpp       2009-05-25 09:45:58 +0000
@@ -254,7 +254,7 @@
     int num_line_bits = (num_bits & 0x0F);
     
     IF_VERBOSE_PARSE(
-        log_parse(_("  ShapeRecord(%s): fillbits = %d, nlinebits = %d"),
+        log_parse(_("  ShapeRecord(%s): fillbits %d, linebits %d"),
             tag, num_fill_bits, num_line_bits);
     );
     
@@ -487,7 +487,7 @@
                 current_path.setLineStyle(style);
 #if SHAPE_LOG
                 IF_VERBOSE_PARSE(
-                    log_parse(_("  Shape_read: line = %d"), 
+                    log_parse(_("ShapeRecord: line %d"), 
                         current_path.getLineStyle());
                 )
 #endif
@@ -503,7 +503,7 @@
                     continue;
                 }
                 IF_VERBOSE_PARSE (
-                    log_parse(_("  Shape read: more fill styles"));
+                    log_parse(_("ShapeRecord: more fill styles"));
                 );
     
                 // Store the current path if any.
@@ -547,7 +547,7 @@
     
 #if SHAPE_LOG
                 IF_VERBOSE_PARSE (
-                    log_parse(_("  Shape read: curved edge   = "
+                    log_parse(_("ShapeRecord: curved edge "
                             "%d %d - %d %d - %d %d"), x, y, cx, cy, ax, ay);
                 );
 #endif
@@ -589,7 +589,7 @@
     
 #if SHAPE_LOG
                 IF_VERBOSE_PARSE (
-                     log_parse(_("  Shape_read: straight edge = "
+                     log_parse(_("ShapeRecord: straight edge "
                              "%d %d - %d %d"), x, y, x + dx, y + dy);
                 );
 #endif
@@ -614,7 +614,7 @@
         computeBounds(computedBounds, _paths, _lineStyles, m->get_version());
         if ( computedBounds != m_bounds )
         {
-            log_debug("Shape DisplayObject read for tag %d contained embedded "
+            log_debug("Shape object read for tag %d contained embedded "
                     "bounds %s, while we computed bounds %s",
                     tag, m_bound, computedBounds);
         }

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2009-05-25 06:44:17 +0000
+++ b/libcore/vm/Machine.cpp    2009-05-25 09:01:34 +0000
@@ -648,7 +648,8 @@
                 ///  a -- an object
                 /// Stack Out:
                 ///  .
-                /// Do: If a >= b move by jump in stream, as ABC_ACTION_JUMP 
does.
+                /// Do: If a >= b move by jump in stream, as ABC_ACTION_JUMP
+                /// does.
                 case SWF::ABC_ACTION_IFGE:
                 {
                     bool truth;
@@ -665,10 +666,12 @@
                 ///  a -- an object
                 /// Stack Out:
                 ///  .
-                /// Do: If a == b (strictly), move by jump in stream, as 
ABC_ACTION_JUMP
+                /// Do: If a == b (strictly), move by jump in stream, as
+                /// ABC_ACTION_JUMP
                 case SWF::ABC_ACTION_IFSTRICTEQ:
                 {
-                    bool truth = abstractEquality(mStack.top(1), 
mStack.top(0), true);
+                    bool truth = abstractEquality(mStack.top(1), mStack.top(0),
+                            true);
                     mStack.drop(2);
                     JUMPIF(truth);
                     break;
@@ -751,6 +754,7 @@
                 /// If 0x1C, start a new base if the previous one was global.
                 case SWF::ABC_ACTION_PUSHWITH:
                 {
+                    log_unimpl("ABC_ACTION_PUSHWITH");
                     // A scope object is just a regular object.
             //                 ENSURE_OBJECT(mStack.top(0));
             //                 as_object *a = mStack.top(0).to_object().get();
@@ -779,14 +783,7 @@
                 ///  shallower than the base's depth.
                 case SWF::ABC_ACTION_POPSCOPE:
                 {
-                    log_unimpl("ABC_ACTION_POPSCOPE");
                     pop_scope_stack();
-                    //         Scope &s = mScopeStack.pop();
-                    //         mScopeStack.setDownstop(s.mHeightAfterPop);
-                    //         if (mScopeStack.empty())
-                    //                 mCurrentScope = NULL;
-                    //         else
-                    //                 mCurrentScope = 
mScopeStack.top(0).mScope;
                     break;
                 }
 

=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h      2009-05-25 06:44:17 +0000
+++ b/libcore/vm/Machine.h      2009-05-25 09:01:34 +0000
@@ -296,12 +296,16 @@
                print_scope_stack();
        }
 
-       boost::intrusive_ptr<as_object> pop_scope_stack(){
-               log_abc("Poping value off the scope stack.  There will be %u 
items left.",mScopeStack.size()-1);
+       boost::intrusive_ptr<as_object> pop_scope_stack() {
+               log_abc("Popping value off the scope stack.  There will be "
+                "%u items left.",mScopeStack.size()-1);
                return mScopeStack.pop();
        }
-       boost::intrusive_ptr<as_object> get_scope_stack(boost::uint8_t depth){
-               log_abc("Geting value from scope stack %u from the 
bottom.",depth | 0x0);
+
+       boost::intrusive_ptr<as_object> get_scope_stack(boost::uint8_t depth)
+        const {
+               log_abc("Getting value from scope stack %u from the bottom.",
+                depth | 0x0);
                return mScopeStack.value(depth);
        }
 

=== modified file 'testsuite/actionscript.all/BitmapData.as'
--- a/testsuite/actionscript.all/BitmapData.as  2009-02-27 11:55:27 +0000
+++ b/testsuite/actionscript.all/BitmapData.as  2009-05-25 09:25:27 +0000
@@ -66,6 +66,7 @@
 
 check(!Bitmap.prototype.hasOwnProperty('loadBitmap'));
 check(Bitmap.hasOwnProperty('loadBitmap'));
+
 //-------------------------------------------------------------
 // Test constructor
 //-------------------------------------------------------------
@@ -147,6 +148,50 @@
 xcheck_equals(bmp, undefined);
 check_equals(bmp.height, undefined);
 
+// --------------------
+// setPixel, setPixel32
+// --------------------
+
+tr = new Bitmap(30, 30, true);
+ntr = new Bitmap(30, 30, false);
+
+tr.setPixel32(2, 2, 0x44);
+check_equals(tr.getPixel(2, 2), 0x00);
+check_equals(tr.getPixel32(2, 2), 0);
+
+// Premultiplication?
+tr.setPixel32(2, 2, 0x220000aa);
+check_equals(tr.getPixel(2, 2), 0xac);
+check_equals(tr.getPixel32(2, 2), 0x220000ac);
+
+tr.setPixel32(2, 2, 0xff0000aa);
+check_equals(tr.getPixel(2, 2), 0xaa);
+check_equals(tr.getPixel32(2, 2), -16777046);
+
+tr.setPixel(3, 3, 0xff);
+check_equals(tr.getPixel(3, 3), 0xff);
+check_equals(tr.getPixel32(3, 3), -16776961);
+
+tr.setPixel32(4, 4, 0x44444444);
+check_equals(tr.getPixel(4, 4), 0x434343);
+check_equals(tr.getPixel32(4, 4), 0x44434343);
+
+tr.setPixel32(4, 4, 0x10101010);
+check_equals(tr.getPixel(4, 4), 0x101010);
+check_equals(tr.getPixel32(4, 4), 0x10101010);
+
+tr.setPixel32(4, 4, 0x43434343);
+check_equals(tr.getPixel(4, 4), 0x444444);
+check_equals(tr.getPixel32(4, 4), 0x43444444);
+
+ntr.setPixel(5, 5, 0xff);
+check_equals(ntr.getPixel(5, 5), 0xff);
+check_equals(ntr.getPixel32(5, 5), -16776961);
+
+ntr.setPixel32(6, 6, 0x44444444);
+check_equals(ntr.getPixel(6, 6), 0x444444);
+check_equals(ntr.getPixel32(6, 6), -12303292);
+
 // floodFill
 bmp = new Bitmap(20, 20, false);
 bmp.floodFill(10, 10, 0x0000ff00);


reply via email to

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