CVSROOT: /sources/gnash Module name: gnash Changes by: Bastiaan Jacques <bjacques> 07/11/24 04:58:14
Modified files: . : ChangeLog backend : Makefile.am render_handler_ogl.cpp server : shape.cpp shape.h Log message: * backend/Makefile.am: Stop building render_handler_tri.cpp since it is no longer used. * server/shape.{cpp,h}: Introduce path::transform and edge::transform, to be used for matrix transformations. * backend/render_handler_ogl.cpp: Reimplement apply_matrix_to_paths using path::transform. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4949&r2=1.4950 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/Makefile.am?cvsroot=gnash&r1=1.66&r2=1.67 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_ogl.cpp?cvsroot=gnash&r1=1.91&r2=1.92 http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.cpp?cvsroot=gnash&r1=1.49&r2=1.50 http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.32&r2=1.33 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4949 retrieving revision 1.4950 diff -u -b -r1.4949 -r1.4950 --- ChangeLog 23 Nov 2007 23:47:36 -0000 1.4949 +++ ChangeLog 24 Nov 2007 04:58:12 -0000 1.4950 @@ -1,3 +1,12 @@ +2007-11-23 Bastiaan Jacques <[EMAIL PROTECTED]> + + * backend/Makefile.am: Stop building render_handler_tri.cpp + since it is no longer used. + * server/shape.{cpp,h}: Introduce path::transform and + edge::transform, to be used for matrix transformations. + * backend/render_handler_ogl.cpp: Reimplement + apply_matrix_to_paths using path::transform. + 2007-11-23 Sandro Santilli <[EMAIL PROTECTED]> * server/parser/sound_definition.h: document sound_sample a bit. Index: backend/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/backend/Makefile.am,v retrieving revision 1.66 retrieving revision 1.67 diff -u -b -r1.66 -r1.67 --- backend/Makefile.am 28 Oct 2007 22:01:31 -0000 1.66 +++ backend/Makefile.am 24 Nov 2007 04:58:13 -0000 1.67 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id: Makefile.am,v 1.66 2007/10/28 22:01:31 bjacques Exp $ +# $Id: Makefile.am,v 1.67 2007/11/24 04:58:13 bjacques Exp $ ## Process this file with automake to generate Makefile.in @@ -59,20 +59,17 @@ render_handler_agg_bitmap.h \ render_handler_agg_compat.h \ render_handler_agg_style.h \ - render_handler_cairo.h \ - render_handler_tri.h + render_handler_cairo.h # bin_PROGRAMS = gnash -# RENDER_SOURCES = render_handler_tri.cpp - noinst_LTLIBRARIES = # set later on by conditionals if BUILD_OGL_RENDERER if HAVE_OPENGL noinst_LTLIBRARIES += libgnashogl.la #plugins_LTLIBRARIES += libgnashogl.la -libgnashogl_la_SOURCES = render_handler_tri.cpp render_handler_ogl.cpp +libgnashogl_la_SOURCES = render_handler_ogl.cpp #libgnashogl_la_LDFLAGS = -module -avoid-version -no-undefined libgnashogl_la_LDFLAGS = libgnashogl_la_LIBADD = $(OPENGL_LIBS) Index: backend/render_handler_ogl.cpp =================================================================== RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -u -b -r1.91 -r1.92 --- backend/render_handler_ogl.cpp 24 Nov 2007 00:27:03 -0000 1.91 +++ backend/render_handler_ogl.cpp 24 Nov 2007 04:58:13 -0000 1.92 @@ -1352,52 +1352,14 @@ return subshapes; } - /// Takes a path and translates it using the given matrix. The new path - /// is stored in paths_out. - /// Taken from render_handler_agg.cpp. - void apply_matrix_to_paths(const std::vector<path> &paths_in, - std::vector<path> &paths_out, const matrix& mat) { - - int pcount, ecount; - int pno, eno; - - // copy path - paths_out = paths_in; - pcount = paths_out.size(); - - for (pno=0; pno<pcount; pno++) { - - path &the_path = paths_out[pno]; - point oldpnt(the_path.ap.x, the_path.ap.y); - point newpnt; - mat.transform(&newpnt, oldpnt); - the_path.ap.x = newpnt.x; - the_path.ap.y = newpnt.y; - - ecount = the_path.m_edges.size(); - for (eno=0; eno<ecount; eno++) { - - edge &the_edge = the_path.m_edges[eno]; - - oldpnt.x = the_edge.ap.x; - oldpnt.y = the_edge.ap.y; - mat.transform(&newpnt, oldpnt); - the_edge.ap.x = newpnt.x; - the_edge.ap.y = newpnt.y; - - oldpnt.x = the_edge.cp.x; - oldpnt.y = the_edge.cp.y; - mat.transform(&newpnt, oldpnt); - the_edge.cp.x = newpnt.x; - the_edge.cp.y = newpnt.y; - - } - - } - + /// Takes a path and translates it using the given matrix. + void + apply_matrix_to_paths(std::vector<path>& paths, const matrix& mat) + { + std::for_each(paths.begin(), paths.end(), + boost::bind(&path::transform, _1, boost::ref(mat))); } - void draw_subshape(const PathVec& path_vec, const matrix& mat, @@ -1499,9 +1461,9 @@ } if (_drawing_mask) { - PathVec scaled_path_vec; + PathVec scaled_path_vec = path_vec;; - apply_matrix_to_paths(path_vec, scaled_path_vec, mat); + apply_matrix_to_paths(scaled_path_vec, mat); draw_mask(scaled_path_vec); return; } Index: server/shape.cpp =================================================================== RCS file: /sources/gnash/gnash/server/shape.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -u -b -r1.49 -r1.50 --- server/shape.cpp 12 Nov 2007 10:22:41 -0000 1.49 +++ server/shape.cpp 24 Nov 2007 04:58:13 -0000 1.50 @@ -32,6 +32,8 @@ # include <sstream> #endif +#include <boost/bind.hpp> + namespace gnash { @@ -120,6 +122,14 @@ return p.squareDistance(px); } +void +edge::transform(const matrix& mat) +{ + mat.transform(ap); + mat.transform(cp); +} + + // // path @@ -429,6 +439,16 @@ return false; } +void +path::transform(const matrix& mat) +{ + using namespace boost; + + mat.transform(ap); + std::for_each(m_edges.begin(), m_edges.end(), + bind(&edge::transform, _1, ref(mat))); +} + // Utility. Index: server/shape.h =================================================================== RCS file: /sources/gnash/gnash/server/shape.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -b -r1.32 -r1.33 --- server/shape.h 10 Nov 2007 18:07:14 -0000 1.32 +++ server/shape.h 24 Nov 2007 04:58:14 -0000 1.33 @@ -5,7 +5,7 @@ // Quadratic bezier outline shapes, the basis for most SWF rendering. -/* $Id: shape.h,v 1.32 2007/11/10 18:07:14 strk Exp $ */ +/* $Id: shape.h,v 1.33 2007/11/24 04:58:14 bjacques Exp $ */ #ifndef GNASH_SHAPE_H #define GNASH_SHAPE_H @@ -60,6 +60,9 @@ bool is_straight() const { return isStraight(); } + /// Transform the edge according to the given matrix. + void transform(const matrix& mat); + /// Return squared distance between point pt and segment A-B static float squareDistancePtSeg(const point& pt, const point& A, const point& B); @@ -334,6 +337,14 @@ /// void expandBounds(rect& r, unsigned int thickness) const; + bool isNewShape() const + { + return m_new_shape; + } + + /// Transform all path coordinates according to the given matrix. + void transform(const matrix& mat); + //private: /// Left fill style index (1-based) _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit