CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/07/30 21:26:40
Modified files: . : ChangeLog backend : render_handler_tri.cpp gui : gtk.cpp gtk_glue.h gtksup.h Log message: * backend/render_handler_tri.cpp: implemented world_to_pixel and pixel_to_world (to check, UdoG, can you ?) * gui/gtksup.h: remove any use of RENDERER_XXY defines, use the GtkGlue interface only (keep by auto_ptr) * gui/gtk_glue.h: header guard (no code was including this :/) * gui/gtk.cpp: updated use of the glue, remove as much as possible uses of RENDERER_XXY, the only left are for glue initialization (headers and constructions) and for the call to prepDrawingArea which needs to be ordered differently for OGL and for other renderers. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3873&r2=1.3874 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_tri.cpp?cvsroot=gnash&r1=1.17&r2=1.18 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.100&r2=1.101 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk_glue.h?cvsroot=gnash&r1=1.11&r2=1.12 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.46&r2=1.47 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3873 retrieving revision 1.3874 diff -u -b -r1.3873 -r1.3874 --- ChangeLog 30 Jul 2007 19:55:07 -0000 1.3873 +++ ChangeLog 30 Jul 2007 21:26:39 -0000 1.3874 @@ -1,5 +1,18 @@ 2007-07-29 Sandro Santilli <[EMAIL PROTECTED]> + * backend/render_handler_tri.cpp: implemented world_to_pixel and + pixel_to_world (to check, UdoG, can you ?) + * gui/gtksup.h: remove any use of RENDERER_XXY defines, use + the GtkGlue interface only (keep by auto_ptr) + * gui/gtk_glue.h: header guard (no code was including this :/) + * gui/gtk.cpp: updated use of the glue, remove as much as possible + uses of RENDERER_XXY, the only left are for glue initialization + (headers and constructions) and for the call to prepDrawingArea + which needs to be ordered differently for OGL and for other + renderers. + +2007-07-29 Sandro Santilli <[EMAIL PROTECTED]> + * configure.ac: Change --enable-renderer to accept a *single* renderer as the gui code / build scripts are not ready to handle multiple ones currently (temp hack for 0.8.1). By default, renderer is AGG now. Index: backend/render_handler_tri.cpp =================================================================== RCS file: /sources/gnash/gnash/backend/render_handler_tri.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -b -r1.17 -r1.18 --- backend/render_handler_tri.cpp 18 Jul 2007 10:03:04 -0000 1.17 +++ backend/render_handler_tri.cpp 30 Jul 2007 21:26:39 -0000 1.18 @@ -18,7 +18,7 @@ // // -/* $Id: render_handler_tri.cpp,v 1.17 2007/07/18 10:03:04 udog Exp $ */ +/* $Id: render_handler_tri.cpp,v 1.18 2007/07/30 21:26:39 strk Exp $ */ #include "render_handler_tri.h" @@ -30,6 +30,8 @@ #error missing includes! #endif +#include "log.h" + namespace gnash { // helper function for tri_cache_manager @@ -341,15 +343,19 @@ geometry::Range2d<int> -triangulating_render_handler::world_to_pixel(const rect& /*worldbounds*/) +triangulating_render_handler::world_to_pixel(const rect& worldbounds) { - assert(0); // not implemented (and currently not required for tri. renderers) + // TODO: verify this is correct + geometry::Range2d<int> ret(worldbounds.getRange()); + ret.scale(20); // twips to pixels + return ret; } point -triangulating_render_handler::pixel_to_world(int /*x*/, int /*y*/) +triangulating_render_handler::pixel_to_world(int x, int y) { - assert(0); // not implemented (and currently not required for tri. renderers) + // TODO: verify this is correct + return point(PIXELS_TO_TWIPS(x), PIXELS_TO_TWIPS(y)); } tri_cache_manager::~tri_cache_manager() Index: gui/gtk.cpp =================================================================== RCS file: /sources/gnash/gnash/gui/gtk.cpp,v retrieving revision 1.100 retrieving revision 1.101 diff -u -b -r1.100 -r1.101 --- gui/gtk.cpp 18 Jul 2007 10:03:04 -0000 1.100 +++ gui/gtk.cpp 30 Jul 2007 21:26:39 -0000 1.101 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: gtk.cpp,v 1.100 2007/07/18 10:03:04 udog Exp $ */ +/* $Id: gtk.cpp,v 1.101 2007/07/30 21:26:39 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -40,6 +40,17 @@ #include <gdk/gdkkeysyms.h> #include <string> +#ifdef RENDERER_OPENGL +#include "gtk_glue_gtkglext.h" +#endif + +#ifdef RENDERER_CAIRO +#include "gtk_glue_cairo.h" +#endif + +#ifdef RENDERER_AGG +#include "gtk_glue_agg.h" +#endif using namespace std; @@ -70,7 +81,15 @@ gtk_init (&argc, argv); - glue.init (argc, argv); + // TODO: don't rely on a macro to select renderer +#ifdef RENDERER_CAIRO + _glue.reset(new GtkCairoGlue); +#elif defined(RENDERER_OPENGL) + _glue.reset(new GtkGlExtGlue); +#elif defined(RENDERER_AGG) + _glue.reset(new GtkAggGlue); +#endif + _glue->init (argc, argv); add_pixmap_directory (PKGDATADIR); @@ -94,9 +113,10 @@ createMenu(); #ifdef RENDERER_OPENGL - // OpenGL glue needs to prepare the drawing area for OpenGL rendering before + // OpenGL _glue needs to prepare the drawing area for OpenGL rendering before // widgets are realized and before the configure event is fired. - glue.prepDrawingArea(_drawing_area); + // TODO: find a way to make '_glue' use independent from actual renderer in use + _glue->prepDrawingArea(_drawing_area); #endif setupEvents(); @@ -121,10 +141,11 @@ #if defined(RENDERER_CAIRO) || defined(RENDERER_AGG) // cairo needs the _drawing_area.window to prepare it .. - glue.prepDrawingArea(_drawing_area); + // TODO: find a way to make '_glue' use independent from actual renderer in use + _glue->prepDrawingArea(_drawing_area); #endif - _renderer = glue.createRenderHandler(); + _renderer = _glue->createRenderHandler(); if ( ! _renderer ) return false; set_render_handler(_renderer); @@ -241,7 +262,7 @@ _height = height; _validbounds.setTo(0, 0, _width-1, _height-1); - glue.setRenderHandlerSize(_width, _height); + _glue->setRenderHandlerSize(_width, _height); return true; } @@ -249,7 +270,6 @@ void GtkGui::renderBuffer() { -#ifdef RENDERER_AGG if ( _drawbounds.size() == 0 ) return; // nothing to do.. for (unsigned bno=0; bno < _drawbounds.size(); bno++) { @@ -258,13 +278,10 @@ assert ( bounds.isFinite() ); - glue.render(bounds.getMinX(), bounds.getMinY(), + _glue->render(bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY()); } -#else - glue.render(); -#endif } void @@ -277,7 +294,6 @@ // The macro PIXELS_TO_TWIPS can't be used since the renderer might do // scaling. -#ifdef RENDERER_AGG InvalidatedRanges ranges; geometry::Range2d<int> exposed_pixels(xmin, ymin, xmax, ymax); @@ -287,12 +303,11 @@ ranges.add(exposed_twips); setInvalidatedRegions(ranges); -#endif + renderBuffer(); } -#ifdef RENDERER_AGG void GtkGui::setInvalidatedRegions(const InvalidatedRanges& ranges) { @@ -311,7 +326,8 @@ _drawbounds.clear(); - for (unsigned rno=0; rno<ranges.size(); rno++) { + for (unsigned rno=0; rno<ranges.size(); rno++) + { geometry::Range2d<int> bounds = Intersection( _renderer->world_to_pixel(ranges.getRange(rno)), @@ -328,7 +344,6 @@ } } -#endif void GtkGui::setTimeout(unsigned int timeout) @@ -1079,13 +1094,7 @@ GtkGui* obj = static_cast<GtkGui*>(data); -#ifdef RENDERER_CAIRO - GtkCairoGlue& glue = obj->glue; -#elif defined(RENDERER_OPENGL) - GtkGlExtGlue& glue = obj->glue; -#elif defined(RENDERER_AGG) - GtkAggGlue& glue = obj->glue; -#endif + GtkGlue& glue = *(obj->_glue); glue.configure(widget, event); obj->resize_view(event->width, event->height); Index: gui/gtk_glue.h =================================================================== RCS file: /sources/gnash/gnash/gui/gtk_glue.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -b -r1.11 -r1.12 --- gui/gtk_glue.h 1 Jul 2007 10:54:02 -0000 1.11 +++ gui/gtk_glue.h 30 Jul 2007 21:26:39 -0000 1.12 @@ -18,6 +18,9 @@ // // +#ifndef __GTK_GLUE_H__ +#define __GTK_GLUE_H__ + #include "gnash.h" #include <gtk/gtk.h> @@ -45,3 +48,6 @@ }; } // namespace gnash + +// end of __GTK_GLUE_H__ +#endif Index: gui/gtksup.h =================================================================== RCS file: /sources/gnash/gnash/gui/gtksup.h,v retrieving revision 1.46 retrieving revision 1.47 diff -u -b -r1.46 -r1.47 --- gui/gtksup.h 18 Jul 2007 11:23:21 -0000 1.46 +++ gui/gtksup.h 30 Jul 2007 21:26:39 -0000 1.47 @@ -26,25 +26,12 @@ #endif #include "gnash.h" -#include "tu_config.h" +#include "tu_config.h" // for DSOEXPORT +#include "gtk_glue.h" #include <gdk/gdkx.h> #include <gtk/gtk.h> -#ifdef RENDERER_OPENGL -#include <gtk/gtkgl.h> -#include "gtk_glue_gtkglext.h" -#elif defined(RENDERER_CAIRO) -#include <cairo.h> -#include "gtk_glue_cairo.h" -#elif defined(RENDERER_AGG) -#include "gtk_glue_agg.h" -#endif - -#include <gtk/gtk.h> - -#include "gui.h" - namespace gnash { @@ -138,10 +125,9 @@ void rerenderPixels(int xmin, int ymin, int xmax, int ymax); -#ifdef RENDERER_AGG void setInvalidatedRegions(const InvalidatedRanges& ranges); + bool want_multiple_regions() { return true; } -#endif virtual void setCursor(gnash_cursor_type newcursor); GtkWidget *getWindow() { return _window; }; @@ -154,15 +140,7 @@ GtkWidget *_vbox; std::vector< geometry::Range2d<int> > _drawbounds; -#ifdef RENDERER_CAIRO - cairo_t *_cairo_handle; - GtkCairoGlue glue; -#elif defined(RENDERER_OPENGL) - GdkGLConfig *_glconfig; - GtkGlExtGlue glue; -#elif defined(RENDERER_AGG) - GtkAggGlue glue; -#endif + std::auto_ptr<GtkGlue> _glue; static gnash::key::code gdk_to_gnash_key(guint key); static int gdk_to_gnash_modifier(int state); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit