CVSROOT: /cvsroot/gnash Module name: gnash Changes by: Udo Giacomozzi <udog> 07/02/22 10:21:02
Modified files: . : ChangeLog backend : render_handler_agg.cpp render_handler_agg_style.h Log message: Switched to pre-multiplied pixel values. Fixes some anti-aliasing issues and improves rendering performance, especially for gradients. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2429&r2=1.2430 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.57&r2=1.58 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg_style.h?cvsroot=gnash&r1=1.11&r2=1.12 Patches: Index: ChangeLog =================================================================== RCS file: /cvsroot/gnash/gnash/ChangeLog,v retrieving revision 1.2429 retrieving revision 1.2430 diff -u -b -r1.2429 -r1.2430 --- ChangeLog 22 Feb 2007 08:53:37 -0000 1.2429 +++ ChangeLog 22 Feb 2007 10:21:02 -0000 1.2430 @@ -1,57 +1,8 @@ -2007-02-22 Sandro Santilli <[EMAIL PROTECTED]> +2007-02-22 Udo Giacomozzi <[EMAIL PROTECTED]> - * libbase/curl_adapter.{cpp,h}: - Add support for http POST (untested). - -2007-02-21 Sandro Santilli <[EMAIL PROTECTED]> - - * testsuite/actionscript.all/Makefile.am: - Define MEDIADIR - * testsuite/actionscript.all/check.as: - Provide MEDIA() macro to easy access to - paths in testsuite/media directory. - -2007-02-21 Sandro Santilli <[EMAIL PROTECTED]> - - * libbase/log.{cpp,h}: add log_debug and used - for GNASH_REPORT_FUNCTION. - * server/asobj/Global.cpp, server/vm/ASHandlers.cpp: - Changed trace() function to use log_trace. - -2007-02-21 Tomas Groth Christensen <[EMAIL PROTECTED]> - - * backend/sound_handler_{gst,sdl}.cpp: Removed newline from warnings, and - added more user help. - * macros/ffmpeg.m4: Yet another go at bug #16663. - -2007-02-21 Tomas Groth Christensen <[EMAIL PROTECTED]> - - * configure.ac, macros/ffmpeg.m4: Another go at bug #16663. - * backend/sound_handler_gst.cpp: Added warnings when using fluendos - mp3 plugin for gstreamer, since it doesn't support soundstreams. - -2007-02-21 Sandro Santilli <[EMAIL PROTECTED]> - - * server/sprite_instance.cpp (do_actions): report actions - execution with -va. - * server/vm/ASHandlers.cpp: Store number of arguments - into an unsigned integer. Fixes an abort with a malformed - SWF. - * testsuite/misc-ming.all/eventSoundTest1-Runner.cpp: - Don't expect failures anymore ! - -2007-02-21 Tomas Groth Christensen <[EMAIL PROTECTED]> - - * configure.ac, macros/ffmpeg.m4: Output warning when old ffmpeg-version - detected. Will hopefully fix bug #16663. - * gui/Player.cpp: Set the soundhandler to NULL when shutting down, Will - hopefully fix bug #18545. - * server/asobj/NetStreamFfmpeg.cpp, server/asobj/SoundFfmpeg.cpp, - server/asobj/SoundMad.cpp: Disconnect cleanly from the soundhandler, - if it exists. - * server/sound.{cpp,h}: Made sound_stream_tag into a state tag. - * testsuite/sound_handler_test.cpp: Increment the counting variables - stopped_all and started_all. + * backend/render_handler_agg.cpp, backend/render_handler_agg_style.h: + Switched to pre-multiplied pixel values. Fixes some anti-aliasing issues + and improves rendering performance, especially for gradients. 2007-02-21 Sandro Santilli <[EMAIL PROTECTED]> Index: backend/render_handler_agg.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -u -b -r1.57 -r1.58 --- backend/render_handler_agg.cpp 13 Feb 2007 13:56:35 -0000 1.57 +++ backend/render_handler_agg.cpp 22 Feb 2007 10:21:02 -0000 1.58 @@ -16,7 +16,7 @@ -/* $Id: render_handler_agg.cpp,v 1.57 2007/02/13 13:56:35 udog Exp $ */ +/* $Id: render_handler_agg.cpp,v 1.58 2007/02/22 10:21:02 udog Exp $ */ // Original version by Udo Giacomozzi and Hannes Mayr, // INDUNET GmbH (www.indunet.it) @@ -357,7 +357,7 @@ // that can later be passed to fill_styleX_bitmap(), to set a // bitmap fill style. { - return new agg_bitmap_info<agg::pixfmt_rgb24> (im->m_width, im->m_height, + return new agg_bitmap_info<agg::pixfmt_rgb24_pre> (im->m_width, im->m_height, im->m_pitch, im->m_data, 24); assert(0); } @@ -370,7 +370,7 @@ // // This version takes an image with an alpha channel. { - return new agg_bitmap_info<agg::pixfmt_rgba32> (im->m_width, im->m_height, + return new agg_bitmap_info<agg::pixfmt_rgba32_pre> (im->m_width, im->m_height, im->m_pitch, im->m_data, 32); } @@ -384,7 +384,7 @@ { // bitmaps currently not supported! - return dummy for fontlib unsigned char dummy=0; - return new agg_bitmap_info<agg::pixfmt_rgb24> (0, 0, 0, &dummy, 24); + return new agg_bitmap_info<agg::pixfmt_rgb24_pre> (0, 0, 0, &dummy, 24); } gnash::bitmap_info* create_bitmap_info_alpha(int /*w*/, int /*h*/, uint8_t* /*data*/) @@ -553,7 +553,7 @@ // clear the stage using the background color if ( ! _clipbounds.isNull() ) - clear_framebuffer(_clipbounds, agg::rgba8(background_color.m_r, + clear_framebuffer(_clipbounds, agg::rgba8_pre(background_color.m_r, background_color.m_g, background_color.m_b, background_color.m_a)); @@ -692,7 +692,7 @@ ras.add_path(stroke); // Set the color and render the scanlines - ren_sl.color(agg::rgba8(color.m_r, color.m_g, color.m_b, color.m_a)); + ren_sl.color(agg::rgba8_pre(color.m_r, color.m_g, color.m_b, color.m_a)); agg::render_scanlines(ras, sl, ren_sl); } // draw_line_strip @@ -963,7 +963,7 @@ rasc.filling_rule(agg::fill_even_odd); else rasc.filling_rule(agg::fill_non_zero); - +//printf("even_odd=%d\n",even_odd); // tell AGG what styles are used fcount = fill_styles.size(); @@ -1022,9 +1022,9 @@ default: { rgba color = cx.transform(fill_styles[fno].get_color()); - +//printf("fill style %d: solid fill (%d, %d, %d, %d);\n", fno, color.m_r, color.m_g, color.m_b, color.m_a); // add the color to our self-made style handler (basically just a list) - sh.add_color(agg::rgba8(color.m_r, color.m_g, color.m_b, color.m_a)); + sh.add_color(agg::rgba8_pre(color.m_r, color.m_g, color.m_b, color.m_a)); } } // switch @@ -1037,6 +1037,7 @@ int current_subshape = 0; for (pno=0; pno<pcount; pno++) { +//printf("pno=%d\n", pno); const path &this_path = paths[pno]; agg::path_storage path; @@ -1050,14 +1051,21 @@ continue; } + if ((this_path.m_fill0==0) && (this_path.m_fill1==0)) { + // Skip this path as it contains no fill style + continue; + } + // Tell the rasterizer which styles the following path will use. // The good thing is, that it already supports two fill styles out of // the box. // Flash uses value "0" for "no fill", whereas AGG uses "-1" for that. rasc.styles(this_path.m_fill0-1, this_path.m_fill1-1); +//printf("rasc.styles(%d, %d);\n", this_path.m_fill0-1, this_path.m_fill1-1); // starting point of path path.move_to(this_path.m_ax*xscale, this_path.m_ay*yscale); +//printf("path.move_to(%f, %f)\n", this_path.m_ax*xscale, this_path.m_ay*yscale); ecount = this_path.m_edges.size(); edge_count += ecount; @@ -1071,15 +1079,25 @@ path.curve3(this_edge.m_cx*xscale, this_edge.m_cy*yscale, this_edge.m_ax*xscale, this_edge.m_ay*yscale); +/* if (this_edge.is_straight()) + printf("path.line_to(%f, %f)\n", this_edge.m_ax*xscale, this_edge.m_ay*yscale); + else + printf("path.curve3(%f, %f, %f, %f)\n", this_edge.m_cx*xscale, this_edge.m_cy*yscale, + this_edge.m_ax*xscale, this_edge.m_ay*yscale); +*/ + + } // add path to the compound rasterizer rasc.add_path(curve); +//printf("rasc.add_path(curve);\n"); } //log_msg("%d edges\n", edge_count); // render! +//printf("agg::render_scanlines_compound_layered(rasc, sl, rbase, alloc, sh);\n"); agg::render_scanlines_compound_layered(rasc, sl, rbase, alloc, sh); } // draw_shape @@ -1331,7 +1349,7 @@ ras.add_path(stroke); - ren_sl.color(agg::rgba8(color.m_r, color.m_g, color.m_b, color.m_a)); + ren_sl.color(agg::rgba8_pre(color.m_r, color.m_g, color.m_b, color.m_a)); agg::render_scanlines(ras, sl, ren_sl); @@ -1393,7 +1411,7 @@ // fill polygon if (fill.m_a>0) { ras.add_path(path); - ren_sl.color(agg::rgba8(fill.m_r, fill.m_g, fill.m_b, fill.m_a)); + ren_sl.color(agg::rgba8_pre(fill.m_r, fill.m_g, fill.m_b, fill.m_a)); agg::render_scanlines(ras, sl, ren_sl); } @@ -1403,7 +1421,7 @@ stroke.width(1); - ren_sl.color(agg::rgba8(outline.m_r, outline.m_g, outline.m_b, outline.m_a)); + ren_sl.color(agg::rgba8_pre(outline.m_r, outline.m_g, outline.m_b, outline.m_a)); ras.add_path(stroke); agg::render_scanlines(ras, sl, ren_sl); @@ -1528,22 +1546,22 @@ log_msg("framebuffer pixel format is %s", pixelformat); if (!strcmp(pixelformat, "RGB555")) - return new render_handler_agg<agg::pixfmt_rgb555> (16); // yep, 16! + return new render_handler_agg<agg::pixfmt_rgb555_pre> (16); // yep, 16! else if (!strcmp(pixelformat, "RGB565") || !strcmp(pixelformat, "RGBA16")) - return new render_handler_agg<agg::pixfmt_rgb565> (16); + return new render_handler_agg<agg::pixfmt_rgb565_pre> (16); else if (!strcmp(pixelformat, "RGB24")) - return new render_handler_agg<agg::pixfmt_rgb24> (24); + return new render_handler_agg<agg::pixfmt_rgb24_pre> (24); else if (!strcmp(pixelformat, "BGR24")) - return new render_handler_agg<agg::pixfmt_bgr24> (24); + return new render_handler_agg<agg::pixfmt_bgr24_pre> (24); else if (!strcmp(pixelformat, "RGBA32")) - return new render_handler_agg<agg::pixfmt_rgba32> (32); + return new render_handler_agg<agg::pixfmt_rgba32_pre> (32); else if (!strcmp(pixelformat, "BGRA32")) - return new render_handler_agg<agg::pixfmt_bgra32> (32); + return new render_handler_agg<agg::pixfmt_bgra32_pre> (32); else { log_error("Unknown pixelformat: %s\n", pixelformat); Index: backend/render_handler_agg_style.h =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg_style.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -b -r1.11 -r1.12 --- backend/render_handler_agg_style.h 26 Nov 2006 22:34:40 -0000 1.11 +++ backend/render_handler_agg_style.h 22 Feb 2007 10:21:02 -0000 1.12 @@ -81,7 +81,7 @@ image_accessor_clip_transp(const PixelFormat& pixf) { agg::image_accessor_clip<PixelFormat>::image_accessor_clip(pixf, - agg::rgba8_pre(255, 0, 0, 0).premultiply()); + agg::rgba8_pre(255, 0, 0, 0)); } }; @@ -143,6 +143,7 @@ if (!m_cx.is_identity()) for (unsigned int i=0; i<len; i++) { m_cx.transform(span->r, span->g, span->b, span->a); + span->premultiply(); ++span; } } @@ -201,23 +202,23 @@ mat.m_[0][1], mat.m_[1][1], mat.m_[0][2], mat.m_[1][2]); + m_cx = cx; - // Built gradient lookup table + // Build gradient lookup table m_gradient_lut.remove_all(); for (int i=0; i<fs.get_color_stop_count(); i++) { const gradient_record gr = fs.get_color_stop(i); + rgba trans_color = m_cx.transform(gr.m_color); - m_gradient_lut.add_color(gr.m_ratio/255.0, agg::rgba8(gr.m_color.m_r, - gr.m_color.m_g, gr.m_color.m_b, gr.m_color.m_a)); + m_gradient_lut.add_color(gr.m_ratio/255.0, agg::rgba8_pre(trans_color.m_r, + trans_color.m_g, trans_color.m_b, trans_color.m_a)); } // for m_gradient_lut.build_lut(); - m_cx = cx; - } // agg_style_gradient constructor @@ -229,14 +230,6 @@ void generate_span(color_type* span, int x, int y, unsigned len) { m_sg.generate(span, x, y, len); - - // Apply color transform - // TODO: Check if this can be optimized - if (!m_cx.is_identity()) - for (unsigned int i=0; i<len; i++) { - m_cx.transform(span->r, span->g, span->b, span->a); - ++span; - } } private: @@ -308,7 +301,7 @@ // See server/styles.h comments about when NULL return is possible. // Don't warn here, we already warn at parse-time //log_msg("WARNING: add_bitmap called with bi=NULL"); - add_color(agg::rgba8(0,0,0,0)); + add_color(agg::rgba8_pre(0,0,0,0)); return; } @@ -377,7 +370,7 @@ // tiled, nearest neighbor method (faster) - typedef agg::pixfmt_rgb24 PixelFormat; + typedef agg::pixfmt_rgb24_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef agg::wrap_mode_repeat wrap_type; typedef agg::image_accessor_wrap<PixelFormat, wrap_type, wrap_type> img_source_type; @@ -400,7 +393,7 @@ // clipped, nearest neighbor method (faster) - typedef agg::pixfmt_rgb24 PixelFormat; + typedef agg::pixfmt_rgb24_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef image_accessor_clip_transp<PixelFormat> img_source_type; typedef agg::span_interpolator_linear_subdiv<agg::trans_affine> interpolator_type; @@ -421,7 +414,7 @@ // tiled, bilinear method (better quality) - typedef agg::pixfmt_rgb24 PixelFormat; + typedef agg::pixfmt_rgb24_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef agg::wrap_mode_repeat wrap_type; typedef agg::image_accessor_wrap<PixelFormat, wrap_type, wrap_type> img_source_type; @@ -442,7 +435,7 @@ // clipped, bilinear method (better quality) - typedef agg::pixfmt_rgb24 PixelFormat; + typedef agg::pixfmt_rgb24_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef image_accessor_clip_transp<PixelFormat> img_source_type; typedef agg::span_interpolator_linear_subdiv<agg::trans_affine> interpolator_type; @@ -465,7 +458,7 @@ // tiled, nearest neighbor method (faster) - typedef agg::pixfmt_rgba32 PixelFormat; + typedef agg::pixfmt_rgba32_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef agg::wrap_mode_repeat wrap_type; typedef agg::image_accessor_wrap<PixelFormat, wrap_type, wrap_type> img_source_type; @@ -488,7 +481,7 @@ // clipped, nearest neighbor method (faster) - typedef agg::pixfmt_rgba32 PixelFormat; + typedef agg::pixfmt_rgba32_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef image_accessor_clip_transp<PixelFormat> img_source_type; typedef agg::span_interpolator_linear_subdiv<agg::trans_affine> interpolator_type; @@ -509,7 +502,7 @@ // tiled, bilinear method (better quality) - typedef agg::pixfmt_rgba32 PixelFormat; + typedef agg::pixfmt_rgba32_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef agg::wrap_mode_repeat wrap_type; typedef agg::image_accessor_wrap<PixelFormat, wrap_type, wrap_type> img_source_type; @@ -530,7 +523,7 @@ // clipped, bilinear method (better quality) - typedef agg::pixfmt_rgba32 PixelFormat; + typedef agg::pixfmt_rgba32_pre PixelFormat; typedef agg::span_allocator<PixelFormat> span_allocator_type; typedef image_accessor_clip_transp<PixelFormat> img_source_type; typedef agg::span_interpolator_linear_subdiv<agg::trans_affine> interpolator_type; @@ -556,7 +549,7 @@ typedef agg::gradient_x gradient_func_type; //typedef agg::gradient_repeat_adaptor<gradient_func_type> gradient_adaptor_type; typedef gradient_func_type gradient_adaptor_type; - typedef agg::gradient_lut<agg::color_interpolator<agg::rgba8>, 256> color_func_type; + typedef agg::gradient_lut<agg::color_interpolator<color_type>, 256> color_func_type; typedef agg::span_gradient<color_type, interpolator_type, gradient_adaptor_type, @@ -582,7 +575,7 @@ typedef agg::span_interpolator_linear<agg::trans_affine> interpolator_type; typedef agg::gradient_radial gradient_func_type; typedef gradient_func_type gradient_adaptor_type; - typedef agg::gradient_lut<agg::color_interpolator<agg::rgba8>, 256> color_func_type; + typedef agg::gradient_lut<agg::color_interpolator<color_type>, 256> color_func_type; typedef agg::span_gradient<color_type, interpolator_type, gradient_adaptor_type, _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit