gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10914: Add part of the code needed


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10914: Add part of the code needed to implement trackAsMenu().
Date: Mon, 25 May 2009 14:34:53 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 10914
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-05-25 14:34:53 +0200
message:
  Add part of the code needed to implement trackAsMenu().
  
  Mark expected failures in BitmapData tests.
modified:
  libcore/Button.cpp
  libcore/Button.h
  libcore/DynamicShape.cpp
  libcore/InteractiveObject.h
  libcore/MovieClip.cpp
  libcore/MovieClip.h
  testsuite/actionscript.all/BitmapData.as
    ------------------------------------------------------------
    revno: 10831.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Fri 2009-04-24 13:29:44 +0200
    message:
      Drop repeated comments from the end of long lines.
    modified:
      libcore/DynamicShape.cpp
    ------------------------------------------------------------
    revno: 10831.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Mon 2009-05-25 14:11:10 +0200
    message:
      Add trackAsMenu() function (not implemented).
    modified:
      libcore/Button.cpp
      libcore/Button.h
      libcore/InteractiveObject.h
      libcore/MovieClip.cpp
      libcore/MovieClip.h
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp        2009-04-22 15:17:32 +0000
+++ b/libcore/Button.cpp        2009-05-25 12:11:10 +0000
@@ -319,6 +319,13 @@
     _vm.getRoot().remove_key_listener(this);
 }
 
+bool
+Button::trackAsMenu()
+{
+    as_value track;
+    string_table& st = _vm.getStringTable();
+    return (get_member(st.find("trackAsMenu"), &track) && track.to_bool());
+}
 
 bool 
 Button::isEnabled()

=== modified file 'libcore/Button.h'
--- a/libcore/Button.h  2009-04-15 09:08:37 +0000
+++ b/libcore/Button.h  2009-05-25 12:11:10 +0000
@@ -86,6 +86,8 @@
 
        bool mouseEnabled() const { return true; }
 
+    virtual bool trackAsMenu();
+
        // called from keypress listener only
        bool on_event(const event_id& id);
 

=== modified file 'libcore/DynamicShape.cpp'
--- a/libcore/DynamicShape.cpp  2009-04-14 18:31:04 +0000
+++ b/libcore/DynamicShape.cpp  2009-04-24 11:29:44 +0000
@@ -62,12 +62,9 @@
 
        // Remove reference to the "current" path, as
        // next drawing will happen on a different one
-       _currpath = NULL;
-
+       _currpath = 0;
        // Remove fill information
        _currfill = 0;
-
-       // TODO: should I also clear _currline ?
 }
 
 void
@@ -82,7 +79,7 @@
        // TODO: how to know wheter the fill should be set
        //       as *left* or *right* fill ?
        //       A quick test shows that *left* always work fine !
-       Path newPath(_x, _y, _currfill, 0, _currline, true); // new fill start 
new subshapes
+       Path newPath(_x, _y, _currfill, 0, _currline, true); 
        add_path(newPath);
 }
 
@@ -98,7 +95,7 @@
        // TODO: how to know wheter the fill should be set
        //       as *left* or *right* fill ?
        //       A quick test shows that *left* always work fine !
-       Path newPath(_x, _y, _currfill, 0, _currline, true); // new fill start 
new subshapes
+       Path newPath(_x, _y, _currfill, 0, _currline, true);
        add_path(newPath);
 }
 
@@ -163,14 +160,14 @@
                miterLimitFactor);
 
        _currline = add_line_style(style);
-       startNewPath(false); // don't make this the start of a new subshape (to 
verify)
+       startNewPath(false); 
 }
 
 void
 DynamicShape::resetLineStyle()
 {
        _currline = 0;
-       startNewPath(false); // don't make this the start of a new subshape (to 
verify)
+       startNewPath(false);
 }
 
 void
@@ -180,16 +177,14 @@
        {
                _x = x;
                _y = y;
-
-               // TODO: close previous path if any and filled ?
-               startNewPath(false); // don't make this the start of a new 
subshape (to verify)
+               startNewPath(false);
        }
 }
 
 void
 DynamicShape::lineTo(boost::int32_t x, boost::int32_t y, int swfVersion)
 {
-       if ( ! _currpath ) startNewPath(true); // first shape is always new (I 
hope this doesn't break anything)
+       if (!_currpath) startNewPath(true); 
        assert(_currpath);
 
        _currpath->drawLineTo(x, y);
@@ -198,11 +193,13 @@
     rect bounds = _shape.getBounds();
 
        unsigned thickness = _currline ? 
-        _shape.lineStyles()[_currline-1].getThickness() : 0;
-       if ( _currpath->size() == 1 ) {
+        _shape.lineStyles().back().getThickness() : 0;
+
+       if (_currpath->size() == 1) {
                _currpath->expandBounds(bounds, thickness, swfVersion);
        } else {
-               bounds.expand_to_circle(x, y, swfVersion < 8 ? thickness : 
thickness/2.0);
+               bounds.expand_to_circle(x, y, swfVersion < 8 ? thickness :
+                thickness / 2.0);
        }
     
     _shape.setBounds(bounds);
@@ -219,7 +216,7 @@
 DynamicShape::curveTo(boost::int32_t cx, boost::int32_t cy, 
                       boost::int32_t ax, boost::int32_t ay, int swfVersion)
 {
-       if ( ! _currpath ) startNewPath(true); // first shape is always new (I 
hope this doesn't break anything)
+       if (!_currpath) startNewPath(true); 
        assert(_currpath);
 
        _currpath->drawCurveTo(cx, cy, ax, ay);
@@ -227,15 +224,16 @@
     rect bounds = _shape.getBounds();
 
        unsigned thickness = _currline ? 
-        _shape.lineStyles()[_currline-1].getThickness() : 0;
-       if ( _currpath->size() == 1 ) {
+        _shape.lineStyles().back().getThickness() : 0;
+
+       if (_currpath->size() == 1) {
                _currpath->expandBounds(bounds, thickness, swfVersion);
        }
     else {
                bounds.expand_to_circle(ax, ay, 
-                swfVersion < 8 ? thickness : thickness/2.0);
+                swfVersion < 8 ? thickness : thickness / 2.0);
                bounds.expand_to_circle(cx, cy,
-                swfVersion < 8 ? thickness : thickness/2.0);
+                swfVersion < 8 ? thickness : thickness / 2.0);
     }
 
     _shape.setBounds(bounds);

=== modified file 'libcore/InteractiveObject.h'
--- a/libcore/InteractiveObject.h       2009-04-07 13:13:16 +0000
+++ b/libcore/InteractiveObject.h       2009-05-25 12:11:10 +0000
@@ -60,6 +60,11 @@
     ///             events
        virtual bool mouseEnabled() const = 0;
 
+    /// ActionScript property of Buttons and MovieClips altering mouse handling
+    virtual bool trackAsMenu() {
+        return false;
+    }
+
     /// Allow extraction of static text.
     //
     /// Default returns 0, implemented only for DefineText though

=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2009-05-14 11:45:23 +0000
+++ b/libcore/MovieClip.cpp     2009-05-25 12:34:53 +0000
@@ -1896,6 +1896,14 @@
 }
 
 bool
+MovieClip::trackAsMenu()
+{
+    as_value track;
+    string_table& st = _vm.getStringTable();
+    return (get_member(st.find("trackAsMenu"), &track) && track.to_bool());
+}
+
+bool
 MovieClip::mouseEnabled() const
 {
     if ( ! isEnabled() ) return false;

=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h       2009-04-28 15:22:32 +0000
+++ b/libcore/MovieClip.h       2009-05-25 12:34:53 +0000
@@ -131,6 +131,8 @@
     // Return the originating SWF
     virtual Movie* get_root() const;
 
+    virtual bool trackAsMenu();
+
     /// Return the _root ActionScript property of this sprite.
     //
     /// Relative or absolute is determined by the _lockroot property,

=== modified file 'testsuite/actionscript.all/BitmapData.as'
--- a/testsuite/actionscript.all/BitmapData.as  2009-05-25 09:25:27 +0000
+++ b/testsuite/actionscript.all/BitmapData.as  2009-05-25 12:34:53 +0000
@@ -156,41 +156,41 @@
 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);
+xcheck_equals(tr.getPixel(2, 2), 0x00);
+xcheck_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);
+xcheck_equals(tr.getPixel(2, 2), 0xac);
+xcheck_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);
+xcheck_equals(tr.getPixel(2, 2), 0xaa);
+xcheck_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);
+xcheck_equals(tr.getPixel(3, 3), 0xff);
+xcheck_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);
+xcheck_equals(tr.getPixel(4, 4), 0x434343);
+xcheck_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);
+xcheck_equals(tr.getPixel(4, 4), 0x101010);
+xcheck_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);
+xcheck_equals(tr.getPixel(4, 4), 0x444444);
+xcheck_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);
+xcheck_equals(ntr.getPixel(5, 5), 0xff);
+xcheck_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);
+xcheck_equals(ntr.getPixel(6, 6), 0x444444);
+xcheck_equals(ntr.getPixel32(6, 6), -12303292);
 
 // floodFill
 bmp = new Bitmap(20, 20, false);
@@ -296,6 +296,6 @@
 // END OF TEST
 //-------------------------------------------------------------
 
-totals(103);
+totals(121);
 
 #endif // OUTPUT_VERSION >= 8


reply via email to

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