[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/Makefile.am server/sprit...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/Makefile.am server/sprit... |
Date: |
Mon, 19 Feb 2007 11:08:23 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/02/19 11:08:23
Modified files:
. : ChangeLog
server : Makefile.am sprite_instance.cpp
sprite_instance.h
server/parser : BitmapMovieDefinition.cpp
BitmapMovieDefinition.h shape_character_def.cpp
shape_character_def.h
Added files:
server : DynamicShape.cpp DynamicShape.h
Log message:
* server/parser/shape_character_def.{h,cpp}: removed calls
for dynamic drawing. Use DynamicShape instead.
* server/: Makefile.am, DynamicShape.{cpp,h}:
New subclass of shape_character_def to abstract dynami drawing
* server/sprite_instance.{cpp,h}:
Implement lineStyle, moveTo, lineTo methods of MovieClip
class. This works by maintaining a DynamicShape member.
* server/parser/BitmapMovieDefinition.{cpp,h}: use
a DynamicShape rather then a shape_character_def.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2392&r2=1.2393
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.103&r2=1.104
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.171&r2=1.172
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/BitmapMovieDefinition.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/BitmapMovieDefinition.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.h?cvsroot=gnash&r1=1.9&r2=1.10
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2392
retrieving revision 1.2393
diff -u -b -r1.2392 -r1.2393
--- ChangeLog 19 Feb 2007 10:41:57 -0000 1.2392
+++ ChangeLog 19 Feb 2007 11:08:22 -0000 1.2393
@@ -1,5 +1,17 @@
2007-02-19 Sandro Santilli <address@hidden>
+ * server/parser/shape_character_def.{h,cpp}: removed calls
+ for dynamic drawing. Use DynamicShape instead.
+ * server/: Makefile.am, DynamicShape.{cpp,h}:
+ New subclass of shape_character_def to abstract dynami drawing
+ * server/sprite_instance.{cpp,h}:
+ Implement lineStyle, moveTo, lineTo methods of MovieClip
+ class. This works by maintaining a DynamicShape member.
+ * server/parser/BitmapMovieDefinition.{cpp,h}: use
+ a DynamicShape rather then a shape_character_def.
+
+2007-02-19 Sandro Santilli <address@hidden>
+
* server/shape.{cpp,h}: new empty() and close()
methods.
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -b -r1.103 -r1.104
--- server/Makefile.am 13 Feb 2007 15:19:32 -0000 1.103
+++ server/Makefile.am 19 Feb 2007 11:08:22 -0000 1.104
@@ -18,7 +18,7 @@
#
#
-# $Id: Makefile.am,v 1.103 2007/02/13 15:19:32 strk Exp $
+# $Id: Makefile.am,v 1.104 2007/02/19 11:08:22 strk Exp $
AUTOMAKE_OPTIONS =
@@ -57,6 +57,7 @@
as_object.cpp \
as_value.cpp \
character.cpp \
+ DynamicShape.cpp \
edit_text_character.cpp \
generic_character.cpp \
matrix.cpp \
@@ -109,6 +110,7 @@
button_character_instance.h \
character.h \
debugger.h \
+ DynamicShape.h \
dlist.h \
drag_state.h \
edit_text_character.h \
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -b -r1.171 -r1.172
--- server/sprite_instance.cpp 16 Feb 2007 21:28:01 -0000 1.171
+++ server/sprite_instance.cpp 19 Feb 2007 11:08:22 -0000 1.172
@@ -872,12 +872,24 @@
sprite_lineTo(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
- UNUSED(sprite);
+
+ if ( fn.nargs < 2 )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("MovieClip.lineTo() takes two args");
+ );
+ return;
+ }
+
+ float x = PIXELS_TO_TWIPS(fn.arg(0).to_number());
+ float y = PIXELS_TO_TWIPS(fn.arg(1).to_number());
+
+ sprite->lineTo(x, y);
static bool warned = false;
if ( ! warned )
{
- log_error("FIXME: MovieClip.lineTo() not implemented yet");
+ log_warning("MovieClip.lineTo() TESTING");
warned=true;
}
}
@@ -886,12 +898,24 @@
sprite_moveTo(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
- UNUSED(sprite);
+
+ if ( fn.nargs < 2 )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("MovieClip.moveTo() takes two args");
+ );
+ return;
+ }
+
+ float x = PIXELS_TO_TWIPS(fn.arg(0).to_number());
+ float y = PIXELS_TO_TWIPS(fn.arg(1).to_number());
+
+ sprite->moveTo(x, y);
static bool warned = false;
if ( ! warned )
{
- log_error("FIXME: MovieClip.moveTo() not implemented yet");
+ log_warning("MovieClip.moveTo() TESTING");
warned=true;
}
}
@@ -900,12 +924,45 @@
sprite_lineStyle(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
- UNUSED(sprite);
+
+ if ( fn.nargs < 1 )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("MovieClip.lineStyle(<thickness>, [<rgb>],
[<alpha>]) takes at least 1 arg");
+ );
+ return;
+ }
+
+ uint16_t thickness =
uint16_t(PIXELS_TO_TWIPS(uint16_t(fclamp(fn.arg(0).to_number(), 0, 255))));
+ uint8_t r = 0;
+ uint8_t g = 0;
+ uint8_t b = 0;
+ uint8_t a = 255;
+
+ if ( fn.nargs > 1 )
+ {
+ // 2^24 is the max here
+ uint32_t rgbval = uint32_t(fclamp(fn.arg(1).to_number(), 0,
16777216));
+ r = uint8_t( (rgbval&0xFF0000) >> 16);
+ g = uint8_t( (rgbval&0x00FF00) >> 8);
+ b = uint8_t( (rgbval&0x0000FF) );
+ }
+
+ if ( fn.nargs > 2 )
+ {
+ float alphaval = fclamp(fn.arg(2).to_number(), 0, 255);
+ a = uint8_t(alphaval);
+ }
+
+ rgba color(r, g, b, a);
+ //log_msg("Color: %s", color.toString().c_str());
+
+ sprite->lineStyle(thickness, color);
static bool warned = false;
if ( ! warned )
{
- log_error("FIXME: MovieClip.lineStyle() not implemented yet");
+ log_warning("FIXME: MovieClip.lineStyle() TESTING");
warned=true;
}
}
@@ -914,12 +971,26 @@
sprite_curveTo(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
- UNUSED(sprite);
+
+ if ( fn.nargs < 4 )
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("MovieClip.curveTo() takes four args");
+ );
+ return;
+ }
+
+ float cx = PIXELS_TO_TWIPS(fn.arg(0).to_number());
+ float cy = PIXELS_TO_TWIPS(fn.arg(1).to_number());
+ float ax = PIXELS_TO_TWIPS(fn.arg(2).to_number());
+ float ay = PIXELS_TO_TWIPS(fn.arg(3).to_number());
+
+ sprite->curveTo(cx, cy, ax, ay);
static bool warned = false;
if ( ! warned )
{
- log_error("FIXME: MovieClip.curveTo() not implemented yet");
+ log_warning("MovieClip.curveTo() TESTING");
warned=true;
}
}
@@ -928,12 +999,13 @@
sprite_clear(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
- UNUSED(sprite);
+
+ sprite->clear();
static bool warned = false;
if ( ! warned )
{
- log_error("FIXME: MovieClip.clear() not implemented yet");
+ log_warning("FIXME: MovieClip.clear() TESTING");
warned=true;
}
}
@@ -1541,6 +1613,8 @@
m_root(r),
m_display_list(),
oldDisplayList(),
+ _drawable(new DynamicShape),
+ _drawable_inst(_drawable->create_character_instance(this, 0)),
m_action_list(),
m_goto_frame_action_list(),
m_play_state(PLAY),
@@ -2928,8 +3002,22 @@
rect bounds;
m_display_list.get_invalidated_bounds(&bounds, true);
+ // expand to bounds of _drawable
+ bounds.expand_to_transformed_rect(get_world_matrix(),
_drawable->get_bound());
+
if (gnash::render::bounds_in_clipping_area(bounds))
{
+ _drawable->finalize();
+ // TODO: I'd like to draw the definition directly..
+ // but it seems that the backend insists in
+ // accessing the *parent* of the character
+ // passed as "instance" for the drawing.
+ // When displaying top-level movie this will
+ // be NULL and gnash will segfault
+ // Thus, this drawable_instance is basically just
+ // a container for a parent :(
+ _drawable_inst->display();
+
m_display_list.display();
clear_invalidated();
}
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- server/sprite_instance.h 16 Feb 2007 11:09:41 -0000 1.68
+++ server/sprite_instance.h 19 Feb 2007 11:08:22 -0000 1.69
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.68 2007/02/16 11:09:41 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.69 2007/02/19 11:08:22 strk Exp $ */
// Stateful live Sprite instance
@@ -33,6 +33,7 @@
#include "dlist.h" // DisplayList
#include "log.h"
#include "as_environment.h" // for composition
+#include "DynamicShape.h" // for composition
#include <vector>
#include <list>
@@ -593,6 +594,38 @@
/// _target and _target_dot.
virtual void set_name(const char* name);
+ /// @{ Drawing API
+
+ void lineStyle(uint16_t thickness, const rgba& color)
+ {
+ _drawable->lineStyle(thickness, color);
+ }
+
+ void moveTo(float x, float y)
+ {
+ _drawable->moveTo(x, y);
+ }
+
+ void lineTo(float x, float y)
+ {
+ set_invalidated();
+ _drawable->lineTo(x, y);
+ }
+
+ void curveTo(float cx, float cy, float ax, float ay)
+ {
+ set_invalidated();
+ _drawable->curveTo(cx, cy, ax, ay);
+ }
+
+ void clear()
+ {
+ set_invalidated();
+ _drawable->clear();
+ }
+
+ /// @} Drawing API
+
private:
// Used to assign a name to unnamed (movieclip-only?) instances
@@ -626,6 +659,24 @@
/// It will be used to control actions execution order.
DisplayList oldDisplayList;
+ /// The canvas for dynamic drawing
+ //
+ /// WARNING: since DynamicShape is a character_def, which is
+ /// in turn a ref_counted, we'd better keep
+ /// this by intrusive_ptr, even if we're the sole
+ /// owners. The problem is in case a pointer to this
+ /// instance ever gets passed to some function wrapping
+ /// it into an intrusive_ptr, in which case the stack
+ /// object will be destroyed, with horrible consequences ...
+ ///
+ boost::intrusive_ptr<DynamicShape> _drawable;
+
+ /// The need of an instance here is due to the renderer
+ /// insising on availability a shape_character_def instance
+ /// that has a parent (why?)
+ ///
+ boost::intrusive_ptr<character> _drawable_inst;
+
ActionList m_action_list;
ActionList m_goto_frame_action_list;
Index: server/parser/BitmapMovieDefinition.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/BitmapMovieDefinition.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/parser/BitmapMovieDefinition.cpp 18 Feb 2007 09:50:48 -0000
1.7
+++ server/parser/BitmapMovieDefinition.cpp 19 Feb 2007 11:08:22 -0000
1.8
@@ -42,7 +42,7 @@
// Create the shape definition
- _shapedef = new shape_character_def();
+ _shapedef = new DynamicShape();
// Set its boundaries
Index: server/parser/BitmapMovieDefinition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/BitmapMovieDefinition.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/parser/BitmapMovieDefinition.h 15 Feb 2007 21:16:29 -0000
1.3
+++ server/parser/BitmapMovieDefinition.h 19 Feb 2007 11:08:22 -0000
1.4
@@ -25,7 +25,7 @@
#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 "DynamicShape.h" // for destructor visibility by intrusive_ptr
#include <string>
#include <memory> // for auto_ptr
@@ -55,7 +55,7 @@
boost::intrusive_ptr<bitmap_character_def> _bitmap;
- boost::intrusive_ptr<shape_character_def> _shapedef;
+ boost::intrusive_ptr<DynamicShape> _shapedef;
/// Get the shape character definition for this bitmap movie
//
Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/parser/shape_character_def.cpp 18 Feb 2007 09:50:48 -0000
1.12
+++ server/parser/shape_character_def.cpp 19 Feb 2007 11:08:22 -0000
1.13
@@ -6,7 +6,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape_character_def.cpp,v 1.12 2007/02/18 09:50:48 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.13 2007/02/19 11:08:22 strk Exp $ */
#include "shape_character_def.h"
@@ -127,11 +127,18 @@
shape_character_def::shape_character_def()
+ :
+ m_fill_styles(),
+ m_line_styles(),
+ m_paths(),
+ m_bound(),
+ m_cached_meshes()
{
}
-shape_character_def::~shape_character_def()
+void
+shape_character_def::clear_meshes()
{
// Free our mesh_sets.
for (unsigned int i = 0; i < m_cached_meshes.size(); i++) {
@@ -139,6 +146,11 @@
}
}
+shape_character_def::~shape_character_def()
+{
+ clear_meshes();
+}
+
void
shape_character_def::read(stream* in, int tag_type, bool with_style,
@@ -646,30 +658,6 @@
}
}
-size_t
-shape_character_def::add_fill_style(const fill_style& stl)
-{
- typedef FillStyleVect V;
- V& v=m_fill_styles;
-
- // TODO: check if the style is already in our list
- // (needs operator== defined for fill_style)
- v.push_back(stl);
- return v.size(); // 1-based !
-}
-
-size_t
-shape_character_def::add_line_style(const line_style& stl)
-{
- typedef LineStyleVect V;
- V& v=m_line_styles;
-
- // TODO: check if the style is already in our list
- // (needs operator== defined for line_style)
- v.push_back(stl);
- return v.size(); // 1-based !
-}
-
} // end namespace gnash
Index: server/parser/shape_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/parser/shape_character_def.h 18 Feb 2007 09:50:48 -0000 1.9
+++ server/parser/shape_character_def.h 19 Feb 2007 11:08:23 -0000 1.10
@@ -5,7 +5,7 @@
// Quadratic bezier outline shapes, the basis for most SWF rendering.
-/* $Id: shape_character_def.h,v 1.9 2007/02/18 09:50:48 strk Exp $ */
+/* $Id: shape_character_def.h,v 1.10 2007/02/19 11:08:23 strk Exp $ */
#ifndef GNASH_SHAPE_CHARACTER_DEF_H
#define GNASH_SHAPE_CHARACTER_DEF_H
@@ -64,34 +64,6 @@
// morph uses this
void set_bound(const rect& r) { m_bound = r; /* should do
some verifying */ }
- /// Used for programmatically creating shapes
- void add_path(const path& pth)
- {
- m_paths.push_back(pth);
- }
-
- /// \brief
- /// Add a fill style, possibly reusing an existing
- /// one if existent.
- //
- /// @return the 1-based offset of the fill style,
- /// either added or found.
- /// This offset is the one required to properly
- /// reference it in gnash::path instances.
- ///
- size_t add_fill_style(const fill_style& stl);
-
- /// \brief
- /// Add a line style, possibly reusing an existing
- /// one if existent.
- //
- /// @return the 1-based offset of the line style,
- /// either added or found.
- /// This offset is the one required to properly
- /// reference it in gnash::path instances.
- ///
- size_t add_line_style(const line_style& stl);
-
protected:
friend class morph2_character_def;
@@ -99,12 +71,15 @@
std::vector<fill_style> m_fill_styles;
std::vector<line_style> m_line_styles;
std::vector<path> m_paths;
+ rect m_bound;
+
+ /// Free all meshes
+ void clear_meshes();
private:
void sort_and_clean_meshes() const;
- rect m_bound;
// Cached pre-tesselated meshes.
mutable std::vector<mesh_set*> m_cached_meshes;
Index: server/DynamicShape.cpp
===================================================================
RCS file: server/DynamicShape.cpp
diff -N server/DynamicShape.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/DynamicShape.cpp 19 Feb 2007 11:08:22 -0000 1.1
@@ -0,0 +1,194 @@
+//
+// 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
+
+
+
+/* $Id: DynamicShape.cpp,v 1.1 2007/02/19 11:08:22 strk Exp $ */
+
+#include "DynamicShape.h"
+
+#include <cfloat>
+#include <algorithm>
+
+
+namespace gnash {
+
+DynamicShape::DynamicShape()
+ :
+ shape_character_def(),
+ _currpath(0),
+ _currfill(0),
+ _currline(0),
+ _x(0),
+ _y(0),
+ _changed(0)
+{}
+
+void
+DynamicShape::clear()
+{
+ clear_meshes();
+ m_paths.clear();
+ m_fill_styles.clear();
+ m_line_styles.clear();
+}
+
+void
+DynamicShape::add_path(const path& pth)
+{
+ m_paths.push_back(pth);
+ _currpath = &(m_paths.back());
+ compute_bound(&m_bound);
+}
+
+void
+DynamicShape::endFill()
+{
+ // Nothing to do if path is already filled
+ if ( _filledpath.empty() ) return;
+
+ // Close the path
+ _filledpath.close();
+
+ // Add this path to the drawed ones
+ add_path(_filledpath);
+
+ // Reset filled path, so next path will be drawn from scratch
+ _filledpath.clear();
+ assert(_filledpath.empty());
+
+ // Remove reference to the "current" path, as
+ // next drawing will happen on a different one
+ _currpath = NULL;
+
+ // Remove fill information
+ _currfill = 0;
+
+ // TODO: should I also clear _currline ?
+
+ // Mark as changed
+ changed();
+
+}
+
+void
+DynamicShape::startNewPath()
+{
+ // Close any pending filled style
+ endFill();
+
+ path newPath(_x, _y, _currfill, _currfill, _currline);
+ add_path(newPath);
+}
+
+void
+DynamicShape::finalize()
+{
+ // Nothing to do if not changed
+ if ( ! _changed ) return;
+
+ // TODO: check consistency of fills and such !
+
+ _changed = false;
+}
+
+void
+DynamicShape::lineStyle(uint16_t thickness, const rgba& color)
+{
+ line_style style(thickness, color);
+ _currline = add_line_style(style);
+
+ startNewPath();
+}
+
+void
+DynamicShape::moveTo(float x, float y)
+{
+ if ( x != _x || y != _y )
+ {
+ _x = x;
+ _y = y;
+ startNewPath();
+ }
+}
+
+void
+DynamicShape::lineTo(float x, float y)
+{
+ if ( ! _currpath ) startNewPath();
+ assert(_currpath);
+
+ _currpath->drawLineTo(x, y);
+ // recompute bounds
+ compute_bound(&m_bound);
+
+ // Update current pen position
+ _x = x;
+ _y = y;
+
+ // Mark as changed
+ changed();
+}
+
+void
+DynamicShape::curveTo(float cx, float cy, float ax, float ay)
+{
+ if ( ! _currpath ) startNewPath();
+ assert(_currpath);
+
+ _currpath->drawCurveTo(cx, cy, ax, ay);
+ // recompute bounds
+ compute_bound(&m_bound);
+
+ // Update current pen position
+ _x = ax;
+ _y = ay;
+
+ // Mark as changed
+ changed();
+}
+
+size_t
+DynamicShape::add_fill_style(const fill_style& stl)
+{
+ typedef FillStyleVect V;
+ V& v=m_fill_styles;
+
+ // TODO: check if the style is already in our list
+ // (needs operator== defined for fill_style)
+ v.push_back(stl);
+ return v.size(); // 1-based !
+}
+
+size_t
+DynamicShape::add_line_style(const line_style& stl)
+{
+ typedef LineStyleVect V;
+ V& v=m_line_styles;
+
+ // TODO: check if the style is already in our list
+ // (needs operator== defined for line_style)
+ v.push_back(stl);
+ return v.size(); // 1-based !
+}
+
+} // end namespace gnash
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: server/DynamicShape.h
===================================================================
RCS file: server/DynamicShape.h
diff -N server/DynamicShape.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/DynamicShape.h 19 Feb 2007 11:08:22 -0000 1.1
@@ -0,0 +1,139 @@
+//
+// 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
+
+
+/* $Id: DynamicShape.h,v 1.1 2007/02/19 11:08:22 strk Exp $ */
+
+#ifndef GNASH_DYNAMIC_SHAPE_H
+#define GNASH_DYNAMIC_SHAPE_H
+
+
+#include "shape_character_def.h" // for inheritance
+
+
+namespace gnash {
+
+/// \brief
+/// Represents the outline of one or more shapes, along with
+/// information on fill and line styles.
+class DynamicShape : public shape_character_def
+{
+public:
+
+ DynamicShape();
+
+ virtual ~DynamicShape() {}
+
+ /// Remove all paths and style informations
+ void clear();
+
+ /// Move pen to given coordinates
+ void moveTo(float x, float y);
+
+ /// Draw a straight line from current position to given one
+ void lineTo(float x, float y);
+
+ /// \brief
+ /// Draw a curve from current position to given one
+ /// using given control points.
+ void curveTo(float cx, float cy, float ax, float ay);
+
+ /// Close an existing filled path, if any.
+ void endFill();
+
+ /// Set current line style
+ void lineStyle(uint16_t thickness, const rgba& color);
+
+ /// \brief
+ /// Add a fill style, possibly reusing an existing
+ /// one if existent.
+ //
+ /// @return the 1-based offset of the fill style,
+ /// either added or found.
+ /// This offset is the one required to properly
+ /// reference it in gnash::path instances.
+ ///
+ size_t add_fill_style(const fill_style& stl);
+
+ /// \brief
+ /// Add a line style, possibly reusing an existing
+ /// one if existent.
+ //
+ /// @return the 1-based offset of the line style,
+ /// either added or found.
+ /// This offset is the one required to properly
+ /// reference it in gnash::path instances.
+ ///
+ size_t add_line_style(const line_style& stl);
+
+ /// Add a path, updating _currpath and recomputing bounds
+ //
+ /// TODO: make private? Only current user is BitmapMovieDefinition.
+ /// It needs this function unless we provide a mean to add a
+ /// Bitmap-Filled path
+ ///
+ void add_path(const path& pth);
+
+ /// Always call this function before displaying !
+ //
+ /// It will take care of cleaning up the drawing
+ /// and setting up correct fill styles
+ void finalize();
+
+private:
+
+ // Initialize a new path, used when changing
+ // style or moving the pen
+ //
+ // The newly added path will use current values
+ // for origin, fill and line styles.
+ //
+ void startNewPath();
+
+ path _filledpath;
+
+ path* _currpath;
+
+ size_t _currfill;
+
+ size_t _currline;
+
+ // Current pen X position
+ float _x;
+
+ // Current pen Y position
+ float _y;
+
+ // Call this function when the drawing changes !
+ void changed() {
+ _changed = true;
+ }
+
+ bool _changed;
+};
+
+} // end namespace gnash
+
+
+#endif // GNASH_DYNAMIC_SHAPE_H
+
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 8
+// tab-width: 8
+// indent-tabs-mode: t
+// End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/Makefile.am server/sprit...,
Sandro Santilli <=