gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/tree.hh server/movie_ro...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog libbase/tree.hh server/movie_ro...
Date: Fri, 14 Mar 2008 16:22:09 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/03/14 16:22:09

Modified files:
        .              : ChangeLog 
        libbase        : tree.hh 
        server         : movie_root.cpp 

Log message:
                * libbase/tree.hh: update to version 2.51
                * server/movie_root.cpp: tinker with the tree a bit more.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5912&r2=1.5913
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tree.hh?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.169&r2=1.170

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5912
retrieving revision 1.5913
diff -u -b -r1.5912 -r1.5913
--- ChangeLog   14 Mar 2008 13:38:07 -0000      1.5912
+++ ChangeLog   14 Mar 2008 16:22:07 -0000      1.5913
@@ -1,5 +1,10 @@
 2008-03-14 Benjamin Wolsey <address@hidden>
 
+       * libbase/tree.hh: update to version 2.51
+       * server/movie_root.cpp: tinker with the tree a bit more.
+
+2008-03-14 Benjamin Wolsey <address@hidden>
+
        * server/movie_root.{h,cpp}: add getMovieInfo() to fill the info tree
          with data. Added more data about movie stage and from public methods
          of gnash::character. This class will eventually get its own tree

Index: libbase/tree.hh
===================================================================
RCS file: /sources/gnash/gnash/libbase/tree.hh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libbase/tree.hh     5 Mar 2008 03:55:53 -0000       1.6
+++ libbase/tree.hh     14 Mar 2008 16:22:08 -0000      1.7
@@ -1,15 +1,16 @@
 /* 
 
+   $Id: tree.hh,v 1.7 2008/03/14 16:22:08 bwy Exp $
 
    STL-like templated tree class.
    Copyright (C) 2001-2006  Kasper Peeters <address@hidden>.
 
 */
 
-/** \page tree.hh
+/** \mainpage tree.hh
     \author   Kasper Peeters
-    \version  2.31
-    \date     21-Aug-2007
+    \version  2.51
+    \date     28-Feb-2008
     \see      http://www.aei.mpg.de/~peekas/tree/
     \see      http://www.aei.mpg.de/~peekas/tree/ChangeLog
 
@@ -23,7 +24,7 @@
 
 
 /*
-   This program is free software; you can redistribute it and/or modify
+   The tree.hh code 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; version 2 or 3.
    
@@ -40,9 +41,8 @@
 /** \todo 
    - New-style move members are not completely finished yet.
    - It would be good to have an iterator which can iterate over all
-     nodes below a given node.
-   - Fixed depth iterators do not iterate over the entire range if there
-     are 'holes' in the tree.
+     nodes below a given node. Something similar to the leaf iterator
+     we have right now, but not restricted to the leaves.
    - If a range uses const iter_base& as end iterator, things will
      inevitably go wrong, because upcast from iter_base to a non-sibling_iter
      is incorrect. This upcast should be removed (and then all illegal uses
@@ -65,7 +65,6 @@
 #include <iterator>
 #include <set>
 #include <queue>
-#include <iostream>
 
 // HP-style construct/destroy have gone from the standard,
 // so here is a copy.
@@ -90,7 +89,7 @@
    p->~T1();
    }
 
-}
+};
 
 /// A node in the tree, combining links to other nodes as well as the actual 
data.
 template<class T>
@@ -268,7 +267,7 @@
       class leaf_iterator : public iterator_base {
          public:
             leaf_iterator();
-            leaf_iterator(tree_node *);
+            leaf_iterator(tree_node *, tree_node *top=0);
             leaf_iterator(const sibling_iterator&);
             leaf_iterator(const iterator_base&);
 
@@ -280,6 +279,8 @@
             leaf_iterator   operator--(int);
             leaf_iterator&  operator+=(unsigned int);
             leaf_iterator&  operator-=(unsigned int);
+         private:
+            tree_node *top_node;
       };
 
       /// Return iterator to the beginning of the tree.
@@ -288,24 +289,28 @@
       inline pre_order_iterator   end() const;
       /// Return post-order iterator to the beginning of the tree.
       post_order_iterator  begin_post() const;
-      /// Return post-order iterator to the end of the tree.
+      /// Return post-order end iterator of the tree.
       post_order_iterator  end_post() const;
-      /// Return fixed-depth iterator to the first node at a given depth.
+      /// Return fixed-depth iterator to the first node at a given depth from 
the given iterator.
       fixed_depth_iterator begin_fixed(const iterator_base&, unsigned int) 
const;
-      /// Return fixed-depth iterator to end of the nodes at given depth.
+      /// Return fixed-depth end iterator.
       fixed_depth_iterator end_fixed(const iterator_base&, unsigned int) const;
       /// Return breadth-first iterator to the first node at a given depth.
       breadth_first_queued_iterator begin_breadth_first() const;
-      /// Return breadth-first iterator to end of the nodes at given depth.
+      /// Return breadth-first end iterator.
       breadth_first_queued_iterator end_breadth_first() const;
       /// Return sibling iterator to the first child of given node.
       sibling_iterator     begin(const iterator_base&) const;
-      /// Return sibling iterator to the end of the children of a given node.
+      /// Return sibling end iterator for children of given node.
       sibling_iterator     end(const iterator_base&) const;
       /// Return leaf iterator to the first leaf of the tree.
       leaf_iterator   begin_leaf() const;
-      /// Return leaf iterator to the last leaf of the tree.
+      /// Return leaf end iterator for entire tree.
       leaf_iterator   end_leaf() const;
+      /// Return leaf iterator to the first leaf of the subtree at the given 
node.
+      leaf_iterator   begin_leaf(const iterator_base& top) const;
+      /// Return leaf end iterator for the subtree at the given node.
+      leaf_iterator   end_leaf(const iterator_base& top) const;
 
       /// Return iterator to the parent of a node.
       template<typename iter> static iter parent(iter);
@@ -407,6 +412,10 @@
       bool     empty() const;
       /// Compute the depth to the root.
       int      depth(const iterator_base&) const;
+      /// Determine the maximal depth of the tree.
+      int      max_depth() const;
+      /// Determine the maximal depth of the tree below a given one.
+      int      max_depth(const iterator_base&) const;
       /// Count the number of children of node at position.
       static unsigned int number_of_children(const iterator_base&);
       /// Count the number of 'next' siblings of node at iterator.
@@ -682,9 +691,16 @@
    unsigned int curdepth=0;
    while(curdepth<dp) { // go down one level
       while(tmp->first_child==0) {
-         tmp=tmp->next_sibling;
+         if(tmp->next_sibling==0) {
+            // try to walk up and then right again
+            do {
+               tmp=tmp->parent;
          if(tmp==0)
             throw std::range_error("tree: begin_fixed out of range");
+               --curdepth;
+               } while(tmp->next_sibling==0);
+            }
+         tmp=tmp->next_sibling;
          }
       tmp=tmp->first_child;
       ++curdepth;
@@ -695,7 +711,7 @@
 template <class T, class tree_node_allocator>
 typename tree<T, tree_node_allocator>::fixed_depth_iterator tree<T, 
tree_node_allocator>::end_fixed(const iterator_base& pos, unsigned int dp) const
    {
-   assert(1==0); // FIXME: not correct yet
+   assert(1==0); // FIXME: not correct yet: use is_valid() as a temporary 
workaround 
    tree_node *tmp=pos.node;
    unsigned int curdepth=1;
    while(curdepth<dp) { // go down one level
@@ -746,6 +762,21 @@
    }
 
 template <class T, class tree_node_allocator>
+typename tree<T, tree_node_allocator>::leaf_iterator tree<T, 
tree_node_allocator>::begin_leaf(const iterator_base& top) const
+   {
+   tree_node *tmp=top.node;
+   while(tmp->first_child)
+       tmp=tmp->first_child;
+   return leaf_iterator(tmp, top.node);
+   }
+
+template <class T, class tree_node_allocator>
+typename tree<T, tree_node_allocator>::leaf_iterator tree<T, 
tree_node_allocator>::end_leaf(const iterator_base& top) const
+   {
+   return leaf_iterator(top.node, top.node);
+   }
+
+template <class T, class tree_node_allocator>
 template <typename iter>
 iter tree<T, tree_node_allocator>::parent(iter position) 
    {
@@ -1631,6 +1662,38 @@
    }
 
 template <class T, class tree_node_allocator>
+int tree<T, tree_node_allocator>::max_depth() const
+   {
+   return max_depth(begin());
+   }
+
+
+template <class T, class tree_node_allocator>
+int tree<T, tree_node_allocator>::max_depth(const iterator_base& pos) const
+   {
+   tree_node *tmp=pos.node;
+   int curdepth=0, maxdepth=0;
+   while(true) { // try to walk the bottom of the tree
+      while(tmp->first_child==0) {
+         if(tmp==pos.node) return maxdepth;
+         if(tmp->next_sibling==0) {
+            // try to walk up and then right again
+            do {
+               tmp=tmp->parent;
+               if(tmp==0) return maxdepth;
+               --curdepth;
+               } while(tmp->next_sibling==0);
+            }
+         if(tmp==pos.node) return maxdepth;
+         tmp=tmp->next_sibling;
+         }
+      tmp=tmp->first_child;
+      ++curdepth;
+      maxdepth=std::max(curdepth, maxdepth);
+      } 
+   }
+
+template <class T, class tree_node_allocator>
 unsigned int tree<T, tree_node_allocator>::number_of_children(const 
iterator_base& it) 
    {
    tree_node *pos=it.node->first_child;
@@ -1870,7 +1933,7 @@
 template <class T, class tree_node_allocator>
 bool tree<T, tree_node_allocator>::leaf_iterator::operator==(const 
leaf_iterator& other) const
    {
-   if(other.node==this->node) return true;
+   if(other.node==this->node && other.top==this->top) return true;
    else return false;
    }
 
@@ -2518,25 +2581,25 @@
 
 template <class T, class tree_node_allocator>
 tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator() 
-   : iterator_base(0)
+   : iterator_base(0), top_node(0)
    {
    }
 
 template <class T, class tree_node_allocator>
-tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator(tree_node *tn)
-   : iterator_base(tn)
+tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator(tree_node *tn, 
tree_node *top)
+   : iterator_base(tn), top_node(top)
    {
    }
 
 template <class T, class tree_node_allocator>
 tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator(const iterator_base 
&other)
-   : iterator_base(other.node)
+   : iterator_base(other.node), top_node(0)
    {
    }
 
 template <class T, class tree_node_allocator>
 tree<T, tree_node_allocator>::leaf_iterator::leaf_iterator(const 
sibling_iterator& other)
-   : iterator_base(other.node)
+   : iterator_base(other.node), top_node(0)
    {
    if(this->node==0) {
       if(other.range_last()!=0)
@@ -2554,6 +2617,7 @@
    while(this->node->next_sibling==0) {
       if (this->node->parent==0) return *this;
       this->node=this->node->parent;
+      if (top_node != 0 && this->node==top_node) return *this;
       }
    this->node=this->node->next_sibling;
    while(this->node->first_child)
@@ -2568,6 +2632,7 @@
    while (this->node->prev_sibling==0) {
       if (this->node->parent==0) return *this;
       this->node=this->node->parent;
+      if (top_node !=0 && this->node==top_node) return *this; 
       }
    this->node=this->node->prev_sibling;
    while(this->node->last_child)

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- server/movie_root.cpp       14 Mar 2008 13:38:08 -0000      1.169
+++ server/movie_root.cpp       14 Mar 2008 16:22:08 -0000      1.170
@@ -1935,11 +1935,6 @@
     os << m_pixel_scale;
     localIter = tr.append_child(it, StringPair("Pixel scale", os.str()));
 
-    /// Stage: timer
-    os.str("");
-    os << m_timer;
-    localIter = tr.append_child(it, StringPair("Timer value", os.str()));
-
     /// Stage: scaling allowed.
     localIter = tr.append_child(it, StringPair("Scaling allowed",
                 _allowRescale ? yes : no));
@@ -1964,13 +1959,23 @@
         os << (*i)->get_depth();
            tr.append_child(charIter, StringPair(_("Depth"), os.str()));
 
+        /// Don't add if the character has no ratio value
+        if ((*i)->get_ratio() >= 0)
+        {
         os.str("");
         os << (*i)->get_ratio();
            tr.append_child(charIter, StringPair(_("Ratio"), os.str()));        
    
+           }       
 
+        /// Don't add if it's not a real clipping depth
+        if (int cd = (*i)->get_clip_depth() != -1000000 )
+        {
         os.str("");
-        os << (*i)->get_clip_depth();
+            if (cd == -2000000) os << "Dynamic mask";
+            else os << cd;
+
            tr.append_child(charIter, StringPair(_("Clipping depth"), 
os.str()));           
+        }
 
         os.str("");
         os << (*i)->get_width() << "x" << (*i)->get_height();




reply via email to

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