gnash-commit
[Top][All Lists]
Advanced

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

Re: [Gnash-commit] gnash ChangeLog server/cxform.cpp server/cxform...


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog server/cxform.cpp server/cxform...
Date: Wed, 4 Jun 2008 08:58:20 +0800

> -void    cxform::print() const
> -// Debug log.
> -{
> -    log_parse("    *         +");
> -    log_parse("| %4.4f %4.4f|", ra/256.0, rb);
> -    log_parse("| %4.4f %4.4f|", ga/256.0, gb);
> -    log_parse("| %4.4f %4.4f|", ba/256.0, bb);
> -    log_parse("| %4.4f %4.4f|", aa/256.0, ab);
> -}
> -

> +    os
> +    << std::endl
> +    << "| r: * " <<  std::setw(fieldWidth) << cx.ra
> +    << " + " << std::setw(fieldWidth) << cx.rb << " |"


Note that elements in cxform now are fixed point integers, see docs in
cxform.h. Print them directly means printing the data stored in swf
files, not the data used in ActionScript for users.  eg. From the user
aspect, 'ra' ranges in [-x% y%](not sure about x and y at the moment),
'rb' ranges in [-256, 256].

I am not used to rely on printings,  so not sure which data format we
want for the cxform.  Just note that cxform::print() is slightly
different as operator<<().

--zou

On 6/3/08, Benjamin Wolsey <address@hidden> wrote:
> CVSROOT:        /sources/gnash
> Module name:    gnash
> Changes by:     Benjamin Wolsey <bwy>   08/06/03 12:27:26
>
> Modified files:
>        .              : ChangeLog
>        server         : cxform.cpp cxform.h
>        server/swf     : PlaceObject2Tag.cpp
>
> Log message:
>                * server/cxform.{cpp,h}: drop cxform::print().
>                * server/swf/PlaceObject2Tag.cpp: use cxform ostream operator.
>
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6788&r2=1.6789
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.cpp?cvsroot=gnash&r1=1.17&r2=1.18
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.h?cvsroot=gnash&r1=1.14&r2=1.15
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.cpp?cvsroot=gnash&r1=1.45&r2=1.46
>
> Patches:
> Index: ChangeLog
> ===================================================================
> RCS file: /sources/gnash/gnash/ChangeLog,v
> retrieving revision 1.6788
> retrieving revision 1.6789
> diff -u -b -r1.6788 -r1.6789
> --- ChangeLog   3 Jun 2008 10:44:44 -0000       1.6788
> +++ ChangeLog   3 Jun 2008 12:27:25 -0000       1.6789
> @@ -1,5 +1,10 @@
>  2008-06-03 Benjamin Wolsey <address@hidden>
>
> +       * server/cxform.{cpp,h}: drop cxform::print().
> +       * server/swf/PlaceObject2Tag.cpp: use cxform ostream operator.
> +
> +2008-06-03 Benjamin Wolsey <address@hidden>
> +
>        * server/parser/movie_def_impl.cpp: add ensureBytes.
>        * server/matrix.{h,cpp}: drop matrix::print() method in favour
>          of the ostream operator. Make output prettier.
>
> Index: server/cxform.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/server/cxform.cpp,v
> retrieving revision 1.17
> retrieving revision 1.18
> diff -u -b -r1.17 -r1.18
> --- server/cxform.cpp   21 May 2008 07:26:08 -0000      1.17
> +++ server/cxform.cpp   3 Jun 2008 12:27:25 -0000       1.18
> @@ -18,21 +18,17 @@
>  //
>  //
>
> -#ifdef HAVE_CONFIG_H
> -    #include "gnashconfig.h"
> -#endif
> -
>  #include "cxform.h"
>  #include "types.h" // for rgba type :(
>  #include "stream.h" // for reading from SWF
>  #include "log.h"
>  #include "utility.h" // for utility::clamp
> +#include <iomanip>
>
>  namespace gnash {
>
>  using boost::uint8_t;
>  using boost::int16_t;
> -using utility::clamp;
>
>  cxform::cxform()
>  // Initialize to identity transform.
> @@ -82,6 +78,8 @@
>     bt = (bt * ba >> 8) + bb;
>     at = (at * aa >> 8) + ab;
>
> +    using utility::clamp;
> +
>     r = (uint8_t)(clamp<int16_t>(rt, 0, 255));
>     g = (uint8_t)(clamp<int16_t>(gt, 0, 255));
>     b = (uint8_t)(clamp<int16_t>(bt, 0, 255));
> @@ -166,16 +164,6 @@
>     }
>  }
>
> -void    cxform::print() const
> -// Debug log.
> -{
> -    log_parse("    *         +");
> -    log_parse("| %4.4f %4.4f|", ra/256.0, rb);
> -    log_parse("| %4.4f %4.4f|", ga/256.0, gb);
> -    log_parse("| %4.4f %4.4f|", ba/256.0, bb);
> -    log_parse("| %4.4f %4.4f|", aa/256.0, ab);
> -}
> -
>  std::string
>  cxform::toString() const
>  {
> @@ -187,10 +175,23 @@
>  std::ostream&
>  operator<< (std::ostream& os, const cxform& cx)
>  {
> -    os << "r: *"  << cx.ra << " +" << cx.rb << ", ";
> -    os << "|g: *" << cx.ga << " +" << cx.gb << ", ";
> -    os << "|b: *" << cx.ba << " +" << cx.bb << ", ";
> -    os << "|a: *" << cx.aa << " +" << cx.ab;
> +    // For integers up to 256
> +    const short fieldWidth = 3;
> +
> +    os
> +    << std::endl
> +    << "| r: * " <<  std::setw(fieldWidth) << cx.ra
> +    << " + " << std::setw(fieldWidth) << cx.rb << " |"
> +    << std::endl
> +    << "| g: * " << std::setw(fieldWidth) << cx.ga
> +    << " + "  << std::setw(fieldWidth) << cx.gb << " |"
> +    << std::endl
> +    << "| b: * " << std::setw(fieldWidth) << cx.ba
> +    << " + " << std::setw(fieldWidth) << cx.bb << " |"
> +    << std::endl
> +    << "| a: * " << std::setw(fieldWidth) << cx.aa
> +    << " + " << std::setw(fieldWidth) << cx.ab << " |";
> +
>     return os;
>  }
>
>
> Index: server/cxform.h
> ===================================================================
> RCS file: /sources/gnash/gnash/server/cxform.h,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -b -r1.14 -r1.15
> --- server/cxform.h     21 May 2008 07:26:08 -0000      1.14
> +++ server/cxform.h     3 Jun 2008 12:27:25 -0000       1.15
> @@ -115,7 +115,6 @@
>
>        std::string toString() const;
>
> -       void print() const;
>  };
>
>
>
> Index: server/swf/PlaceObject2Tag.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.cpp,v
> retrieving revision 1.45
> retrieving revision 1.46
> diff -u -b -r1.45 -r1.46
> --- server/swf/PlaceObject2Tag.cpp      3 Jun 2008 10:44:45 -0000       1.45
> +++ server/swf/PlaceObject2Tag.cpp      3 Jun 2008 12:27:26 -0000       1.46
> @@ -51,8 +51,7 @@
>
>         IF_VERBOSE_PARSE
>         (
> -            log_parse(_("  cxform:"));
> -            m_color_transform.print();
> +            log_parse(_("  cxform: %s"), m_color_transform);
>         );
>
>     }
> @@ -289,8 +288,7 @@
>         }
>         if ( hasCxform() )
>         {
> -            log_parse(_("  cxform:"));
> -            m_color_transform.print();
> +            log_parse(_("  cxform: %s"), m_color_transform);
>         }
>         if ( hasRatio() ) log_parse(_("  ratio: %d"), m_ratio);
>         if ( hasName() ) log_parse(_("  name = %s"), m_name.c_str());
> @@ -381,8 +379,7 @@
>             log_parse("   matrix: %s", m_matrix);
>     }
>         if ( hasCxform() ) {
> -            log_parse("   cxform:");
> -            m_color_transform.print();
> +            log_parse("   cxform: %s", m_color_transform);
>     }
>         if ( hasRatio() )  log_parse("   ratio:%d", m_ratio);
>         if ( hasName() ) log_parse("   name:%s", m_name);
> @@ -427,8 +424,7 @@
>         }
>         if ( hasCxform() )
>         {
> -            log_parse(_("  cxform:"));
> -            m_color_transform.print();
> +            log_parse(_("  cxform: %d"), m_color_transform);
>         }
>         if ( hasRatio() ) log_parse(_("  ratio: %d"), m_ratio);
>         if ( hasName() ) log_parse(_("  name = %s"), m_name);
>
>
> _______________________________________________
> Gnash-commit mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-commit
>




reply via email to

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