gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...
Date: Tue, 06 Mar 2007 17:40:05 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/03/06 17:40:04

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg.cpp 
        gui            : fltk.cpp fltk_glue_agg.cpp fltk_glue_agg.h 
                         fltksup.h gtksup.h 

Log message:
                * backend/render_handler_agg.cpp: Fix an off-by-one error 
causing
                invalid memory accesses.
                * gui/fltk{.cpp, sup.h, _glue_agg.cpp, _glue_agg.h}: 
Reimplement AGG
                clipping using the new interfaces.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2558&r2=1.2559
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk_glue_agg.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk_glue_agg.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltksup.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.35&r2=1.36

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2558
retrieving revision 1.2559
diff -u -b -r1.2558 -r1.2559
--- ChangeLog   6 Mar 2007 17:35:09 -0000       1.2558
+++ ChangeLog   6 Mar 2007 17:40:04 -0000       1.2559
@@ -1,3 +1,10 @@
+2007-03-06 Bastiaan Jacques <address@hidden>
+
+       * backend/render_handler_agg.cpp: Fix an off-by-one error causing
+       invalid memory accesses.
+       * gui/fltk{.cpp, sup.h, _glue_agg.cpp, _glue_agg.h}: Reimplement AGG
+       clipping using the new interfaces.
+
 2007-03-06 Sandro Santilli <address@hidden>
 
        * server/as_value.cpp (to_to_string): positive Infinity 

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- backend/render_handler_agg.cpp      6 Mar 2007 11:07:22 -0000       1.64
+++ backend/render_handler_agg.cpp      6 Mar 2007 17:40:04 -0000       1.65
@@ -16,7 +16,7 @@
 
  
 
-/* $Id: render_handler_agg.cpp,v 1.64 2007/03/06 11:07:22 udog Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.65 2007/03/06 17:40:04 bjacques Exp $ */
 
 // Original version by Udo Giacomozzi and Hannes Mayr, 
 // INDUNET GmbH (www.indunet.it)
@@ -579,11 +579,10 @@
                    agg::rgba8 color)
        {
                        assert(region.isFinite());
-           unsigned int width = region.width()+1;
-           if (width < 1)
+           if (region.width() < 1)
            {
                log_warning("clear_framebuffer() called with width=%d",
-                       width);
+                       region.width());
                return;
            }
     
@@ -594,10 +593,11 @@
                return;
            }
            unsigned int left=region.getMinX();
+
            for (unsigned int y=region.getMinY(), maxy=region.getMaxY();
                    y<=maxy; ++y) 
            {
-               m_pixf->copy_hline(left, y, width, color);
+               m_pixf->copy_hline(left, y, region.width(), color);
            }
   }
 

Index: gui/fltk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/fltk.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gui/fltk.cpp        3 Mar 2007 15:35:17 -0000       1.7
+++ gui/fltk.cpp        6 Mar 2007 17:40:04 -0000       1.8
@@ -61,7 +61,6 @@
 void
 FltkGui::renderBuffer()
 {
-#if 0
     // FLTK has a nice mechanism where you can set damage() to whatever you 
want
     // so in draw() you can check what exactly you want to redraw. But
     // unfortunately it doesn't seem to remember what bits you turn on. So I'll
@@ -69,18 +68,24 @@
     static bool firstRun = true;
 
     if (firstRun) {
-      // Redraw the whole rendering area.
-      rect draw_bounds(0, 0, _width, _height);
-      setInvalidatedRegion(draw_bounds);
-      firstRun = false;
+      using namespace geometry;
+      Range2d<int> bounds(0, 0, _width, _height);
+      _glue->render(bounds);
+
+      return;
     }
-#endif
 
-    rect bounds;
-    bounds.set_world();
-    _glue->invalidateRegion(bounds);
+    if (! _drawbounds_vec.size() ) { 
+      return; // XXX what about Cairo?
+    }
 
-    _glue->redraw();
+    for (unsigned bno=0; bno < _drawbounds_vec.size(); bno++) {
+       geometry::Range2d<int>& bounds = _drawbounds_vec[bno];
+
+       assert ( bounds.isFinite() );
+
+       _glue->render(bounds);
+    }
 }
 
 int
@@ -361,12 +366,6 @@
       _glue->resize(w(), h() - _menu_height);
       resize_view(w(), h() - _menu_height);
     }
-
-    // Invalidate the whole drawing area.
-    rect draw_bounds(0, 0, _width, _height);
-    setInvalidatedRegion(draw_bounds);
-
-    _glue->redraw();
 }
 
 void 
@@ -389,15 +388,42 @@
 }
 
 void
-FltkGui::setInvalidatedRegion(const rect& bounds)
+FltkGui::setInvalidatedRegions(const InvalidatedRanges& ranges)
 {
-#if 0
-    // temporarily disabled
-    _glue->invalidateRegion(bounds);
-#endif
+    // forward to renderer
+    //
+    // Why? Why have the region been invalidated ??
+    // Was the renderer offscreen buffer also invalidated
+    // (need to rerender)?
+    // Was only the 'onscreen' buffer be invalidated (no need to rerender,
+    // just to blit) ??
+    //
+    // To be safe just assume this 'invalidated' region is actually
+    // the offscreen buffer, for safety, but we need to clarify this.
+    //
+    _renderer->set_invalidated_regions(ranges);
+
+    _drawbounds_vec.clear();
+
+    for (int rno=0; rno<ranges.size(); rno++) {
+
+      geometry::Range2d<int> bounds = Intersection(
+      _renderer->world_to_pixel(ranges.getRange(rno)),
+      _validbounds);
+
+      // it may happen that a particular range is out of the screen, which 
+      // will lead to bounds==null. 
+      if (bounds.isNull()) continue;
+
+      assert(bounds.isFinite());
+
+      _drawbounds_vec.push_back(bounds);
+
+    }
 }
 
 
+
 // end of namespace
 }
 

Index: gui/fltk_glue_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/fltk_glue_agg.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gui/fltk_glue_agg.cpp       31 Jan 2007 15:24:13 -0000      1.4
+++ gui/fltk_glue_agg.cpp       6 Mar 2007 17:40:04 -0000       1.5
@@ -63,8 +63,7 @@
 
 #define CHUNK_SIZE (100 * 100 * depth_bytes)
 
-    //int bufsize = static_cast<int>(width * height * depth_bytes / CHUNK_SIZE 
+ 1) * CHUNK_SIZE;
-    int bufsize = height * _stride;
+    int bufsize = (width * height * depth_bytes / CHUNK_SIZE + 1) * CHUNK_SIZE;
 
     _offscreenbuf = new unsigned char[bufsize];
 
@@ -84,6 +83,13 @@
 }
 
 void
+FltkAggGlue::render(geometry::Range2d<int>& bounds)
+{
+    _drawbounds = bounds;
+    redraw();
+}
+
+void
 FltkAggGlue::draw()
 {
     // Calculate the position of the first pixel within the invalidated
@@ -108,15 +114,4 @@
     initBuffer(width, height);
 }
 
-void
-FltkAggGlue::invalidateRegion(const rect& bounds)
-{
-    _renderer->set_invalidated_region(bounds);
-
-    _drawbounds = Intersection(
-                       // add two pixels because of anti-aliasing...
-                       _renderer->world_to_pixel(bounds).growBy(2),
-                       _validbounds);
-}
-
 } // namespace gnash

Index: gui/fltk_glue_agg.h
===================================================================
RCS file: /sources/gnash/gnash/gui/fltk_glue_agg.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gui/fltk_glue_agg.h 31 Jan 2007 15:24:13 -0000      1.4
+++ gui/fltk_glue_agg.h 6 Mar 2007 17:40:04 -0000       1.5
@@ -45,7 +45,8 @@
       render_handler* createRenderHandler();
       void initBuffer(int width, int height);
       void resize(int width, int height);
-      void invalidateRegion(const rect& bounds);
+      void render(geometry::Range2d<int>& bounds);
+
 
     private:
       int _width;

Index: gui/fltksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/fltksup.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gui/fltksup.h       31 Jan 2007 15:24:13 -0000      1.3
+++ gui/fltksup.h       6 Mar 2007 17:40:04 -0000       1.4
@@ -55,7 +55,7 @@
     virtual void setCursor(gnash_cursor_type newcursor);
     virtual bool setupEvents() { return true;}
 
-    void setInvalidatedRegion(const rect& bounds);
+    void setInvalidatedRegions(const InvalidatedRanges& ranges);
 
     void create();
     int handle(int event);
@@ -68,6 +68,8 @@
     float _interval;
     unsigned int _menu_height;
 
+    std::vector< geometry::Range2d<int> > _drawbounds_vec;
+
 #ifdef RENDERER_AGG
     FltkAggGlue *_glue;
 #elif defined(RENDERER_CAIRO)

Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- gui/gtksup.h        28 Feb 2007 17:25:25 -0000      1.35
+++ gui/gtksup.h        6 Mar 2007 17:40:04 -0000       1.36
@@ -145,7 +145,6 @@
     GtkMenu     *_popup_menu;
     GtkWidget   *_menubar;
     GtkWidget   *_vbox;
-    //geometry::Range2d<int> _drawbounds;
     std::vector< geometry::Range2d<int> > _drawbounds;
 
 #ifdef RENDERER_CAIRO




reply via email to

[Prev in Thread] Current Thread [Next in Thread]