gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/BitmapMovieInstance.cpp ...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/BitmapMovieInstance.cpp ...
Date: Wed, 14 Feb 2007 09:03:53 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/14 09:03:53

Modified files:
        .              : ChangeLog 
        server         : BitmapMovieInstance.cpp BitmapMovieInstance.h 
                         impl.cpp 
        server/parser  : BitmapMovieDefinition.h Makefile.am 
Added files:
        server/parser  : BitmapMovieDefinition.cpp 

Log message:
                * server/BitmapMovieInstance.{cpp,h}: use 
sprite_instance::display,
                  don't override it. instead, place the bitmap shape in the
                  displaylist.
                * server/parser/BitmapMovieDefinition.{cpp,h}: change
                  constructor to take an image rather then a 
bitmap_character_def
                  (the latter has a poor interface).
                * server/impl.cpp: updated construction of 
BitmapMovieDefinition.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2352&r2=1.2353
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BitmapMovieInstance.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/BitmapMovieInstance.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.91&r2=1.92
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/BitmapMovieDefinition.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Makefile.am?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/BitmapMovieDefinition.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2352
retrieving revision 1.2353
diff -u -b -r1.2352 -r1.2353
--- ChangeLog   14 Feb 2007 08:47:12 -0000      1.2352
+++ ChangeLog   14 Feb 2007 09:03:53 -0000      1.2353
@@ -1,5 +1,12 @@
 2007-02-13 Sandro Santilli <address@hidden>
 
+       * server/BitmapMovieInstance.{cpp,h}: use sprite_instance::display,
+         don't override it. instead, place the bitmap shape in the
+         displaylist.
+       * server/parser/BitmapMovieDefinition.{cpp,h}: change
+         constructor to take an image rather then a bitmap_character_def
+         (the latter has a poor interface).
+       * server/impl.cpp: updated construction of BitmapMovieDefinition.
        * server/parser/shape_character_def.h: new add_line_style()
          method, for programmatic definition of shapes.
 

Index: server/BitmapMovieInstance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/BitmapMovieInstance.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/BitmapMovieInstance.cpp      13 Feb 2007 13:35:34 -0000      1.1
+++ server/BitmapMovieInstance.cpp      14 Feb 2007 09:03:53 -0000      1.2
@@ -24,39 +24,27 @@
 
 #include "BitmapMovieInstance.h"
 #include "BitmapMovieDefinition.h"
+#include "fill_style.h"
+#include "shape.h" // for class path and class edge
 #include "render.h" // for ::display
 
 using namespace std;
 
 namespace gnash {
 
-BitmapMovieInstance::BitmapMovieInstance(BitmapMovieDefinition* def,
-               character* parent)
+BitmapMovieInstance::BitmapMovieInstance(BitmapMovieDefinition* def)
        :
-       movie_instance(def, parent),
-       _bitmap(def->get_bitmap_char_def())
+       movie_instance(def, NULL)
 {
-       // TODO: 
-       //   - Define a rectangle fill shape using the bitmap as a fill
-       //   - add the shape to the display list 
-
+       // We need to assign a character id to the instance, or an assertion
+       // will fail in character.cpp (parent==NULL || id != -1)
+       character_def* chdef = def->get_character_def(1); 
+       assert(chdef);
+       boost::intrusive_ptr<character> ch = 
chdef->create_character_instance(this, 1);
+       log_msg("Created char in BitmapMovieInstance is a %s", 
typeid(*ch).name());
+       int depth = 1;
+       place_character(ch.get(), depth, cxform(), matrix(), 1.0, 0);
 }
 
-void
-BitmapMovieInstance::display()
-{
-       // TODO: when things in the constructor are done we can
-       //       completely avoid overriding ::display
-       //       and things should automatically work
-       //       (use sprite_instance::display)
-       //
-       log_error("FIXME: display of BitmapMovieInstance unimplemented !");
-
-       clear_invalidated(); // clear_invalidated is just needed so display()
-                            // is not called over and over - to reduce 
verbosity
-                            // of the FIXME error above.
-
-       do_display_callback();
-}
 
 } // namespace gnash

Index: server/BitmapMovieInstance.h
===================================================================
RCS file: /sources/gnash/gnash/server/BitmapMovieInstance.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/BitmapMovieInstance.h        13 Feb 2007 13:35:34 -0000      1.1
+++ server/BitmapMovieInstance.h        14 Feb 2007 09:03:53 -0000      1.2
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: BitmapMovieInstance.h,v 1.1 2007/02/13 13:35:34 strk Exp $ */
+/* $Id: BitmapMovieInstance.h,v 1.2 2007/02/14 09:03:53 strk Exp $ */
 
 #ifndef GNASH_BITMAPMOVIEINSTANCE_H
 #define GNASH_BITMAPMOVIEINSTANCE_H
@@ -27,7 +27,6 @@
 #endif
 
 #include "movie_instance.h" // for inheritance
-#include "bitmap_character_def.h" // for destructor visibility by intrusive_ptr
 
 // Forward declarations
 namespace gnash
@@ -43,16 +42,12 @@
 class BitmapMovieInstance : public movie_instance
 {
 
-       boost::intrusive_ptr<bitmap_character_def> _bitmap;
-
 public:
 
-       BitmapMovieInstance(BitmapMovieDefinition* def, character* parent);
+       BitmapMovieInstance(BitmapMovieDefinition* def); 
 
        virtual ~BitmapMovieInstance() {}
 
-       virtual void display ();
-
 };
 
 } // end of namespace gnash

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -b -r1.91 -r1.92
--- server/impl.cpp     13 Feb 2007 13:35:34 -0000      1.91
+++ server/impl.cpp     14 Feb 2007 09:03:53 -0000      1.92
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: impl.cpp,v 1.91 2007/02/13 13:35:34 strk Exp $ */
+/* $Id: impl.cpp,v 1.92 2007/02/14 09:03:53 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -335,9 +335,7 @@
                return NULL;
        } 
 
-       boost::intrusive_ptr<bitmap_character_def> def = new 
bitmap_character_def(im);
-
-       BitmapMovieDefinition* mdef = new BitmapMovieDefinition(def, url);
+       BitmapMovieDefinition* mdef = new BitmapMovieDefinition(im, url);
        log_msg("BitmapMovieDefinition %p created", mdef);
        return mdef;
 

Index: server/parser/BitmapMovieDefinition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/BitmapMovieDefinition.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/parser/BitmapMovieDefinition.h       13 Feb 2007 13:35:34 -0000      
1.1
+++ server/parser/BitmapMovieDefinition.h       14 Feb 2007 09:03:53 -0000      
1.2
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
 #include "movie_definition.h" // for inheritance
 #include "rect.h" // for composition
 #include "BitmapMovieInstance.h" // for create_instance
+#include "bitmap_character_def.h" // for destructor visibility by intrusive_ptr
+#include "shape_character_def.h" // for destructor visibility by intrusive_ptr
 
 #include <string>
 #include <memory> // for auto_ptr
@@ -48,38 +50,39 @@
        std::vector<PlayList> _playlist;
        float _framerate;
        std::string _url;
+
+       std::auto_ptr<image::rgb> _image;
+
        boost::intrusive_ptr<bitmap_character_def> _bitmap;
 
+       boost::intrusive_ptr<shape_character_def> _shapedef;
+
+       /// Get the shape character definition for this bitmap movie
+       //
+       /// It will create the definition the first time it's called
+       ///
+       shape_character_def* getShapeDef();
+
 public:
 
 
-       /// Default constructor
+       /// Construct a BitmapMovieDefinition for the given image (rgb)
        //
        /// Will be initialized with the following values
        ///
        ///  - SWF version 6
-       ///  - 640x480 size
+       ///  - Framesize extracted from image 
        ///  - Single frame (unlabeled)
        ///  - 12 FPS
        ///  - 0 bytes (for get_bytes_loaded()/get_bytes_total())
-       ///  - empty url
+       ///  - provided url
        ///
-       BitmapMovieDefinition(boost::intrusive_ptr<bitmap_character_def> bi, 
const std::string& url)
-               :
-               _version(6),
-               // FIXME: extract size from the bitmap_character
-               _framesize(0, 0, 640*20, 480*20),
-               _framecount(1),
-               _playlist(_framecount),
-               _framerate(12),
-               _url(url),
-               _bitmap(bi)
-       {
-       }
+       BitmapMovieDefinition(std::auto_ptr<image::rgb> image, const 
std::string& url);
 
-       bitmap_character_def* get_bitmap_char_def()
+       // Discard id, always return the only shape character we have 
+       virtual character_def* get_character_def(int /*id*/)
        {
-               return _bitmap.get();
+               return getShapeDef();
        }
 
        virtual int     get_version() const {
@@ -127,7 +130,7 @@
        /// Create a playable movie_instance from this def.
        virtual movie_instance* create_movie_instance()
        {
-               return new BitmapMovieInstance(this, NULL);
+               return new BitmapMovieInstance(this);
        }
 
        virtual const PlayList& get_playlist(size_t frame_number) {

Index: server/parser/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Makefile.am,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/parser/Makefile.am   13 Feb 2007 13:35:34 -0000      1.23
+++ server/parser/Makefile.am   14 Feb 2007 09:03:53 -0000      1.24
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-# $Id: Makefile.am,v 1.23 2007/02/13 13:35:34 strk Exp $
+# $Id: Makefile.am,v 1.24 2007/02/14 09:03:53 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -46,6 +46,7 @@
 libgnashparser_la_SOURCES = \
        action_buffer.cpp \
        bitmap_character_def.cpp \
+       BitmapMovieDefinition.cpp \
        button_character_def.cpp \
        character_def.cpp \
        edit_text_character_def.cpp \

Index: server/parser/BitmapMovieDefinition.cpp
===================================================================
RCS file: server/parser/BitmapMovieDefinition.cpp
diff -N server/parser/BitmapMovieDefinition.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/parser/BitmapMovieDefinition.cpp     14 Feb 2007 09:03:53 -0000      
1.1
@@ -0,0 +1,93 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+// 
+// This program 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; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include "BitmapMovieInstance.h"
+#include "BitmapMovieDefinition.h"
+#include "fill_style.h"
+#include "shape.h" // for class path and class edge
+#include "render.h" // for ::display
+
+using namespace std;
+
+namespace gnash {
+
+
+shape_character_def*
+BitmapMovieDefinition::getShapeDef()
+{
+       if ( _shapedef ) return _shapedef.get();
+
+       _bitmap = new bitmap_character_def(_image);
+
+       // Create the shape definition
+
+       _shapedef = new shape_character_def();
+
+       // Set its boundaries
+
+       _shapedef->set_bound(_framesize);
+
+       // Add the bitmap fill style (fill style 0)
+
+       fill_style bmFill(_bitmap.get());
+       line_style line(2, rgba(255, 0, 0, 255));
+       _shapedef->add_fill_style(bmFill);
+       _shapedef->add_line_style(line);
+
+       // Define a rectangle filled with the bitmap style
+
+       float w = _framesize.width();
+       float h = _framesize.height();
+
+       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
+
+       // Add the path 
+
+       _shapedef->add_path(bmPath);
+
+       return _shapedef.get();
+}
+
+BitmapMovieDefinition::BitmapMovieDefinition(
+               std::auto_ptr<image::rgb> image,
+               const std::string& url)
+       :
+       _version(6),
+       _framesize(0, 0, image->m_width*20, image->m_height*20),
+       _framecount(1),
+       _playlist(_framecount),
+       _framerate(12),
+       _url(url),
+       _image(image)
+{
+       // Do not create shape_character_def now (why?)
+}
+
+} // namespace gnash




reply via email to

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