gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu...


From: Markus Gothe
Subject: [Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu...
Date: Tue, 28 Nov 2006 12:20:16 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Markus Gothe <nihilus>  06/11/28 12:20:16

Modified files:
        .              : ChangeLog configure.ac 
        gui            : Makefile.am Player.cpp 
Added files:
        gui            : riscos.cpp riscos_glue.h riscos_glue_agg.cpp 
                         riscos_glue_agg.h riscossup.h 
Removed files:
        gui            : ro.cpp ro_glue.h ro_glue_agg.cpp ro_glue_agg.h 
                         rosup.h 

Log message:
        Applied a bunch of RiscOS-patches.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1800&r2=1.1801
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.220&r2=1.221
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Makefile.am?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/riscos.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/riscos_glue.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/riscos_glue_agg.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/riscos_glue_agg.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/riscossup.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro.cpp?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro_glue.h?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro_glue_agg.cpp?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro_glue_agg.h?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/rosup.h?cvsroot=gnash&r1=1.1&r2=0

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1800
retrieving revision 1.1801
diff -u -b -r1.1800 -r1.1801
--- ChangeLog   28 Nov 2006 12:10:26 -0000      1.1800
+++ ChangeLog   28 Nov 2006 12:20:16 -0000      1.1801
@@ -1,3 +1,7 @@
+2006-11-28 Markus Gothe <address@hidden>
+
+       * Applied a bunch of RiscOS-patches.
+
 2006-11-28 Sandro Santilli <address@hidden>
 
        * macros/libtool.m4: removed so that ltmain.sh

Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -b -r1.220 -r1.221
--- configure.ac        28 Nov 2006 11:58:05 -0000      1.220
+++ configure.ac        28 Nov 2006 12:20:16 -0000      1.221
@@ -15,7 +15,7 @@
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 dnl  
 
-dnl $Id: configure.ac,v 1.220 2006/11/28 11:58:05 nihilus Exp $
+dnl $Id: configure.ac,v 1.221 2006/11/28 12:20:16 nihilus Exp $
 
 AC_PREREQ(2.50)
 AC_INIT(gnash, cvs)
@@ -196,7 +196,7 @@
 
 if test x$renderer = xagg; then
   if test x"$gui" != xfb -a x"$gui" != xgtk -a x"$gui" != xsdl -a x"$gui" != 
xriscos; then
-    AC_MSG_ERROR([agg renderer is only supported by fb, gtk, ro and sdl guis]);
+    AC_MSG_ERROR([agg renderer is only supported by fb, gtk, riscos and sdl 
guis]);
   fi
   AC_DEFINE([RENDERER_AGG], [], [Use AntiGrain renderer])
 fi
@@ -602,7 +602,7 @@
 AM_CONDITIONAL(USE_GUI_GTK, test x$gui = xgtk)
 AM_CONDITIONAL(USE_GUI_SDL, test x$gui = xsdl)
 AM_CONDITIONAL(USE_GUI_KDE, test x$gui = xkde)
-AM_CONDITIONAL(USE_GUI_RO, test x$gui = xriscos)
+AM_CONDITIONAL(USE_GUI_RISCOS, test x$gui = xriscos)
 
 case "${gui}" in
        gtk)  AC_DEFINE([GUI_GTK],  [1], [Use GTK gui toolkit]) ;;
@@ -610,7 +610,7 @@
        kde)  AC_DEFINE([GUI_KDE],  [1], [Use KDE gui toolkit]) ;;
        fltk) AC_DEFINE([GUI_FLTK], [1], [Use FLTK gui toolkit]) ;;
        fb) AC_DEFINE([GUI_FB], [1], [Use Framebuffer, no gui toolkit]) ;;
-       riscos) AC_DEFINE([GUI_RO], [1], [Use RISC OS gui toolkit]) ;;
+       riscos) AC_DEFINE([GUI_RISCOS], [1], [Use RISC OS gui toolkit]) ;;
        *)
 esac
 

Index: gui/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/gui/Makefile.am,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- gui/Makefile.am     28 Nov 2006 12:10:26 -0000      1.49
+++ gui/Makefile.am     28 Nov 2006 12:20:16 -0000      1.50
@@ -17,7 +17,7 @@
 
 # 
 
-# $Id: Makefile.am,v 1.49 2006/11/28 12:10:26 strk Exp $
+# $Id: Makefile.am,v 1.50 2006/11/28 12:20:16 nihilus Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -94,11 +94,11 @@
   AM_CPPFLAGS += $(AGG_CFLAGS)
   AM_LDFLAGS += $(AGG_LIBS)
   GTK_AGG_SRCS = gtk_glue_agg.cpp gtk_glue_agg.h
-  RO_AGG_SRCS = ro_glue_agg.cpp ro_glue_agg.h
+  RISCOS_AGG_SRCS = ro_glue_agg.cpp ro_glue_agg.h
   SDL_AGG_SRCS = sdl_agg_glue.cpp sdl_agg_glue.h
 else
   GTK_AGG_SRCS =
-  RO_AGG_SRCS =
+  RISCOS_AGG_SRCS =
   SDL_AGG_SRCS =
 endif
 
@@ -111,11 +111,11 @@
  GTK_SRCS = 
 endif
 
-if USE_GUI_RO
- RO_SRCS = ro.cpp rosup.h ro_glue.h $(RO_AGG_SRCS)
+if USE_GUI_RISCOS
+ RISCOS_SRCS = riscos.cpp riscossup.h riscos_glue.h $(RISCOS_AGG_SRCS)
  AM_LDFLAGS += -lOSLib32
 else
- RO_SRCS =
+ RISCS_SRCS =
 endif
 
 if USE_GUI_SDL
@@ -177,7 +177,7 @@
        $(GTK2_SRCS) \
        $(KDE_SRCS) \
        $(FB_SRCS) \
-       $(RO_SRCS) \
+       $(RISCOS_SRCS) \
        gui.cpp gui.h \
        NullGui.cpp \
        NullGui.h

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- gui/Player.cpp      27 Nov 2006 15:57:51 -0000      1.32
+++ gui/Player.cpp      28 Nov 2006 12:20:16 -0000      1.33
@@ -29,8 +29,8 @@
 # elif defined(GUI_SDL)
 #  include "sdlsup.h"
 #  define GUI_CLASS SDLGui
-# elif defined(GUI_RO)
-#  include "rosup.h"
+# elif defined(GUI_RISCOS)
+#  include "riscossup.h"
 #  define GUI_CLASS RiscosGui
 # endif
 #else

Index: gui/riscos.cpp
===================================================================
RCS file: gui/riscos.cpp
diff -N gui/riscos.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/riscos.cpp      28 Nov 2006 12:20:16 -0000      1.1
@@ -0,0 +1,395 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gnash.h"
+//#include "movie_definition.h"
+#include "gui.h"
+#include "rc.h"
+#include "rosup.h"
+#include "render_handler.h"
+#include "log.h"
+
+//#include <iostream>
+
+namespace gnash
+{
+
+RiscosGui::~RiscosGui()
+{
+    if (_task)
+      wimp_close_down(_task);
+}
+
+RiscosGui::RiscosGui(unsigned long xid, float scale, bool loop, unsigned int 
depth)
+ : Gui(xid, scale, loop, depth), _task((wimp_t)0), _window((wimp_w)0),
+   _quit(false), _timeout(0), m_draw_minx(0), m_draw_miny(0),
+   m_draw_maxx(0), m_draw_maxy(0), _screen_height(480), _screen_width(640)
+{
+}
+
+
+bool
+RiscosGui::init(int argc, char **argv[])
+{
+    GNASH_REPORT_FUNCTION;
+
+/*    wimp_MESSAGE_LIST(4) messages = { { message_MODE_CHANGE,
+                                        message_DATA_LOAD,
+                                        message_DATA_OPEN,
+                                        message_QUIT } };*/
+    os_error *error;
+
+    glue.init(argc, argv);
+
+    error = xwimp_initialise(wimp_VERSION_RO38, "Gnash",
+                             (wimp_message_list *)0/*&messages*/,
+                             0, &_task);
+    if (error) {
+      log_msg("%s\n", error->errmess);
+      return false;
+    }
+
+    if (!create_window())
+      return false;
+
+#ifdef RENDERER_AGG
+    os_VDU_VAR_LIST(2) vduvars = { { os_VDUVAR_SCREEN_START,
+                                     os_VDUVAR_END_LIST} };
+    int vduvals[2];
+    error = xos_read_vdu_variables((const os_vdu_var_list *)&vduvars,
+                                   vduvals);
+    if (error) {
+      log_msg("%s\n", error->errmess);
+      return false;
+    }
+
+    os_mode mode;
+    os_mode_selector *mode_block;
+
+    /* read current screenmode details */
+    error = xosscreenmode_current(&mode);
+    if (error) {
+      log_msg("%s", error->errmess);
+      return false;
+    }
+
+    if ((unsigned int)mode >= 256) {
+      mode_block = (os_mode_selector *)mode;
+      _screen_width = mode_block->xres;
+      _screen_height = mode_block->yres;
+    }
+
+    /** \todo Mode specifiers */
+
+    log_msg("Framebuffer address: %p\n", (void *)vduvals[0]);
+    log_msg("Screen Res: %d x %d\n", _screen_width, _screen_height);
+
+    glue.prepFramebuffer((void *)vduvals[0], _screen_width, _screen_height);
+#endif
+
+    _renderer = glue.createRenderHandler();
+    set_render_handler(_renderer);
+    // hack?
+    _renderer->set_scale(1.0f, 1.0f);
+
+    return true;
+}
+
+
+bool
+RiscosGui::createWindow(const char *title, int width, int height)
+{
+//First call the old createWindow function and then set the title.
+//In case there's some need to not setting the title.
+    title = title; // TODO: set title string
+
+    bool ret = createWindow(width, height);
+    wimp_window_state state;
+    os_error *error;
+
+    state.w = _window;
+    error = xwimp_get_window_state(&state);
+    if (error) {
+      log_msg("%s\n", error->errmess);
+      return false;
+    }
+
+    state.visible.x1 = state.visible.x0 + (width * 2);
+    state.visible.y1 = state.visible.y0 + (height * 2);
+
+    error = xwimp_open_window((wimp_open *)&state);
+    if (error) {
+      log_msg("%s\n", error->errmess);
+      return false;
+    }
+
+    return ret;
+}
+
+bool
+RiscosGui::createWindow(int width, int height)
+{
+    GNASH_REPORT_FUNCTION;
+    _width = width;
+    _height = height;
+
+    glue.setRenderHandlerSize(width, height);
+
+    return true;
+}
+
+void
+RiscosGui::renderBuffer()
+{
+    // bounding box is window-relative
+    wimp_window_state state;
+    os_error *error;
+
+    state.w = _window;
+    error = xwimp_get_window_state(&state);
+    if (error) {
+      log_msg("%s\n", error->errmess);
+    }
+
+    glue.render(state.visible.x0 / 2,
+                _screen_height - (state.visible.y1 / 2),
+                m_draw_minx, m_draw_miny, m_draw_maxx, m_draw_maxy);
+}
+
+void
+RiscosGui::setTimeout(unsigned int timeout)
+{
+    _timeout = os_read_monotonic_time() + timeout / 10;
+}
+
+void
+RiscosGui::setInterval(unsigned int interval)
+{
+    _interval = interval;
+}
+
+void
+RiscosGui::set_invalidated_region(const rect& bounds)
+{
+    // Note: Bounds coordinates are in TWIPS
+
+#ifdef RENDERER_AGG
+    // forward to renderer
+    _renderer->set_invalidated_region(bounds);
+
+    if (bounds.width() > 1e10f) {
+      // Region is entire screen. Don't convert to integer as this will
+      // overflow.
+
+      m_draw_minx = 0;
+      m_draw_miny = 0;
+      m_draw_maxx = _width - 1;
+      m_draw_maxy = _height - 1;
+    } else {
+      // remember for renderBuffer()
+      _renderer->world_to_pixel(&m_draw_minx, &m_draw_miny,
+                                bounds.get_x_min(), bounds.get_y_min());
+      _renderer->world_to_pixel(&m_draw_maxx, &m_draw_maxy,
+                                bounds.get_x_max(), bounds.get_y_max());
+
+      // add two pixels because of anti-aliasing...
+      m_draw_minx = valid_coord(m_draw_minx - 2, _width);
+      m_draw_miny = valid_coord(m_draw_miny - 2, _height);
+      m_draw_maxx = valid_coord(m_draw_maxx + 2, _width);
+      m_draw_maxy = valid_coord(m_draw_maxy + 2, _height);
+    }
+
+//    log_msg("DrawRect: (%i, %i), (%i, %i)\n",
+//            m_draw_minx, m_draw_miny, m_draw_maxx, m_draw_maxy);
+#endif
+}
+
+bool
+RiscosGui::run()
+{
+    GNASH_REPORT_FUNCTION;
+
+    os_t t, now;
+    wimp_block block;
+    wimp_event_no event;
+    osbool more;
+    os_error *error;
+
+    t = os_read_monotonic_time();
+
+    while (!_quit) {
+      error = xwimp_poll_idle(0, &block, t, NULL, &event);
+      if (error) {
+        log_msg("%s\n", error->errmess);
+        return false;
+      }
+
+      switch (event) {
+      case wimp_NULL_REASON_CODE:
+        now = os_read_monotonic_time();
+        if (now > t) {
+          if (_timeout > now) {
+            _quit = true;
+          } else {
+            // TODO: pay attention to interval
+//            if ((os_t)_interval <= (now - t) * 10) {
+              advance_movie(this);
+//            }
+            now = os_read_monotonic_time();
+            t = now + 10;
+          }
+        }
+        break;
+      case wimp_REDRAW_WINDOW_REQUEST:
+        error = xwimp_redraw_window(&block.redraw, &more);
+        if (error) {
+          log_msg("%s\n", error->errmess);
+          return false;
+        }
+        while (more) {
+//          rect bounds(block.redraw.clip.x0 / 2, block.redraw.clip.y0 / 2,
+//                      block.redraw.clip.x1 / 2, block.redraw.clip.y1 / 2);
+//          log_msg("Clip rect: (%d, %d)(%d, %d)\n",
+//                  block.redraw.clip.x0 / 2, block.redraw.clip.y0 / 2,
+//                  block.redraw.clip.x1 / 2, block.redraw.clip.y1 / 2);
+          // TODO: Make this use the clipping rectangle (convert to TWIPS)
+          rect bounds(-1e10f, -1e10f, 1e10f, 1e10f);
+#ifdef RENDERER_AGG
+          set_invalidated_region(bounds);
+#endif
+          renderBuffer();
+          error = xwimp_get_rectangle(&block.redraw, &more);
+          if (error) {
+            log_msg("%s\n", error->errmess);
+            return false;
+          }
+        }
+        break;
+      case wimp_OPEN_WINDOW_REQUEST:
+        error = xwimp_open_window(&block.open);
+        if (error)
+          log_msg("%s\n", error->errmess);
+        break;
+      case wimp_CLOSE_WINDOW_REQUEST:
+        _quit = true;
+        break;
+      case wimp_POINTER_LEAVING_WINDOW:
+        break;
+      case wimp_POINTER_ENTERING_WINDOW:
+        break;
+      case wimp_MOUSE_CLICK:
+        break;
+      case wimp_USER_DRAG_BOX:
+        break;
+      case wimp_MENU_SELECTION:
+        break;
+      case wimp_SCROLL_REQUEST:
+        break;
+      case wimp_LOSE_CARET:
+        break;
+      case wimp_GAIN_CARET:
+        break;
+      case wimp_POLLWORD_NON_ZERO:
+        break;
+      case wimp_USER_MESSAGE:
+      case wimp_USER_MESSAGE_RECORDED:
+      case wimp_USER_MESSAGE_ACKNOWLEDGE:
+        switch (block.message.action) {
+        case message_QUIT:
+          _quit = true;
+          break;
+        default:
+//          user_message(event, &(block.message));
+          break;
+        }
+        break;
+      }
+    }
+
+    return true;
+}
+
+bool
+RiscosGui::createMenu()
+{
+    GNASH_REPORT_FUNCTION;
+
+    return true;
+}
+
+bool
+RiscosGui::setupEvents()
+{
+  GNASH_REPORT_FUNCTION;
+
+  return true;
+}
+
+/**
+ * Creates a window
+ *
+ * \return true on success, false otherwise
+ */
+bool RiscosGui::create_window()
+{
+    wimp_WINDOW(0) window = {
+                { 400, 400, 800, 800 },
+                0, 0,
+                wimp_TOP,
+                wimp_WINDOW_MOVEABLE | wimp_WINDOW_BACK_ICON |
+                wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON |
+                wimp_WINDOW_NEW_FORMAT,
+                wimp_COLOUR_BLACK, wimp_COLOUR_LIGHT_GREY,
+                wimp_COLOUR_BLACK, wimp_COLOUR_WHITE,
+                wimp_COLOUR_DARK_GREY, wimp_COLOUR_DARK_GREY,
+                wimp_COLOUR_CREAM,
+                0,
+                { 0, -81928, 1300, 0 },
+                wimp_ICON_TEXT | wimp_ICON_HCENTRED,
+                0,
+                0,
+                2, 1,
+                { "Gnash" },
+                0
+    };
+    os_error *error;
+
+    error = xwimp_create_window((wimp_window *)&window, &_window);
+    if (error) {
+      log_msg("%s\n", error->errmess);
+      return false;
+    }
+
+    return true;
+}
+
+int
+RiscosGui::valid_coord(int coord, int max)
+{
+       if (coord<0) return 0;
+       else if (coord>=max) return max;
+       return coord;
+}
+
+// end of namespace gnash
+}

Index: gui/riscos_glue.h
===================================================================
RCS file: gui/riscos_glue.h
diff -N gui/riscos_glue.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/riscos_glue.h   28 Nov 2006 12:20:16 -0000      1.1
@@ -0,0 +1,45 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+//
+
+#include "gnash.h"
+
+namespace gnash
+{
+
+class RiscosGlue
+{
+  public:
+    virtual ~RiscosGlue() { };
+    virtual bool init(int argc, char **argv[]) = 0;
+
+    virtual void prepFramebuffer(void *framebuffer, int width, int height) = 0;
+    virtual render_handler* createRenderHandler() = 0;
+    virtual void setRenderHandlerSize(int /*width*/, int /*height*/) { };
+    virtual void render(int /* x */, int /* y */) = 0;
+    virtual void render(int x, int y, int /*minx*/, int /*miny*/, int 
/*maxx*/, int /*maxy*/)
+                       { render(x, y); };
+//    virtual void configure(GtkWidget *const widget,
+//                           GdkEventConfigure *const event) = 0;
+  protected:
+    void *_framebuffer;
+    int _fbwidth;
+    int _fbheight;
+};
+
+} // namespace gnash

Index: gui/riscos_glue_agg.cpp
===================================================================
RCS file: gui/riscos_glue_agg.cpp
diff -N gui/riscos_glue_agg.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/riscos_glue_agg.cpp     28 Nov 2006 12:20:16 -0000      1.1
@@ -0,0 +1,164 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+//
+
+/* $Id: riscos_glue_agg.cpp,v 1.1 2006/11/28 12:20:16 nihilus Exp $ */
+
+#include <cstdio>
+#include <cerrno>
+#include <cstring>
+
+#include "gnash.h"
+#include "log.h"
+#include "render_handler.h"
+#include "render_handler_agg.h"
+#include "ro_glue_agg.h"
+
+namespace gnash
+{
+
+RiscosAggGlue::RiscosAggGlue() :
+       _offscreenbuf(NULL),
+       _offscreenbuf_size(0),
+       _agg_renderer(NULL),
+       _width(0),
+       _height(0),
+       _bpp(0)
+{
+}
+
+RiscosAggGlue::~RiscosAggGlue()
+{
+  free(_offscreenbuf);
+}
+
+bool
+RiscosAggGlue::init(int /*argc*/, char **/*argv*/[])
+{
+  // We only support 32bpp modes
+  _bpp = 24;
+
+  return true;
+}
+
+void
+RiscosAggGlue::prepFramebuffer(void *framebuffer, int width, int height)
+{
+    _framebuffer = framebuffer;
+    _fbwidth = width;
+    _fbheight = height;
+}
+
+render_handler*
+RiscosAggGlue::createRenderHandler()
+{
+  _agg_renderer = create_render_handler_agg("RGB24");
+  return _agg_renderer;
+}
+
+void
+RiscosAggGlue::setRenderHandlerSize(int width, int height)
+{
+  assert(width>0);
+  assert(height>0);
+  assert(_agg_renderer!=NULL);
+
+#define CHUNK_SIZE (100*100*(_bpp/8))
+
+  if (width == _width && height == _height)
+    return;
+
+  int new_bufsize = width*height*(_bpp/8);
+
+  // TODO: At the moment we only increase the buffer and never decrease it.
+  // Should be changed sometime.
+  if (new_bufsize > _offscreenbuf_size) {
+    new_bufsize = static_cast<int>(new_bufsize / CHUNK_SIZE + 1) * CHUNK_SIZE;
+    // TODO: C++ conform alternative to realloc?
+    _offscreenbuf = static_cast<unsigned char *>( realloc(_offscreenbuf, 
new_bufsize) );
+
+    if (!_offscreenbuf) {
+      log_msg("Could not allocate %i bytes for offscreen buffer: %s\n",
+               new_bufsize, strerror(errno) );
+      return;
+    }
+
+    log_msg("RISC OS-AGG: %i bytes offscreen buffer allocated\n", new_bufsize);
+
+    _offscreenbuf_size = new_bufsize;
+    memset(_offscreenbuf, 0, new_bufsize);
+  }
+
+  _width = width;
+  _height = height;
+
+  // Only the AGG renderer has the function init_buffer, which is *not* part
+  // of the renderer api. It allows us to change the renderers movie size
+  // (and buffer address) during run-time.
+  static_cast<render_handler_agg_base *>(_agg_renderer)->init_buffer(
+         _offscreenbuf,
+         _offscreenbuf_size,
+         _width,
+         _height);
+}
+
+void
+RiscosAggGlue::render(int x, int y)
+{
+  // Update the entire screen
+  render(x, y, 0, 0, _width, _height);
+}
+
+void
+RiscosAggGlue::render(int x, int y, int minx, int miny, int maxx, int maxy)
+{
+  // Update only the invalidated rectangle
+  unsigned char *fb = (unsigned char *)_framebuffer;
+  int fbw = _fbwidth * 4; // (((_bpp / 8) + 3) & ~3);
+  int osw = _width * (_bpp / 8);
+
+  for (int row = miny; row < maxy; row++) {
+//    int fbr = row * (((_bpp / 8) + 3) & ~3);
+//    int osr = row * (_bpp / 8);
+
+    for (int col = minx; col < maxx; col++) {
+      int fbc = (col + x) * 4; // (((_bpp / 8) + 3) & ~3);
+      int osc = col * (_bpp / 8);
+
+      fb[(row + y) * fbw + fbc + 0] = _offscreenbuf[row * osw + osc + 0];
+      fb[(row + y) * fbw + fbc + 1] = _offscreenbuf[row * osw + osc + 1];
+      fb[(row + y) * fbw + fbc + 2] = _offscreenbuf[row * osw + osc + 2];
+      fb[(row + y) * fbw + fbc + 3] = 0;
+    }
+  }
+
+}
+
+#if 0
+void
+RiscosAggGlue::configure(GtkWidget *const /*widget*/, GdkEventConfigure *const 
event)
+{
+       if (_agg_renderer)
+               setRenderHandlerSize(event->width, event->height);
+}
+#endif
+
+
+
+} // namespace gnash
+

Index: gui/riscos_glue_agg.h
===================================================================
RCS file: gui/riscos_glue_agg.h
diff -N gui/riscos_glue_agg.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/riscos_glue_agg.h       28 Nov 2006 12:20:16 -0000      1.1
@@ -0,0 +1,46 @@
+//
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+//
+
+#include "ro_glue.h"
+
+namespace gnash
+{
+
+class RiscosAggGlue : public RiscosGlue
+{
+  public:
+    RiscosAggGlue();
+    ~RiscosAggGlue();
+
+    bool init(int argc, char **argv[]);
+    void prepFramebuffer(void *framebuffer, int width, int height);
+    render_handler* createRenderHandler();
+    void setRenderHandlerSize(int width, int height);
+    void render(int x, int y);
+    void render(int x, int y, int minx, int miny, int maxx, int maxy);
+//    void configure(GtkWidget *const widget, GdkEventConfigure *const event);
+
+  private:
+    unsigned char *_offscreenbuf;
+    int _offscreenbuf_size;
+    render_handler *_agg_renderer;
+    int _width, _height, _bpp;
+};
+
+} // namespace gnash

Index: gui/riscossup.h
===================================================================
RCS file: gui/riscossup.h
diff -N gui/riscossup.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/riscossup.h     28 Nov 2006 12:20:16 -0000      1.1
@@ -0,0 +1,64 @@
+#ifndef __ROSUP_H__
+#define __ROSUP_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gnash.h"
+#include "tu_config.h"
+
+#include "oslib/colourtrans.h"
+#include "oslib/wimp.h"
+
+#ifdef RENDERER_AGG
+#include "ro_glue_agg.h"
+#endif
+
+#include "gui.h"
+
+namespace gnash
+{
+
+class DSOEXPORT RiscosGui : public Gui
+{
+ public:
+    RiscosGui(unsigned long xid, float scale, bool loop, unsigned int depth);
+    virtual ~RiscosGui();
+    virtual bool init(int argc, char **argv[]);
+    virtual bool createWindow(int width, int height);
+    virtual bool createWindow(const char *title, int width, int height);
+    virtual bool run();
+    virtual bool createMenu();
+    virtual bool setupEvents();
+    virtual void renderBuffer();
+    virtual void setInterval(unsigned int interval);
+    virtual void setTimeout(unsigned int timeout);
+    virtual void set_invalidated_region(const rect& bounds);
+
+
+ private:
+    bool create_window();
+    int valid_coord(int coord, int max);
+
+    wimp_t _task;
+    wimp_w _window;
+    bool _quit;
+    os_t _timeout;
+
+    int m_draw_minx;
+    int m_draw_miny;
+    int m_draw_maxx;
+    int m_draw_maxy;
+
+    int _screen_height;
+    int _screen_width;
+
+#ifdef RENDERER_AGG
+    RiscosAggGlue glue;
+#endif
+};
+
+}
+
+#endif

Index: gui/ro.cpp
===================================================================
RCS file: gui/ro.cpp
diff -N gui/ro.cpp
--- gui/ro.cpp  19 Nov 2006 17:39:01 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,395 +0,0 @@
-//
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-//
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gnash.h"
-//#include "movie_definition.h"
-#include "gui.h"
-#include "rc.h"
-#include "rosup.h"
-#include "render_handler.h"
-#include "log.h"
-
-//#include <iostream>
-
-namespace gnash
-{
-
-RiscosGui::~RiscosGui()
-{
-    if (_task)
-      wimp_close_down(_task);
-}
-
-RiscosGui::RiscosGui(unsigned long xid, float scale, bool loop, unsigned int 
depth)
- : Gui(xid, scale, loop, depth), _task((wimp_t)0), _window((wimp_w)0),
-   _quit(false), _timeout(0), m_draw_minx(0), m_draw_miny(0),
-   m_draw_maxx(0), m_draw_maxy(0), _screen_height(480), _screen_width(640)
-{
-}
-
-
-bool
-RiscosGui::init(int argc, char **argv[])
-{
-    GNASH_REPORT_FUNCTION;
-
-/*    wimp_MESSAGE_LIST(4) messages = { { message_MODE_CHANGE,
-                                        message_DATA_LOAD,
-                                        message_DATA_OPEN,
-                                        message_QUIT } };*/
-    os_error *error;
-
-    glue.init(argc, argv);
-
-    error = xwimp_initialise(wimp_VERSION_RO38, "Gnash",
-                             (wimp_message_list *)0/*&messages*/,
-                             0, &_task);
-    if (error) {
-      log_msg("%s\n", error->errmess);
-      return false;
-    }
-
-    if (!create_window())
-      return false;
-
-#ifdef RENDERER_AGG
-    os_VDU_VAR_LIST(2) vduvars = { { os_VDUVAR_SCREEN_START,
-                                     os_VDUVAR_END_LIST} };
-    int vduvals[2];
-    error = xos_read_vdu_variables((const os_vdu_var_list *)&vduvars,
-                                   vduvals);
-    if (error) {
-      log_msg("%s\n", error->errmess);
-      return false;
-    }
-
-    os_mode mode;
-    os_mode_selector *mode_block;
-
-    /* read current screenmode details */
-    error = xosscreenmode_current(&mode);
-    if (error) {
-      log_msg("%s", error->errmess);
-      return false;
-    }
-
-    if ((unsigned int)mode >= 256) {
-      mode_block = (os_mode_selector *)mode;
-      _screen_width = mode_block->xres;
-      _screen_height = mode_block->yres;
-    }
-
-    /** \todo Mode specifiers */
-
-    log_msg("Framebuffer address: %p\n", (void *)vduvals[0]);
-    log_msg("Screen Res: %d x %d\n", _screen_width, _screen_height);
-
-    glue.prepFramebuffer((void *)vduvals[0], _screen_width, _screen_height);
-#endif
-
-    _renderer = glue.createRenderHandler();
-    set_render_handler(_renderer);
-    // hack?
-    _renderer->set_scale(1.0f, 1.0f);
-
-    return true;
-}
-
-
-bool
-RiscosGui::createWindow(const char *title, int width, int height)
-{
-//First call the old createWindow function and then set the title.
-//In case there's some need to not setting the title.
-    title = title; // TODO: set title string
-
-    bool ret = createWindow(width, height);
-    wimp_window_state state;
-    os_error *error;
-
-    state.w = _window;
-    error = xwimp_get_window_state(&state);
-    if (error) {
-      log_msg("%s\n", error->errmess);
-      return false;
-    }
-
-    state.visible.x1 = state.visible.x0 + (width * 2);
-    state.visible.y1 = state.visible.y0 + (height * 2);
-
-    error = xwimp_open_window((wimp_open *)&state);
-    if (error) {
-      log_msg("%s\n", error->errmess);
-      return false;
-    }
-
-    return ret;
-}
-
-bool
-RiscosGui::createWindow(int width, int height)
-{
-    GNASH_REPORT_FUNCTION;
-    _width = width;
-    _height = height;
-
-    glue.setRenderHandlerSize(width, height);
-
-    return true;
-}
-
-void
-RiscosGui::renderBuffer()
-{
-    // bounding box is window-relative
-    wimp_window_state state;
-    os_error *error;
-
-    state.w = _window;
-    error = xwimp_get_window_state(&state);
-    if (error) {
-      log_msg("%s\n", error->errmess);
-    }
-
-    glue.render(state.visible.x0 / 2,
-                _screen_height - (state.visible.y1 / 2),
-                m_draw_minx, m_draw_miny, m_draw_maxx, m_draw_maxy);
-}
-
-void
-RiscosGui::setTimeout(unsigned int timeout)
-{
-    _timeout = os_read_monotonic_time() + timeout / 10;
-}
-
-void
-RiscosGui::setInterval(unsigned int interval)
-{
-    _interval = interval;
-}
-
-void
-RiscosGui::set_invalidated_region(const rect& bounds)
-{
-    // Note: Bounds coordinates are in TWIPS
-
-#ifdef RENDERER_AGG
-    // forward to renderer
-    _renderer->set_invalidated_region(bounds);
-
-    if (bounds.width() > 1e10f) {
-      // Region is entire screen. Don't convert to integer as this will
-      // overflow.
-
-      m_draw_minx = 0;
-      m_draw_miny = 0;
-      m_draw_maxx = _width - 1;
-      m_draw_maxy = _height - 1;
-    } else {
-      // remember for renderBuffer()
-      _renderer->world_to_pixel(&m_draw_minx, &m_draw_miny,
-                                bounds.get_x_min(), bounds.get_y_min());
-      _renderer->world_to_pixel(&m_draw_maxx, &m_draw_maxy,
-                                bounds.get_x_max(), bounds.get_y_max());
-
-      // add two pixels because of anti-aliasing...
-      m_draw_minx = valid_coord(m_draw_minx - 2, _width);
-      m_draw_miny = valid_coord(m_draw_miny - 2, _height);
-      m_draw_maxx = valid_coord(m_draw_maxx + 2, _width);
-      m_draw_maxy = valid_coord(m_draw_maxy + 2, _height);
-    }
-
-//    log_msg("DrawRect: (%i, %i), (%i, %i)\n",
-//            m_draw_minx, m_draw_miny, m_draw_maxx, m_draw_maxy);
-#endif
-}
-
-bool
-RiscosGui::run()
-{
-    GNASH_REPORT_FUNCTION;
-
-    os_t t, now;
-    wimp_block block;
-    wimp_event_no event;
-    osbool more;
-    os_error *error;
-
-    t = os_read_monotonic_time();
-
-    while (!_quit) {
-      error = xwimp_poll_idle(0, &block, t, NULL, &event);
-      if (error) {
-        log_msg("%s\n", error->errmess);
-        return false;
-      }
-
-      switch (event) {
-      case wimp_NULL_REASON_CODE:
-        now = os_read_monotonic_time();
-        if (now > t) {
-          if (_timeout > now) {
-            _quit = true;
-          } else {
-            // TODO: pay attention to interval
-//            if ((os_t)_interval <= (now - t) * 10) {
-              advance_movie(this);
-//            }
-            now = os_read_monotonic_time();
-            t = now + 10;
-          }
-        }
-        break;
-      case wimp_REDRAW_WINDOW_REQUEST:
-        error = xwimp_redraw_window(&block.redraw, &more);
-        if (error) {
-          log_msg("%s\n", error->errmess);
-          return false;
-        }
-        while (more) {
-//          rect bounds(block.redraw.clip.x0 / 2, block.redraw.clip.y0 / 2,
-//                      block.redraw.clip.x1 / 2, block.redraw.clip.y1 / 2);
-//          log_msg("Clip rect: (%d, %d)(%d, %d)\n",
-//                  block.redraw.clip.x0 / 2, block.redraw.clip.y0 / 2,
-//                  block.redraw.clip.x1 / 2, block.redraw.clip.y1 / 2);
-          // TODO: Make this use the clipping rectangle (convert to TWIPS)
-          rect bounds(-1e10f, -1e10f, 1e10f, 1e10f);
-#ifdef RENDERER_AGG
-          set_invalidated_region(bounds);
-#endif
-          renderBuffer();
-          error = xwimp_get_rectangle(&block.redraw, &more);
-          if (error) {
-            log_msg("%s\n", error->errmess);
-            return false;
-          }
-        }
-        break;
-      case wimp_OPEN_WINDOW_REQUEST:
-        error = xwimp_open_window(&block.open);
-        if (error)
-          log_msg("%s\n", error->errmess);
-        break;
-      case wimp_CLOSE_WINDOW_REQUEST:
-        _quit = true;
-        break;
-      case wimp_POINTER_LEAVING_WINDOW:
-        break;
-      case wimp_POINTER_ENTERING_WINDOW:
-        break;
-      case wimp_MOUSE_CLICK:
-        break;
-      case wimp_USER_DRAG_BOX:
-        break;
-      case wimp_MENU_SELECTION:
-        break;
-      case wimp_SCROLL_REQUEST:
-        break;
-      case wimp_LOSE_CARET:
-        break;
-      case wimp_GAIN_CARET:
-        break;
-      case wimp_POLLWORD_NON_ZERO:
-        break;
-      case wimp_USER_MESSAGE:
-      case wimp_USER_MESSAGE_RECORDED:
-      case wimp_USER_MESSAGE_ACKNOWLEDGE:
-        switch (block.message.action) {
-        case message_QUIT:
-          _quit = true;
-          break;
-        default:
-//          user_message(event, &(block.message));
-          break;
-        }
-        break;
-      }
-    }
-
-    return true;
-}
-
-bool
-RiscosGui::createMenu()
-{
-    GNASH_REPORT_FUNCTION;
-
-    return true;
-}
-
-bool
-RiscosGui::setupEvents()
-{
-  GNASH_REPORT_FUNCTION;
-
-  return true;
-}
-
-/**
- * Creates a window
- *
- * \return true on success, false otherwise
- */
-bool RiscosGui::create_window()
-{
-    wimp_WINDOW(0) window = {
-                { 400, 400, 800, 800 },
-                0, 0,
-                wimp_TOP,
-                wimp_WINDOW_MOVEABLE | wimp_WINDOW_BACK_ICON |
-                wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON |
-                wimp_WINDOW_NEW_FORMAT,
-                wimp_COLOUR_BLACK, wimp_COLOUR_LIGHT_GREY,
-                wimp_COLOUR_BLACK, wimp_COLOUR_WHITE,
-                wimp_COLOUR_DARK_GREY, wimp_COLOUR_DARK_GREY,
-                wimp_COLOUR_CREAM,
-                0,
-                { 0, -81928, 1300, 0 },
-                wimp_ICON_TEXT | wimp_ICON_HCENTRED,
-                0,
-                0,
-                2, 1,
-                { "Gnash" },
-                0
-    };
-    os_error *error;
-
-    error = xwimp_create_window((wimp_window *)&window, &_window);
-    if (error) {
-      log_msg("%s\n", error->errmess);
-      return false;
-    }
-
-    return true;
-}
-
-int
-RiscosGui::valid_coord(int coord, int max)
-{
-       if (coord<0) return 0;
-       else if (coord>=max) return max;
-       return coord;
-}
-
-// end of namespace gnash
-}

Index: gui/ro_glue.h
===================================================================
RCS file: gui/ro_glue.h
diff -N gui/ro_glue.h
--- gui/ro_glue.h       19 Nov 2006 17:39:01 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,45 +0,0 @@
-//
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-//
-
-#include "gnash.h"
-
-namespace gnash
-{
-
-class RiscosGlue
-{
-  public:
-    virtual ~RiscosGlue() { };
-    virtual bool init(int argc, char **argv[]) = 0;
-
-    virtual void prepFramebuffer(void *framebuffer, int width, int height) = 0;
-    virtual render_handler* createRenderHandler() = 0;
-    virtual void setRenderHandlerSize(int /*width*/, int /*height*/) { };
-    virtual void render(int /* x */, int /* y */) = 0;
-    virtual void render(int x, int y, int /*minx*/, int /*miny*/, int 
/*maxx*/, int /*maxy*/)
-                       { render(x, y); };
-//    virtual void configure(GtkWidget *const widget,
-//                           GdkEventConfigure *const event) = 0;
-  protected:
-    void *_framebuffer;
-    int _fbwidth;
-    int _fbheight;
-};
-
-} // namespace gnash

Index: gui/ro_glue_agg.cpp
===================================================================
RCS file: gui/ro_glue_agg.cpp
diff -N gui/ro_glue_agg.cpp
--- gui/ro_glue_agg.cpp 19 Nov 2006 17:39:01 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,164 +0,0 @@
-//
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-//
-
-/* $Id: ro_glue_agg.cpp,v 1.1 2006/11/19 17:39:01 nihilus Exp $ */
-
-#include <cstdio>
-#include <cerrno>
-#include <cstring>
-
-#include "gnash.h"
-#include "log.h"
-#include "render_handler.h"
-#include "render_handler_agg.h"
-#include "ro_glue_agg.h"
-
-namespace gnash
-{
-
-RiscosAggGlue::RiscosAggGlue() :
-       _offscreenbuf(NULL),
-       _offscreenbuf_size(0),
-       _agg_renderer(NULL),
-       _width(0),
-       _height(0),
-       _bpp(0)
-{
-}
-
-RiscosAggGlue::~RiscosAggGlue()
-{
-  free(_offscreenbuf);
-}
-
-bool
-RiscosAggGlue::init(int /*argc*/, char **/*argv*/[])
-{
-  // We only support 32bpp modes
-  _bpp = 24;
-
-  return true;
-}
-
-void
-RiscosAggGlue::prepFramebuffer(void *framebuffer, int width, int height)
-{
-    _framebuffer = framebuffer;
-    _fbwidth = width;
-    _fbheight = height;
-}
-
-render_handler*
-RiscosAggGlue::createRenderHandler()
-{
-  _agg_renderer = create_render_handler_agg("RGB24");
-  return _agg_renderer;
-}
-
-void
-RiscosAggGlue::setRenderHandlerSize(int width, int height)
-{
-  assert(width>0);
-  assert(height>0);
-  assert(_agg_renderer!=NULL);
-
-#define CHUNK_SIZE (100*100*(_bpp/8))
-
-  if (width == _width && height == _height)
-    return;
-
-  int new_bufsize = width*height*(_bpp/8);
-
-  // TODO: At the moment we only increase the buffer and never decrease it.
-  // Should be changed sometime.
-  if (new_bufsize > _offscreenbuf_size) {
-    new_bufsize = static_cast<int>(new_bufsize / CHUNK_SIZE + 1) * CHUNK_SIZE;
-    // TODO: C++ conform alternative to realloc?
-    _offscreenbuf = static_cast<unsigned char *>( realloc(_offscreenbuf, 
new_bufsize) );
-
-    if (!_offscreenbuf) {
-      log_msg("Could not allocate %i bytes for offscreen buffer: %s\n",
-               new_bufsize, strerror(errno) );
-      return;
-    }
-
-    log_msg("RISC OS-AGG: %i bytes offscreen buffer allocated\n", new_bufsize);
-
-    _offscreenbuf_size = new_bufsize;
-    memset(_offscreenbuf, 0, new_bufsize);
-  }
-
-  _width = width;
-  _height = height;
-
-  // Only the AGG renderer has the function init_buffer, which is *not* part
-  // of the renderer api. It allows us to change the renderers movie size
-  // (and buffer address) during run-time.
-  static_cast<render_handler_agg_base *>(_agg_renderer)->init_buffer(
-         _offscreenbuf,
-         _offscreenbuf_size,
-         _width,
-         _height);
-}
-
-void
-RiscosAggGlue::render(int x, int y)
-{
-  // Update the entire screen
-  render(x, y, 0, 0, _width, _height);
-}
-
-void
-RiscosAggGlue::render(int x, int y, int minx, int miny, int maxx, int maxy)
-{
-  // Update only the invalidated rectangle
-  unsigned char *fb = (unsigned char *)_framebuffer;
-  int fbw = _fbwidth * 4; // (((_bpp / 8) + 3) & ~3);
-  int osw = _width * (_bpp / 8);
-
-  for (int row = miny; row < maxy; row++) {
-//    int fbr = row * (((_bpp / 8) + 3) & ~3);
-//    int osr = row * (_bpp / 8);
-
-    for (int col = minx; col < maxx; col++) {
-      int fbc = (col + x) * 4; // (((_bpp / 8) + 3) & ~3);
-      int osc = col * (_bpp / 8);
-
-      fb[(row + y) * fbw + fbc + 0] = _offscreenbuf[row * osw + osc + 0];
-      fb[(row + y) * fbw + fbc + 1] = _offscreenbuf[row * osw + osc + 1];
-      fb[(row + y) * fbw + fbc + 2] = _offscreenbuf[row * osw + osc + 2];
-      fb[(row + y) * fbw + fbc + 3] = 0;
-    }
-  }
-
-}
-
-#if 0
-void
-RiscosAggGlue::configure(GtkWidget *const /*widget*/, GdkEventConfigure *const 
event)
-{
-       if (_agg_renderer)
-               setRenderHandlerSize(event->width, event->height);
-}
-#endif
-
-
-
-} // namespace gnash
-

Index: gui/ro_glue_agg.h
===================================================================
RCS file: gui/ro_glue_agg.h
diff -N gui/ro_glue_agg.h
--- gui/ro_glue_agg.h   19 Nov 2006 17:39:01 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-//
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-//
-
-#include "ro_glue.h"
-
-namespace gnash
-{
-
-class RiscosAggGlue : public RiscosGlue
-{
-  public:
-    RiscosAggGlue();
-    ~RiscosAggGlue();
-
-    bool init(int argc, char **argv[]);
-    void prepFramebuffer(void *framebuffer, int width, int height);
-    render_handler* createRenderHandler();
-    void setRenderHandlerSize(int width, int height);
-    void render(int x, int y);
-    void render(int x, int y, int minx, int miny, int maxx, int maxy);
-//    void configure(GtkWidget *const widget, GdkEventConfigure *const event);
-
-  private:
-    unsigned char *_offscreenbuf;
-    int _offscreenbuf_size;
-    render_handler *_agg_renderer;
-    int _width, _height, _bpp;
-};
-
-} // namespace gnash

Index: gui/rosup.h
===================================================================
RCS file: gui/rosup.h
diff -N gui/rosup.h
--- gui/rosup.h 19 Nov 2006 17:39:01 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,64 +0,0 @@
-#ifndef __ROSUP_H__
-#define __ROSUP_H__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gnash.h"
-#include "tu_config.h"
-
-#include "oslib/colourtrans.h"
-#include "oslib/wimp.h"
-
-#ifdef RENDERER_AGG
-#include "ro_glue_agg.h"
-#endif
-
-#include "gui.h"
-
-namespace gnash
-{
-
-class DSOEXPORT RiscosGui : public Gui
-{
- public:
-    RiscosGui(unsigned long xid, float scale, bool loop, unsigned int depth);
-    virtual ~RiscosGui();
-    virtual bool init(int argc, char **argv[]);
-    virtual bool createWindow(int width, int height);
-    virtual bool createWindow(const char *title, int width, int height);
-    virtual bool run();
-    virtual bool createMenu();
-    virtual bool setupEvents();
-    virtual void renderBuffer();
-    virtual void setInterval(unsigned int interval);
-    virtual void setTimeout(unsigned int timeout);
-    virtual void set_invalidated_region(const rect& bounds);
-
-
- private:
-    bool create_window();
-    int valid_coord(int coord, int max);
-
-    wimp_t _task;
-    wimp_w _window;
-    bool _quit;
-    os_t _timeout;
-
-    int m_draw_minx;
-    int m_draw_miny;
-    int m_draw_maxx;
-    int m_draw_maxy;
-
-    int _screen_height;
-    int _screen_width;
-
-#ifdef RENDERER_AGG
-    RiscosAggGlue glue;
-#endif
-};
-
-}
-
-#endif




reply via email to

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