CVSROOT: /cvsroot/gnash Module name: gnash Changes by: Udo Giacomozzi <udog> 07/08/23 09:53:04
Modified files: backend : render_handler.h render_handler_agg.cpp render_handler_tri.cpp render_handler_tri.h server : edit_text_character.cpp render.cpp render.h . : ChangeLog Log message: add parameter "masked" to draw_poly(), adjust calls to this function and implement (un)masked polygons in AGG renderer (see bug #20655) CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler.h?cvsroot=gnash&r1=1.45&r2=1.46 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.95&r2=1.96 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_tri.cpp?cvsroot=gnash&r1=1.19&r2=1.20 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_tri.h?cvsroot=gnash&r1=1.14&r2=1.15 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.103&r2=1.104 http://cvs.savannah.gnu.org/viewcvs/gnash/server/render.cpp?cvsroot=gnash&r1=1.16&r2=1.17 http://cvs.savannah.gnu.org/viewcvs/gnash/server/render.h?cvsroot=gnash&r1=1.16&r2=1.17 http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4078&r2=1.4079 Patches: Index: backend/render_handler.h =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler.h,v retrieving revision 1.45 retrieving revision 1.46 diff -u -b -r1.45 -r1.46 --- backend/render_handler.h 18 Jul 2007 10:06:13 -0000 1.45 +++ backend/render_handler.h 23 Aug 2007 09:53:02 -0000 1.46 @@ -18,7 +18,7 @@ // // -/* $Id: render_handler.h,v 1.45 2007/07/18 10:06:13 udog Exp $ */ +/* $Id: render_handler.h,v 1.46 2007/08/23 09:53:02 udog Exp $ */ #ifndef RENDER_HANDLER_H #define RENDER_HANDLER_H @@ -376,8 +376,11 @@ /// The polygon need NOT be closed (ie: this function will automatically /// add an additional vertex to close it. /// + /// When masked==false, then any potential mask currently active will be + /// ignored, otherwise it is respected. + /// virtual void draw_poly(const point* corners, size_t corner_count, - const rgba& fill, const rgba& outline) = 0; + const rgba& fill, const rgba& outline, bool masked) = 0; /// Set line and fill styles for mesh & line_strip rendering. Index: backend/render_handler_agg.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -u -b -r1.95 -r1.96 --- backend/render_handler_agg.cpp 18 Jul 2007 23:17:54 -0000 1.95 +++ backend/render_handler_agg.cpp 23 Aug 2007 09:53:03 -0000 1.96 @@ -17,7 +17,7 @@ -/* $Id: render_handler_agg.cpp,v 1.95 2007/07/18 23:17:54 strk Exp $ */ +/* $Id: render_handler_agg.cpp,v 1.96 2007/08/23 09:53:03 udog Exp $ */ // Original version by Udo Giacomozzi and Hannes Mayr, // INDUNET GmbH (www.indunet.it) @@ -1830,8 +1830,9 @@ /// Draws the given polygon. - void draw_poly(const point* corners, size_t corner_count, const rgba& fill, - const rgba& outline) { + template <class scanline_type> + void draw_poly_impl(const point* corners, size_t corner_count, const rgba& fill, + const rgba& outline, scanline_type& sl) { assert(m_pixf != NULL); @@ -1842,28 +1843,17 @@ matrix mat = stage_matrix; mat.concatenate(m_current_matrix); - // TODO: Use aliased scanline renderer instead of anti-aliased one since - // it is undesired anyway. typedef agg::rasterizer_scanline_aa<> ras_type; renderer_base rbase(*m_pixf); - agg::scanline_p8 sl; ras_type ras; agg::renderer_scanline_aa_solid< agg::renderer_base<PixelFormat> > ren_sl(rbase); - for (unsigned int cno=0; cno<_clipbounds.size(); cno++) { - - const geometry::Range2d<int>& bounds = _clipbounds[cno]; - - apply_clip_box<ras_type> (ras, bounds); - - // TODO: what do do if _clipbox.isNull() or _clipbox.isWorld() ? - // currently an assertion will fail when get{Min,Max}{X,Y} - // are called below - + // -- create path -- agg::path_storage path; point pnt, origin; + // Note: The coordinates are rounded and 0.5 is added to snap them to the // center of the pixel. This avoids blurring caused by anti-aliasing. @@ -1881,6 +1871,17 @@ // close polygon path.line_to(trunc(origin.m_x)+0.5, trunc(origin.m_y)+0.5); + + + // -- render -- + + // iterate through clipping bounds + for (unsigned int cno=0; cno<_clipbounds.size(); cno++) { + + const geometry::Range2d<int>& bounds = _clipbounds[cno]; + apply_clip_box<ras_type> (ras, bounds); + + // fill polygon if (fill.m_a>0) { ras.add_path(path); @@ -1903,6 +1904,34 @@ } } + } //draw_poly_impl + + + void draw_poly(const point* corners, size_t corner_count, const rgba& fill, + const rgba& outline, bool masked) { + + if (masked && !m_alpha_mask.empty()) { + + // apply mask + + typedef agg::scanline_u8_am<agg::alpha_mask_gray8> sl_type; + + sl_type sl(m_alpha_mask.back()->get_amask()); + + draw_poly_impl<sl_type> (corners, corner_count, fill, outline, sl); + + } else { + + // no mask + + typedef agg::scanline_p8 sl_type; // packed scanline (faster for solid fills) + + sl_type sl; + + draw_poly_impl<sl_type> (corners, corner_count, fill, outline, sl); + + } + } Index: backend/render_handler_tri.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_tri.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -b -r1.19 -r1.20 --- backend/render_handler_tri.cpp 21 Aug 2007 13:21:27 -0000 1.19 +++ backend/render_handler_tri.cpp 23 Aug 2007 09:53:03 -0000 1.20 @@ -18,7 +18,7 @@ // // -/* $Id: render_handler_tri.cpp,v 1.19 2007/08/21 13:21:27 udog Exp $ */ +/* $Id: render_handler_tri.cpp,v 1.20 2007/08/23 09:53:03 udog Exp $ */ #include "render_handler_tri.h" @@ -297,7 +297,10 @@ } void triangulating_render_handler::draw_poly(const point* corners, - size_t corner_count, const rgba& fill, const rgba& outline) { + size_t corner_count, const rgba& fill, const rgba& outline, bool /*masked*/) { + + // TODO: The current implementation is only correct when masked==true, + // ie. it will always be masked. unsigned int vno=0; // Create points array to vertex array Index: backend/render_handler_tri.h =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_tri.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -b -r1.14 -r1.15 --- backend/render_handler_tri.h 18 Jul 2007 10:03:04 -0000 1.14 +++ backend/render_handler_tri.h 23 Aug 2007 09:53:03 -0000 1.15 @@ -18,7 +18,7 @@ // // -/* $Id: render_handler_tri.h,v 1.14 2007/07/18 10:03:04 udog Exp $ */ +/* $Id: render_handler_tri.h,v 1.15 2007/08/23 09:53:03 udog Exp $ */ #ifndef GNASH_RENDER_HANDLER_TRI_H #define GNASH_RENDER_HANDLER_TRI_H @@ -127,7 +127,7 @@ /// The given polygon is translated to a mesh strip by this class. void draw_poly(const point* corners, size_t corner_count, const rgba& fill, - const rgba& outline); + const rgba& outline, bool masked); /// The glyph is drawn just like a normal shape character. virtual void draw_glyph(shape_character_def *def, Index: server/edit_text_character.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -u -b -r1.103 -r1.104 --- server/edit_text_character.cpp 21 Aug 2007 14:42:12 -0000 1.103 +++ server/edit_text_character.cpp 23 Aug 2007 09:53:03 -0000 1.104 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.103 2007/08/21 14:42:12 strk Exp $ */ +/* $Id: edit_text_character.cpp,v 1.104 2007/08/23 09:53:03 udog Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -492,7 +492,7 @@ log_debug("rendering a Pol composed by corners %s", ss.str().c_str()); #endif - render::draw_poly( &coords[0], 4, backgroundColor, borderColor ); + render::draw_poly( &coords[0], 4, backgroundColor, borderColor, true); } Index: server/render.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/server/render.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -b -r1.16 -r1.17 --- server/render.cpp 13 Jul 2007 16:05:09 -0000 1.16 +++ server/render.cpp 23 Aug 2007 09:53:03 -0000 1.17 @@ -169,13 +169,13 @@ void draw_poly(const point* corners, int corner_count, const rgba& fill, - const rgba& outline) + const rgba& outline, bool masked) { #ifdef DEBUG_RENDER_CALLS GNASH_REPORT_FUNCTION; #endif if (s_render_handler) s_render_handler->draw_poly(corners, corner_count, - fill, outline); + fill, outline, masked); } Index: server/render.h =================================================================== RCS file: /cvsroot/gnash/gnash/server/render.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -b -r1.16 -r1.17 --- server/render.h 13 Jul 2007 16:05:09 -0000 1.16 +++ server/render.h 23 Aug 2007 09:53:03 -0000 1.17 @@ -104,7 +104,7 @@ /// See render_handler::draw_poly (in backend/render_handler.h) void draw_poly(const point* corners, int corner_count, - const rgba& fill, const rgba& outline); + const rgba& fill, const rgba& outline, bool masked); /// See render_handler::draw_shape_character (in backend/render_handler.h) void draw_shape_character(shape_character_def *def, Index: ChangeLog =================================================================== RCS file: /cvsroot/gnash/gnash/ChangeLog,v retrieving revision 1.4078 retrieving revision 1.4079 diff -u -b -r1.4078 -r1.4079 --- ChangeLog 23 Aug 2007 09:40:16 -0000 1.4078 +++ ChangeLog 23 Aug 2007 09:53:03 -0000 1.4079 @@ -1,3 +1,11 @@ +2007-08-23 Udo Giacomozzi <[EMAIL PROTECTED]> + + * backend/render_handler.h, backend/render_handler_agg.cpp, + backend/render_handler_tri.{cpp,h}, server/edit_text_character.cpp, + server/render.cpp, server/render.h: add parameter "masked" to + draw_poly(), adjust calls to this function and implement (un)masked + polygons in AGG renderer (see bug #20655). + 2007-08-23 Benjamin Wolsey <[EMAIL PROTECTED]> * libbase/rc.{cpp,h}: expandPath called on non-POSIX systems _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit