gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/sdl.cpp gui/sdl_agg_glue.cp... [relea


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog gui/sdl.cpp gui/sdl_agg_glue.cp... [release_0_7_2]
Date: Wed, 01 Nov 2006 17:05:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         release_0_7_2
Changes by:     Bastiaan Jacques <bjacques>     06/11/01 17:05:42

Modified files:
        .              : ChangeLog 
        gui            : sdl.cpp sdl_agg_glue.cpp sdl_agg_glue.h 
                         sdl_glue.h sdlsup.h 

Log message:
                * gui/sdl{.cpp, sup.h, _glue.h}: Allow glues to implement region
                clipping. (This also fixes compilation.) Allow glues to 
implement
                resizing, but leave this feature disabled for now.
                * gui/sdl_agg_glue{.cpp, .h}: Implement region clipping 
correctly.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.1412.2.39&r2=1.1412.2.40
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl.cpp?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.47.2.2&r2=1.47.2.3
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl_agg_glue.cpp?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.4.2.2&r2=1.4.2.3
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl_agg_glue.h?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.3.2.2&r2=1.3.2.3
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl_glue.h?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.2.2.2&r2=1.2.2.3
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdlsup.h?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.18.2.2&r2=1.18.2.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1412.2.39
retrieving revision 1.1412.2.40
diff -u -b -r1.1412.2.39 -r1.1412.2.40
--- ChangeLog   1 Nov 2006 16:23:59 -0000       1.1412.2.39
+++ ChangeLog   1 Nov 2006 17:05:42 -0000       1.1412.2.40
@@ -1,3 +1,10 @@
+2006-11-01 Bastiaan Jacques <address@hidden>
+
+       * gui/sdl{.cpp, sup.h, _glue.h}: Allow glues to implement region
+       clipping. (This also fixes compilation.) Allow glues to implement
+       resizing, but leave this feature disabled for now.
+       * gui/sdl_agg_glue{.cpp, .h}: Implement region clipping correctly.
+
 2006-11-01 Sandro Santilli <address@hidden>
 
        * backend/sound_handler_sdl.{h,cpp}:

Index: gui/sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl.cpp,v
retrieving revision 1.47.2.2
retrieving revision 1.47.2.3
diff -u -b -r1.47.2.2 -r1.47.2.3
--- gui/sdl.cpp 31 Oct 2006 19:31:49 -0000      1.47.2.2
+++ gui/sdl.cpp 1 Nov 2006 17:05:42 -0000       1.47.2.3
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: sdl.cpp,v 1.47.2.2 2006/10/31 19:31:49 rsavoye Exp $ */
+/* $Id: sdl.cpp,v 1.47.2.3 2006/11/01 17:05:42 bjacques Exp $ */
 
 // XXXbjacques: Screw up the indentation in this file, and you're dead. And by
 //              screw up, I mean not adhering the indentation used throughout
@@ -129,7 +129,7 @@
                                        }
 
           case SDL_VIDEORESIZE:
-               resize_event();
+               resize_event(event.resize.w, event.resize.h);
                break;
 
           case SDL_VIDEOEXPOSE:
@@ -312,18 +312,42 @@
 }
 
 void
-SDLGui::resize_event()
+SDLGui::resize_event(int width, int height)
 {
-       log_msg("got resize_event ");
+//  GNASH_REPORT_FUNCTION;
+
+#if 0
+    // Disabled for stable branch
+
+    _width = width;
+    _height = height;
+
+    _glue.resize(width, height);
+
+    resize_view(width, height);
+
+    rect draw_bounds(-1e10f, -1e10f, +1e10f, +1e10f);
+
+    set_invalidated_region(draw_bounds);
+#endif
 }
 
 void
 SDLGui::expose_event()
 {
        // TODO: implement and use set_invalidated_region instead?
+       // SDL does not seem to support retrieving the exposed region.
        renderBuffer();
 }
 
+void
+SDLGui::set_invalidated_region(const rect& bounds)
+{
+    GNASH_REPORT_FUNCTION;
+    _glue.setInvalidatedRegion(bounds);
+}
+
+
 
 } // namespace gnash
 

Index: gui/sdl_agg_glue.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl_agg_glue.cpp,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -b -r1.4.2.2 -r1.4.2.3
--- gui/sdl_agg_glue.cpp        31 Oct 2006 19:31:49 -0000      1.4.2.2
+++ gui/sdl_agg_glue.cpp        1 Nov 2006 17:05:42 -0000       1.4.2.3
@@ -77,11 +77,14 @@
 bool
 SdlAggGlue::prepDrawingArea(int width, int height, uint32_t sdl_flags)
 {
+    _width = width;
+    _height = height;
+    _sdl_flags = sdl_flags | SDL_SWSURFACE;
     int depth_bytes = _bpp / 8;
 
     assert(_bpp % 8 == 0);
 
-    _screen = SDL_SetVideoMode(width, height, _bpp, sdl_flags | SDL_SWSURFACE);
+    _screen = SDL_SetVideoMode(width, height, _bpp, _sdl_flags);
 
     if (!_screen) {
         fprintf(stderr, "SDL_SetVideoMode() failed.\n");
@@ -139,6 +142,53 @@
     return true;
 }
 
+void SdlAggGlue::resize(int width, int height)
+{
+     GNASH_REPORT_FUNCTION;
+     
+   // _screen = SDL_SetVideoMode(_width, _height, _bpp, _sdl_flags);
+     SDL_FreeSurface(_sdl_surface);
+     SDL_FreeSurface(_screen);
+     delete [] _offscreenbuf;
+     prepDrawingArea(width, height, _sdl_flags);
 
+}
+
+
+int
+valid_coord(int coord, int max)
+{
+       if (coord<0) return 0;
+       else if (coord>=max) return max;
+       return coord;
+}
+
+void
+SdlAggGlue::render()
+{
+    SDL_BlitSurface(_sdl_surface, &_bounds, _screen, &_bounds);
+    SDL_UpdateRect (_screen, _bounds.x, _bounds.y, _bounds.w, _bounds.h);
+}
+
+void
+SdlAggGlue::setInvalidatedRegion(const rect& bounds)
+{
+    int xmin, ymin, xmax, ymax;
+
+    _agg_renderer->world_to_pixel(&xmin, &ymin, bounds.get_x_min(), 
bounds.get_y_min());
+    _agg_renderer->world_to_pixel(&xmax, &ymax, bounds.get_x_max(), 
bounds.get_y_max());
+
+    xmin = valid_coord(xmin-2, _width);
+    ymin = valid_coord(ymin-2, _height);
+    xmax = valid_coord(xmax+2, _width);
+    ymax = valid_coord(ymax+2, _height);
+
+    _bounds.w = xmax - xmin;
+    _bounds.h = ymax - ymin;
+    _bounds.x = xmin;
+    _bounds.y = ymin;
+
+    log_msg("Calculated bounds: %d, %d, %d, %d", _bounds.x, _bounds.y, 
_bounds.w, _bounds.h);
+}
 
 } // namespace gnash

Index: gui/sdl_agg_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl_agg_glue.h,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -b -r1.3.2.2 -r1.3.2.3
--- gui/sdl_agg_glue.h  31 Oct 2006 19:31:49 -0000      1.3.2.2
+++ gui/sdl_agg_glue.h  1 Nov 2006 17:05:42 -0000       1.3.2.3
@@ -37,11 +37,18 @@
     uint32_t maskFlags(uint32_t sdl_flags);
     void render();
     void render(int minx, int miny, int maxx, int maxy);
+
+    virtual void setInvalidatedRegion(const rect& bounds);
+    virtual void resize(int width, int height);
+
   private:
     SDL_Surface     *_sdl_surface;
     unsigned char   *_offscreenbuf;
     SDL_Surface     *_screen;
     render_handler  *_agg_renderer;
+    SDL_Rect         _bounds;
+    int              _width, _height;
+    uint32_t         _sdl_flags;
 };
 
 }

Index: gui/sdl_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl_glue.h,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -b -r1.2.2.2 -r1.2.2.3
--- gui/sdl_glue.h      31 Oct 2006 19:31:49 -0000      1.2.2.2
+++ gui/sdl_glue.h      1 Nov 2006 17:05:42 -0000       1.2.2.3
@@ -14,7 +14,11 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+#ifndef SDL_GLUE_H
+#define SDL_GLUE_H
+
 #include "gnash.h"
+#include "rect.h"
 
 namespace gnash
 {
@@ -28,8 +32,13 @@
     virtual bool prepDrawingArea(int width, int height, uint32_t sdl_flags) = 
0;
     virtual render_handler* createRenderHandler(int depth) = 0;
     virtual void render() = 0;
+    virtual void setInvalidatedRegion(const rect& bounds) {}
+    virtual void resize(int width, int height) {}
+    
   protected:
     int _bpp;
 };
 
 } // namespace gnash
+
+#endif // SDL_GLUE_H

Index: gui/sdlsup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/sdlsup.h,v
retrieving revision 1.18.2.2
retrieving revision 1.18.2.3
diff -u -b -r1.18.2.2 -r1.18.2.3
--- gui/sdlsup.h        31 Oct 2006 19:31:49 -0000      1.18.2.2
+++ gui/sdlsup.h        1 Nov 2006 17:05:42 -0000       1.18.2.3
@@ -59,13 +59,13 @@
     virtual void setTimeout(unsigned int timeout);
 
                void key_event(SDLKey key, bool down);
-
+    void set_invalidated_region(const rect& bounds);
 private:
     unsigned int       _timeout;
     bool               _core_trap;
 
     /// Handle VIDEORESIZE event
-    void resize_event();
+    void resize_event(int width, int height);
 
     /// Handle VIDEOEXPOSE event
     void expose_event();




reply via email to

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