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: Sun, 19 Nov 2006 17:39:02 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Markus Gothe <nihilus>  06/11/19 17:39:02

Modified files:
        .              : ChangeLog configure.ac 
        gui            : Makefile.am Player.cpp sdl_agg_glue.cpp 
        libbase        : Thread.cpp 
        libltdl        : ltdl.c 
        macros         : pkg.m4 
        server         : shm.cpp shm.h 
        server/parser  : button_character_def.h 
        utilities      : Makefile.am dumpshm.cpp 
Added files:
        gui            : ro.cpp ro_glue.h ro_glue_agg.cpp ro_glue_agg.h 
                         rosup.h 

Log message:
                * configure.ac: Applied patches for RISC OS support. Fixed gui 
                  ro->riscos.
                * gui/Makefile.am gui/Player.cpp gui/sdl_agg_glue.cpp 
        libbase/Thread.cpp 
                libltdl/ltdl.c macros/pkg.m4 server/shm.cpp server/shm.h
                server/parser/button_character_def.h utilities/Makefile.am
                utilities/dumpshm.cpp: Applied patches for RISC OS support.
                * gui/ro.cpp, gui/ro_glue_agg.cpp, gui/ro_glue_agg.h, 
        gui/ro_glue.h,
                  gui/rosup.h: Added RISC OS support.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1664&r2=1.1665
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.191&r2=1.192
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Makefile.am?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl_agg_glue.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro_glue.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro_glue_agg.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/ro_glue_agg.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/rosup.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/Thread.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/libltdl/ltdl.c?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/macros/pkg.m4?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shm.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shm.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/button_character_def.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/Makefile.am?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/dumpshm.cpp?cvsroot=gnash&r1=1.8&r2=1.9

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1664
retrieving revision 1.1665
diff -u -b -r1.1664 -r1.1665
--- ChangeLog   18 Nov 2006 22:42:01 -0000      1.1664
+++ ChangeLog   19 Nov 2006 17:39:00 -0000      1.1665
@@ -1,3 +1,14 @@
+2006-11-18 Markus Gothe <address@hidden>
+
+       * configure.ac: Applied patches for RISC OS support. Fixed gui 
+         ro->riscos.
+       * gui/Makefile.am gui/Player.cpp gui/sdl_agg_glue.cpp 
libbase/Thread.cpp 
+       libltdl/ltdl.c macros/pkg.m4 server/shm.cpp server/shm.h
+       server/parser/button_character_def.h utilities/Makefile.am
+       utilities/dumpshm.cpp: Applied patches for RISC OS support.
+       * gui/ro.cpp, gui/ro_glue_agg.cpp, gui/ro_glue_agg.h, gui/ro_glue.h,
+         gui/rosup.h: Added RISC OS support.
+       
 2006-11-18 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/ming_utils.c: fixed xfail

Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -b -r1.191 -r1.192
--- configure.ac        8 Nov 2006 09:16:17 -0000       1.191
+++ configure.ac        19 Nov 2006 17:39:00 -0000      1.192
@@ -15,7 +15,7 @@
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 dnl  
 
-dnl $Id: configure.ac,v 1.191 2006/11/08 09:16:17 strk Exp $
+dnl $Id: configure.ac,v 1.192 2006/11/19 17:39:00 nihilus Exp $
 
 AC_PREREQ(2.50)
 AC_INIT(gnash, cvs)
@@ -139,6 +139,7 @@
    kde|KDE) gui=kde  ;;
    fb|FB) gui=fb  ;;
    fltk|FLTK) gui=fltk  ;;
+   riscos|RISCOS) gui=riscos ;;
    *)      AC_MSG_ERROR([invalid gui ${enableval} given]) ;;
   esac],
  [gui=gtk]
@@ -180,8 +181,8 @@
 AM_CONDITIONAL(USE_RENDERER_CAIRO, test x$renderer = xcairo)
 
 if test x$renderer = xagg; then
-  if test x"$gui" != xfb -a x"$gui" != xgtk -a x"$gui" != xsdl; then
-    AC_MSG_ERROR([agg renderer is only supported by fb and gtk gui]);
+  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]);
   fi
   AC_DEFINE([RENDERER_AGG], [], [Use AntiGrain renderer])
 fi
@@ -547,6 +548,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)
 
 case "${gui}" in
        gtk)  AC_DEFINE([GUI_GTK],  [1], [Use GTK gui toolkit]) ;;
@@ -554,6 +556,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]) ;;
        *)
 esac
 

Index: gui/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/gui/Makefile.am,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- gui/Makefile.am     10 Nov 2006 23:07:47 -0000      1.44
+++ gui/Makefile.am     19 Nov 2006 17:39:01 -0000      1.45
@@ -17,7 +17,7 @@
 
 # 
 
-# $Id: Makefile.am,v 1.44 2006/11/10 23:07:47 nihilus Exp $
+# $Id: Makefile.am,v 1.45 2006/11/19 17:39:01 nihilus Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -92,9 +92,11 @@
   INCLUDES += $(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
   SDL_AGG_SRCS = sdl_agg_glue.cpp sdl_agg_glue.h
 else
   GTK_AGG_SRCS =
+  RO_AGG_SRCS =
   SDL_AGG_SRCS =
 endif
 
@@ -107,6 +109,13 @@
  GTK_SRCS = 
 endif
 
+if USE_GUI_RO
+ RO_SRCS = ro.cpp rosup.h ro_glue.h $(RO_AGG_SRCS)
+ AM_LDFLAGS += -lOSLib32
+else
+ RO_SRCS =
+endif
+
 if USE_GUI_SDL
  SDL_SRCS = sdl.cpp sdlsup.h sdl_glue.h $(SDL_CAIRO_SRCS) $(SDL_OPENGL_SRCS) 
$(SDL_AGG_SRCS)
 else
@@ -166,6 +175,7 @@
        $(GTK2_SRCS) \
        $(KDE_SRCS) \
        $(FB_SRCS) \
+       $(RO_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.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- gui/Player.cpp      11 Nov 2006 15:25:27 -0000      1.28
+++ gui/Player.cpp      19 Nov 2006 17:39:01 -0000      1.29
@@ -29,6 +29,9 @@
 # elif defined(GUI_SDL)
 #  include "sdlsup.h"
 #  define GUI_CLASS SDLGui
+# elif defined(GUI_RO)
+#  include "rosup.h"
+#  define GUI_CLASS RiscosGui
 # endif
 #else
 # ifdef HAVE_KDE

Index: gui/sdl_agg_glue.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl_agg_glue.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gui/sdl_agg_glue.cpp        11 Nov 2006 15:25:27 -0000      1.7
+++ gui/sdl_agg_glue.cpp        19 Nov 2006 17:39:01 -0000      1.8
@@ -145,6 +145,21 @@
     return true;
 }
 
+void
+SdlAggGlue::render()
+{
+       // Update the entire screen
+       SDL_SetClipRect(_screen, 0);
+       SDL_BlitSurface(_sdl_surface, 0, _screen, 0);
+}
 
+void
+SdlAggGlue::render(int minx, int miny, int maxx, int maxy)
+{
+       // Update only the invalidated rectangle
+       SDL_Rect clip = { minx, miny, maxx - minx, maxy - miny };
+       SDL_SetClipRect(_screen, &clip);
+       SDL_BlitSurface(_sdl_surface, 0, _screen, 0);
+}
 
 } // namespace gnash

Index: libbase/Thread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/Thread.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libbase/Thread.cpp  29 Oct 2006 18:34:11 -0000      1.9
+++ libbase/Thread.cpp  19 Nov 2006 17:39:01 -0000      1.10
@@ -54,9 +54,11 @@
 {
     pthread_attr_init(&_tattr);
 
+#ifndef __riscos__
     if (pthread_attr_setscope(&_tattr, PTHREAD_SCOPE_SYSTEM)) {
         log_msg("Couldn't set thread scope, %s\n", strerror(errno));
     }
+#endif
 
 #if 0
     // on non-Solaris OS, default stack may be too small. This seems
@@ -130,6 +132,7 @@
         log_msg("NONE SPECIFIED\n");
         break;
     }                                                                          
      
+#ifndef __riscos__
     log_msg("The thread schedule policy is \t");
     pthread_attr_getschedpolicy(&_tattr, &val);
     switch (val) {
@@ -177,6 +180,7 @@
         log_msg("NONE SPECIFIE\n");
         break;
     }    
+#endif
 }
 
 /// \brief Setup callback for thread exit

Index: libltdl/ltdl.c
===================================================================
RCS file: /sources/gnash/gnash/libltdl/ltdl.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libltdl/ltdl.c      6 Nov 2006 19:35:06 -0000       1.1
+++ libltdl/ltdl.c      19 Nov 2006 17:39:01 -0000      1.2
@@ -101,6 +101,9 @@
 #else
 #  ifdef LT_USE_WINDOWS_DIRENT_EMULATION
 #    define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name))
+#  elif defined(__riscos__)
+#    include <dirent.h>
+#    define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name))
 #  else
 #    define dirent direct
 #    define LT_D_NAMLEN(dirent) ((dirent)->d_namlen)

Index: macros/pkg.m4
===================================================================
RCS file: /sources/gnash/gnash/macros/pkg.m4,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- macros/pkg.m4       4 Nov 2006 10:14:20 -0000       1.4
+++ macros/pkg.m4       19 Nov 2006 17:39:01 -0000      1.5
@@ -21,7 +21,7 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# $Id: pkg.m4,v 1.4 2006/11/04 10:14:20 nihilus Exp $
+# $Id: pkg.m4,v 1.5 2006/11/19 17:39:01 nihilus Exp $
 
 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
 # ----------------------------------
@@ -44,7 +44,7 @@
        fi
   fi           
 else
-  PKG_CONFIG=""
+  PKG_CONFIG=$ac_cv_env_PKG_CONFIG_value
 fi[]dnl
 
 ])# PKG_PROG_PKG_CONFIG

Index: server/shm.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shm.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/shm.cpp      17 Nov 2006 19:02:20 -0000      1.26
+++ server/shm.cpp      19 Nov 2006 17:39:01 -0000      1.27
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: shm.cpp,v 1.26 2006/11/17 19:02:20 strk Exp $ */
+/* $Id: shm.cpp,v 1.27 2006/11/19 17:39:01 nihilus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -29,11 +29,11 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <fcntl.h>
-#ifndef HAVE_WINSOCK_H
+#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__)
 #include <sys/mman.h>
 #include <sys/shm.h>
 #include <sys/ipc.h>
-#else
+#elif !defined(__riscos__)
 #include <windows.h>
 #include <process.h>
 #include <io.h>
@@ -133,10 +133,14 @@
     _shmfd = shmget(_shmkey, _size, shmflg);
     if (_shmfd < 0 && errno == EEXIST)
 # else
+#  ifdef __riscos__
+    if (0)
+#  else
        _shmhandle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
                                        PAGE_READWRITE, 0,
                                        _size, filespec);
     if (_shmhandle <= 0)
+#  endif
 # endif        // end of HAVE_SHMGET
 #endif // end of HAVE_SHM_OPEN
        {
@@ -152,11 +156,15 @@
        // Get the shared memory id for this segment
        _shmfd = shmget(_shmkey, _size, 0);
 # else
+#  ifdef __riscos__
+        // do nothing, we never get here.
+#  else
        _shmhandle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
                                        PAGE_READWRITE, 0,
                                        _size, filespec);
 # endif
 #endif
+#endif
     }
     
     // MacOSX returns this when you use O_EXCL for shm_open() instead
@@ -164,8 +172,12 @@
 #if defined(HAVE_SHMGET) ||  defined(HAVE_SHM_OPEN)
     if (_shmfd < 0 && errno == EINVAL)
 #else
+# ifdef __riscos__
+    if (0)
+# else
     if (_shmhandle <= 0 && errno == EINVAL)
 #endif
+#endif
        {
        exists = true;
        log_msg(
@@ -187,8 +199,12 @@
 #if defined(HAVE_SHMGET) ||  defined(HAVE_SHM_OPEN)
     if (_shmfd >= 0)
 #else
+# ifdef __riscos__
+    if (1)
+# else
     if (_shmhandle >= 0)
 #endif
+#endif
     {
 #ifdef HAVE_SHM_OPEN
        if (!exists) {
@@ -211,10 +227,18 @@
            return false;
        }
 # else
+#  ifdef __riscos__
+        _addr = (char *)malloc(_size);
+        if (_addr == 0) {
+            log_msg("WARNING: malloc() failed\n");
+            return false;
+        }
+#  else
        _addr = (char *)MapViewOfFile (_shmhandle, FILE_MAP_ALL_ACCESS,
                                       0, 0, _size);
 # endif
 #endif
+#endif
 //     log_msg("The address to the shared memory segment is: %p", _addr);
         if (exists && !nuke) {
            // If there is an existing memory segment that we don't
@@ -260,9 +284,13 @@
        shmdt(_addr);
        _addr = (char *)shmat(_shmfd, (void *)addr, 0);
 # else
+#  ifdef __riscos__
+        _addr = _addr;
+#  else
        CloseHandle(_shmhandle);        
        _addr = (char *)MapViewOfFile (_shmhandle, FILE_MAP_ALL_ACCESS,
                               0, 0, _size);
+#  endif
 # endif // end of HAVE_SHMAT
        }
 #endif // end of HAVE_SHM_OPEN
@@ -408,9 +436,13 @@
 #ifdef HAVE_SHMGET
      shmctl(_shmfd, IPC_RMID, 0);
 #else
+# ifdef __riscos__
+     free(_addr);
+# else
      CloseHandle(_shmhandle);
 #endif
 #endif
+#endif
     
     _addr = 0;
     _alloced = 0;

Index: server/shm.h
===================================================================
RCS file: /sources/gnash/gnash/server/shm.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/shm.h        31 Oct 2006 09:44:55 -0000      1.11
+++ server/shm.h        19 Nov 2006 17:39:01 -0000      1.12
@@ -29,10 +29,10 @@
 
 #include "impl.h"
 #include <sys/types.h>
-#ifndef HAVE_WINSOCK_H
+#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__)
 # include <sys/ipc.h>
 # include <sys/shm.h>
-#else
+#elif !defined(__riscos__)
 # include <windows.h>
 # include <process.h>
 # include <fcntl.h>

Index: server/parser/button_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/button_character_def.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/parser/button_character_def.h        4 Nov 2006 14:29:31 -0000       
1.8
+++ server/parser/button_character_def.h        19 Nov 2006 17:39:01 -0000      
1.9
@@ -14,6 +14,10 @@
 #include "character_def.h"
 #include "sound.h"
 
+#ifndef UNUSED
+#define UNUSED(x) ((x) = (x))
+#endif
+
 // Forward declarations
 namespace gnash {
        class sprite_instance;

Index: utilities/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/utilities/Makefile.am,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- utilities/Makefile.am       13 Nov 2006 10:03:49 -0000      1.38
+++ utilities/Makefile.am       19 Nov 2006 17:39:01 -0000      1.39
@@ -62,13 +62,13 @@
 noinst_PROGRAMS = dumpshm
 
 gparser_SOURCES = parser.cpp
-gparser_LDADD = $(GNASH_LIBS) $(LIBLTDL) "-dlopen" self "-dlopen"
+gparser_LDADD = $(GNASH_LIBS) $(LIBLTDL) "-dlopen" self #"-dlopen"
 gparser_DEPENDENCIES = 
 # export our symbols so they can be used by Gnash plugins
 gparser_LDFLAGS = -export-dynamic
 
 gprocessor_SOURCES = processor.cpp
-gprocessor_LDADD = $(GNASH_LIBS) $(LIBLTDL) "-dlopen" self "-dlopen"
+gprocessor_LDADD = $(GNASH_LIBS) $(LIBLTDL) "-dlopen" self #"-dlopen"
 gprocessor_DEPENDENCIES = 
 # export our symbols so they can be used by Gnash plugins
 gprocessor_LDFLAGS = -export-dynamic

Index: utilities/dumpshm.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/dumpshm.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- utilities/dumpshm.cpp       29 Oct 2006 18:34:51 -0000      1.8
+++ utilities/dumpshm.cpp       19 Nov 2006 17:39:01 -0000      1.9
@@ -19,7 +19,7 @@
 //
 
 
-/* $Id: dumpshm.cpp,v 1.8 2006/10/29 18:34:51 rsavoye Exp $ */
+/* $Id: dumpshm.cpp,v 1.9 2006/11/19 17:39:01 nihilus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -39,11 +39,11 @@
 }
 #include <dirent.h>
 #include <sys/types.h>
-#ifndef HAVE_WINSOCK_H
+#if !defined(HAVE_WINSOCK_H) && !defined(__riscos__)
 #include <sys/mman.h>
 #include <sys/shm.h>
 #include <sys/ipc.h>
-#else
+#elif !defined(__riscos__)
 #include <windows.h>
 #include <process.h>
 #include <io.h>

Index: gui/ro.cpp
===================================================================
RCS file: gui/ro.cpp
diff -N gui/ro.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/ro.cpp  19 Nov 2006 17:39:01 -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/ro_glue.h
===================================================================
RCS file: gui/ro_glue.h
diff -N gui/ro_glue.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/ro_glue.h       19 Nov 2006 17:39:01 -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/ro_glue_agg.cpp
===================================================================
RCS file: gui/ro_glue_agg.cpp
diff -N gui/ro_glue_agg.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/ro_glue_agg.cpp 19 Nov 2006 17:39:01 -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: 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
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/ro_glue_agg.h   19 Nov 2006 17:39:01 -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/rosup.h
===================================================================
RCS file: gui/rosup.h
diff -N gui/rosup.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gui/rosup.h 19 Nov 2006 17:39:01 -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




reply via email to

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