Revision: 2280
          http://synfig.svn.sourceforge.net/synfig/?rev=2280&view=rev
Author:   dooglus
Date:     2008-11-26 12:30:58 +0000 (Wed, 26 Nov 2008)

Log Message:
-----------
Add further comments.  Add local definition of FLAGS macro instead of using the 
one from color.h.  Remove unused flag checking code.

Modified Paths:
--------------
    synfig-core/trunk/src/synfig/renddesc.cpp
    synfig-core/trunk/src/synfig/renddesc.h

Modified: synfig-core/trunk/src/synfig/renddesc.cpp
===================================================================
--- synfig-core/trunk/src/synfig/renddesc.cpp   2008-11-25 23:27:51 UTC (rev 
2279)
+++ synfig-core/trunk/src/synfig/renddesc.cpp   2008-11-26 12:30:58 UTC (rev 
2280)
@@ -43,6 +43,9 @@
 
 /* === M A C R O S ========================================================= */
 
+#undef FLAGS
+#define FLAGS(x,y)             (((x)&(y))==(y))
+
 /* === G L O B A L S ======================================================= */
 
 /* === M E T H O D S ======================================================= */
@@ -101,25 +104,25 @@
 RendDesc &
 RendDesc::set_w(int x)
 {
-       if(FLAGS(flags,LINK_PX_ASPECT))
+       if(FLAGS(flags,LINK_PX_ASPECT)) // never set
        {
                h_=h_*x/w_;
                w_=x;
        }
-       else if(FLAGS(flags,LINK_PX_AREA))
+       else if(FLAGS(flags,LINK_PX_AREA)) // never set
        {
                //! \writeme
                w_=x;
        }
-       else if(FLAGS(flags,PX_ASPECT))
+       else if(FLAGS(flags,PX_ASPECT)) // "Pixel Aspect"
        {
                Vector d=br_-tl_;
                float old_span=get_span();
 
                // If we should preserve image width
-               if(             FLAGS(flags,IM_W)
-                       || (FLAGS(flags,IM_ZOOMIN) && d[1]>d[1]/x*w_)
-                       || (FLAGS(flags,IM_ZOOMOUT) && d[1]<d[1]/x*w_))
+               if(             FLAGS(flags,IM_W)                               
                        // "Image Width"
+                       || (FLAGS(flags,IM_ZOOMIN) && d[1]>d[1]/x*w_)   // 
never set
+                       || (FLAGS(flags,IM_ZOOMOUT) && d[1]<d[1]/x*w_)) // 
never set
                {
                        br_[1]-=focus[1];
                        br_[1]=br_[1]/x*w_;
@@ -139,10 +142,10 @@
 
                w_=x;
 
-               if(FLAGS(flags,IM_SPAN))
+               if(FLAGS(flags,IM_SPAN)) // "Image Span"
                        set_span(old_span);
        }
-       else if(FLAGS(flags,PX_AREA))
+       else if(FLAGS(flags,PX_AREA)) // never set
        {
                //! \writeme
                w_=x;
@@ -162,25 +165,25 @@
 RendDesc &
 RendDesc::set_h(int y)
 {
-       if(FLAGS(flags,LINK_PX_ASPECT))
+       if(FLAGS(flags,LINK_PX_ASPECT)) // never set
        {
                w_=w_*y/h_;
                h_=y;
        }
-       else if(FLAGS(flags,LINK_PX_AREA))
+       else if(FLAGS(flags,LINK_PX_AREA)) // never set
        {
                //! \writeme
                h_=y;
        }
-       else if(FLAGS(flags,PX_ASPECT))
+       else if(FLAGS(flags,PX_ASPECT)) // "Pixel Aspect"
        {
                Vector d=br_-tl_;
                float old_span=get_span();
 
                // If we should preserve image width
-               if(             FLAGS(flags,IM_W)
-                       || (FLAGS(flags,IM_ZOOMIN) && d[0]>d[0]/y*h_)
-                       || (FLAGS(flags,IM_ZOOMOUT) && d[0]<d[0]/y*h_))
+               if(             FLAGS(flags,IM_W)                               
                        // "Image Width"
+                       || (FLAGS(flags,IM_ZOOMIN) && d[0]>d[0]/y*h_)   // 
never set
+                       || (FLAGS(flags,IM_ZOOMOUT) && d[0]<d[0]/y*h_)) // 
never set
                {
                        br_[0]-=focus[0];
                        br_[0]=br_[0]/y*h_;
@@ -200,10 +203,10 @@
 
                h_=y;
 
-               if(FLAGS(flags,IM_SPAN))
+               if(FLAGS(flags,IM_SPAN)) // "Image Span"
                        set_span(old_span);
        }
-       else if(FLAGS(flags,PX_AREA))
+       else if(FLAGS(flags,PX_AREA)) // never set
        {
                //! \writeme
                h_=y;
@@ -416,7 +419,10 @@
 {
        Vector::value_type ratio=x/get_span();
 
-       if(!FLAGS(flags,IM_W|IM_H) || FLAGS(flags,IM_ASPECT))
+       //! \todo this looks wrong.  I suspect the intention was to check
+       //                "(not IM_W) AND (not IM_H)", ie "not(IM_W OR IM_H)" 
but
+       //                this check does "not(IM_W AND IM_H)"
+       if(!FLAGS(flags,IM_W|IM_H) || FLAGS(flags,IM_ASPECT)) // (not "Image 
Width") or (not "Image Height") or "Image Aspect"
        {
                br_-=focus;
                br_=br_*ratio;
@@ -425,7 +431,7 @@
                tl_=tl_*ratio;
                tl_+=focus;
        }
-       else if(FLAGS(flags,IM_W))
+       else if(FLAGS(flags,IM_W))      // "Image Width"
        {
                //! \writeme or fix me
                br_-=focus;
@@ -434,7 +440,7 @@
                tl_-=focus;
                tl_=tl_*ratio;
                tl_+=focus;
-       }else // IM_H
+       }else // IM_H                           // "Image Height"
        {
                //! \writeme or fix me
                br_-=focus;
@@ -479,7 +485,7 @@
 RendDesc &
 RendDesc::set_tl(const Point &x)
 {
-       if(FLAGS(flags,PX_ASPECT))
+       if(FLAGS(flags,PX_ASPECT)) // "Pixel Aspect"
        {
                Vector new_size(x-br_);
                new_size[0]=abs(new_size[0]);
@@ -502,7 +508,7 @@
 RendDesc &
 RendDesc::set_br(const Point &x)
 {
-       if(FLAGS(flags,PX_ASPECT))
+       if(FLAGS(flags,PX_ASPECT)) // "Pixel Aspect"
        {
                Vector new_size(x-tl_);
                new_size[0]=abs(new_size[0]);

Modified: synfig-core/trunk/src/synfig/renddesc.h
===================================================================
--- synfig-core/trunk/src/synfig/renddesc.h     2008-11-25 23:27:51 UTC (rev 
2279)
+++ synfig-core/trunk/src/synfig/renddesc.h     2008-11-26 12:30:58 UTC (rev 
2280)
@@ -55,15 +55,15 @@
 public:
        enum Lock
        {
-               PX_ASPECT=(1<<0),               // "_Pixel Aspect" in Locks and 
Links
+               PX_ASPECT=(1<<0),               // "Pixel Aspect" in Locks and 
Links
                PX_AREA=(1<<1),                 // not used
-               PX_W=(1<<2),                    // "Pi_xel Width" in Locks and 
Links
-               PX_H=(1<<3),                    // "Pix_el Height" in Locks and 
Links
+               PX_W=(1<<2),                    // "Pixel Width" in Locks and 
Links - not used
+               PX_H=(1<<3),                    // "Pixel Height" in Locks and 
Links - not used
 
-               IM_ASPECT=(1<<4),               // "Image _Aspect" in Locks and 
Links
-               IM_SPAN=(1<<5),                 // "Image _Span" in Locks and 
Links
-               IM_W=(1<<6),                    // "Image _Width" in Locks and 
Links
-               IM_H=(1<<7),                    // "Image _Height" in Locks and 
Links
+               IM_ASPECT=(1<<4),               // "Image Aspect" in Locks and 
Links
+               IM_SPAN=(1<<5),                 // "Image Span" in Locks and 
Links
+               IM_W=(1<<6),                    // "Image Width" in Locks and 
Links
+               IM_H=(1<<7),                    // "Image Height" in Locks and 
Links
                IM_ZOOMIN=(1<<8),               // not used
                IM_ZOOMOUT=(1<<9),              // not used
 
@@ -304,17 +304,6 @@
        return static_cast<RendDesc::Lock>(~(int)rhs);
 }
 
-//! \todo This code isn't used - so how are flags checked?  Using the FLAGS 
macro from color.h?
-//! This operator is for checking RendDesc::Lock flags.
-/*! Don't think of it as "less then or equal to", but think of it
-**     like an arrow. Is \a rhs inside of \a lhs ?
-**     \see RendDesc::Lock, RendDesc */
-// inline bool operator<=(RendDesc::Lock lhs, RendDesc::Lock rhs)
-// {
-//     return (static_cast<int>(lhs) & static_cast<int>(rhs)) == 
static_cast<int>(rhs);
-// }
-
-
 }; /* end namespace synfig */
 
 /* === E N D =============================================================== */


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to