gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/shape.cpp server/shape.h...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/shape.cpp server/shape.h...
Date: Wed, 14 Feb 2007 12:15:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/14 12:15:11

Modified files:
        .              : ChangeLog 
        server         : shape.cpp shape.h 
        server/parser  : BitmapMovieDefinition.cpp 

Log message:
                * server/shape.{cpp,h}: added primitives for
                  drawing API: draw{Line,Curve}{To,}.
                  Method names track Ming interface.
                * server/parser/BitmapMovieDefinition.cpp:
                  Use the path drawing api. (still doesn't work).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2357&r2=1.2358
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/BitmapMovieDefinition.cpp?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2357
retrieving revision 1.2358
diff -u -b -r1.2357 -r1.2358
--- ChangeLog   14 Feb 2007 11:08:12 -0000      1.2357
+++ ChangeLog   14 Feb 2007 12:15:10 -0000      1.2358
@@ -1,5 +1,13 @@
 2007-02-14 Sandro Santilli <address@hidden>
 
+       * server/shape.{cpp,h}: added primitives for
+         drawing API: draw{Line,Curve}{To,}.
+         Method names track Ming interface.
+       * server/parser/BitmapMovieDefinition.cpp: 
+         Use the path drawing api. (still doesn't work).
+
+2007-02-14 Sandro Santilli <address@hidden>
+
        * server/sprite_instance.cpp (goto_frame):
          Don't trash actions following gotoFrame() calls
          (fixes multiple_doactions_and_goto_frame_test.c).

Index: server/shape.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shape.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/shape.cpp    29 Nov 2006 00:21:40 -0000      1.26
+++ server/shape.cpp    14 Feb 2007 12:15:11 -0000      1.27
@@ -5,7 +5,7 @@
 
 // Quadratic bezier outline shapes, the basis for most SWF rendering.
 
-/* $Id: shape.cpp,v 1.26 2006/11/29 00:21:40 nihilus Exp $ */
+/* $Id: shape.cpp,v 1.27 2007/02/14 12:15:11 strk Exp $ */
 
 #include "shape.h"
 
@@ -283,6 +283,38 @@
     tesselate::end_path();
 }
 
+void 
+path::drawLine(float dx, float dy)
+{
+       m_edges.push_back(edge(dx, dy, dx, dy)); 
+}
+
+void 
+path::drawLineTo(float x, float y)
+{
+       float dx = x-m_ax;
+       float dy = x-m_ay;
+       // TODO: return if dx + dy == 0 ?
+       drawLine(dx, dy);
+}
+
+void 
+path::drawCurve(float cdx, float cdy, float adx, float ady)
+{
+       m_edges.push_back(edge(cdx, cdy, adx, ady)); 
+}
+
+void 
+path::drawCurveTo(float cx, float cy, float ax, float ay)
+{
+       float cdx = cx-m_ax;
+       float cdy = cx-m_ay;
+       float adx = ax-m_ax;
+       float ady = ax-m_ay;
+       // TODO: any check for skipping here ?
+       drawCurve(cdx, cdy, adx, ady);
+}
+
 
 // Utility.
 

Index: server/shape.h
===================================================================
RCS file: /sources/gnash/gnash/server/shape.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/shape.h      13 Feb 2007 17:03:18 -0000      1.14
+++ server/shape.h      14 Feb 2007 12:15:11 -0000      1.15
@@ -5,7 +5,7 @@
 
 // Quadratic bezier outline shapes, the basis for most SWF rendering.
 
-/* $Id: shape.h,v 1.14 2007/02/13 17:03:18 strk Exp $ */
+/* $Id: shape.h,v 1.15 2007/02/14 12:15:11 strk Exp $ */
 
 #ifndef GNASH_SHAPE_H
 #define GNASH_SHAPE_H
@@ -49,8 +49,43 @@
        public:
                path();
 
+               /// Initialize a path 
+               //
+               /// @param ax
+               ///     X coordinate of path origin in TWIPS
+               ///
+               /// @param ay
+               ///     Y coordinate in path origin in TWIPS
+               ///
+               /// @param fill0
+               ///     Fill style index for left fill
+               ///
+               /// @param fill1
+               ///     Fill style index for right fill
+               //
+               /// @param line
+               ///     Line style index for right fill
+               ///
+               ///
                path(float ax, float ay, int fill0, int fill1, int line);
 
+               /// Re-initialize a path 
+               //
+               /// @param ax
+               ///     X coordinate of path origin in TWIPS
+               ///
+               /// @param ay
+               ///     Y coordinate in path origin in TWIPS
+               ///
+               /// @param fill0
+               ///     Fill style index for left fill
+               ///
+               /// @param fill1
+               ///     Fill style index for right fill
+               //
+               /// @param line
+               ///     Line style index for right fill
+               ///
                void    reset(float ax, float ay, int fill0, int fill1, int 
line);
 
                bool    is_empty() const;
@@ -60,17 +95,76 @@
                /// Push the path into the tesselator.
                void    tesselate() const;
 
-               void addEdge(const edge& e)
-               {
-                       m_edges.push_back(e);
-               }
+               /// @{ Primitives for the Drawing API
+               ///
+               /// Name of these functions track Ming interface
+               ///
 
-               /// Set the beginning of the path.
-               void setStartPoint(float ax, float ay)
-               {
-                       m_ax = ax;
-                       m_ay = ay;
-               }
+               /// Draw a straight line using offsets.
+               //
+               /// Offset values are relative to last point in path
+               /// and expressed in TWIPS.
+               ///
+               /// @param dx
+               ///     X offset (delta).
+               ///
+               /// @param dy
+               ///     Y offset (delta).
+               ///
+               void drawLine(float dx, float dy);
+
+               /// Draw a straight line using coordinates (slower).
+               //
+               /// Point coordinates are relative to path origin
+               /// and expressed in TWIPS.
+               ///
+               /// @param x
+               ///     X coordinate in TWIPS
+               ///
+               /// @param y
+               ///     Y coordinate in TWIPS
+               ///
+               void drawLineTo(float x, float y);
+
+               /// Draw a curve using offsets.
+               //
+               /// Offset values are relative to last point in path and
+               /// expressed in TWIPS.
+               ///
+               /// @param cdx
+               ///     Control point's X offset (delta).
+               ///
+               /// @param cdy
+               ///     Control point's Y offset (delta).
+               ///
+               /// @param adx
+               ///     Anchor point's X offset (delta).
+               ///
+               /// @param ady
+               ///     Anchor point's Y offset (delta).
+               ///
+               void drawCurve(float cdx, float cdy, float adx, float ady);
+
+               /// Draw a curve using coordinates (slower)
+               //
+               /// Offset values are relative to path origin and
+               /// expressed in TWIPS.
+               ///
+               /// @param cx
+               ///     Control point's X coordinate.
+               ///
+               /// @param cy
+               ///     Control point's Y coordinate.
+               ///
+               /// @param ax
+               ///     Anchor point's X ordinate.
+               ///
+               /// @param ay
+               ///     Anchor point's Y ordinate.
+               ///
+               void drawCurveTo(float cx, float cy, float ax, float ay);
+
+               /// @} Primitives for the Drawing API
 
                /// Set the fill to use on the left side
                //
@@ -108,7 +202,10 @@
                int     m_fill1;
 
                int     m_line;
-               float   m_ax, m_ay;     // starting point
+
+               /// Path/shape origin
+               float   m_ax, m_ay;
+
                std::vector<edge>       m_edges;
                bool    m_new_shape;
        };

Index: server/parser/BitmapMovieDefinition.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/BitmapMovieDefinition.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/parser/BitmapMovieDefinition.cpp     14 Feb 2007 09:03:53 -0000      
1.1
+++ server/parser/BitmapMovieDefinition.cpp     14 Feb 2007 12:15:11 -0000      
1.2
@@ -63,10 +63,10 @@
        log_msg("Creating a shape_definition wrapping a %f x %f bitmap", w, h);
 
        path bmPath(w, h, 0, -1, 0);
-       bmPath.addEdge(edge(w, 0, w, 0)); // line to top-right
-       //bmPath.addEdge(edge(0, 0, 0, 0)); // line to top-left
-       bmPath.addEdge(edge(0, h, 0, h)); // line to bottom-left
-       bmPath.addEdge(edge(w, h, w, h)); // line to bottom-right
+       bmPath.drawLineTo(w, 0);
+       bmPath.drawLineTo(0, 0);
+       bmPath.drawLineTo(0, h);
+       bmPath.drawLineTo(w, h);
 
        // Add the path 
 




reply via email to

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