[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu... |
Date: |
Sat, 09 Jun 2007 19:42:06 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 07/06/09 19:42:05
Modified files:
. : ChangeLog configure.ac
gui : Makefile.am kde.cpp kde_glue.h
kde_glue_opengl.cpp kdesup.h
Added files:
gui : kde_glue_agg.cpp kde_glue_agg.h
Log message:
* configure.ac: Allow the KDE GUI to be compiled against AGG.
* gui/Makefile.am: Compile KDE/AGG files when requested.
* gui/kde.cpp: Make the KDE GUI compatible with AGG by moving
OpenGL-specific code into its respective glue. Also fix mouse
movement in combination with scaling.
* gui/kde_glue.h: Add stubs for AGG compatibility.
* gui/kde_glue_opengl.cpp: run makeCurrent in the glue.
* gui/kdesup.h: Allow the AGG glue to be used.
* gui/kde_glue_agg{.cpp, .h}: Initial implementation of AGG
glue for QT/KDE.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3504&r2=1.3505
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.336&r2=1.337
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Makefile.am?cvsroot=gnash&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde_glue.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde_glue_opengl.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kdesup.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde_glue_agg.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde_glue_agg.h?cvsroot=gnash&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3504
retrieving revision 1.3505
diff -u -b -r1.3504 -r1.3505
--- ChangeLog 9 Jun 2007 12:43:37 -0000 1.3504
+++ ChangeLog 9 Jun 2007 19:42:04 -0000 1.3505
@@ -1,3 +1,16 @@
+2007-06-09 Bastiaan Jacques <address@hidden>
+
+ * configure.ac: Allow the KDE GUI to be compiled against AGG.
+ * gui/Makefile.am: Compile KDE/AGG files when requested.
+ * gui/kde.cpp: Make the KDE GUI compatible with AGG by moving
+ OpenGL-specific code into its respective glue. Also fix mouse
+ movement in combination with scaling.
+ * gui/kde_glue.h: Add stubs for AGG compatibility.
+ * gui/kde_glue_opengl.cpp: run makeCurrent in the glue.
+ * gui/kdesup.h: Allow the AGG glue to be used.
+ * gui/kde_glue_agg{.cpp, .h}: Initial implementation of AGG
+ glue for QT/KDE.
+
2007-06-09 Sandro Santilli <address@hidden>
* libbase/embedVideoDecoderFfmpeg.cpp (decodeFrame): do not
Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -b -r1.336 -r1.337
--- configure.ac 7 Jun 2007 15:42:19 -0000 1.336
+++ configure.ac 9 Jun 2007 19:42:05 -0000 1.337
@@ -15,7 +15,7 @@
dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
dnl
-dnl $Id: configure.ac,v 1.336 2007/06/07 15:42:19 strk Exp $
+dnl $Id: configure.ac,v 1.337 2007/06/09 19:42:05 bjacques Exp $
AC_PREREQ(2.50)
AC_INIT(gnash, cvs)
@@ -252,8 +252,9 @@
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 -a x"$gui" !=
xriscos -a x"$gui" != xfltk; then
- AC_MSG_ERROR([agg renderer is only supported by fb, gtk, riscos, sdl and
fltk GUIs]);
+ if test x"$gui" != xfb -a x"$gui" != xgtk -a x"$gui" != xsdl -a x"$gui" !=
xriscos -a x"$gui" != xfltk
+ -a x"$gui" != xkde; then
+ AC_MSG_ERROR([agg renderer is only supported by fb, gtk, riscos, sdl, fltk
and kde GUIs]);
fi
AC_DEFINE([RENDERER_AGG], [], [Use AntiGrain renderer])
fi
Index: gui/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/gui/Makefile.am,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- gui/Makefile.am 7 Jun 2007 15:42:19 -0000 1.76
+++ gui/Makefile.am 9 Jun 2007 19:42:05 -0000 1.77
@@ -17,7 +17,7 @@
#
-# $Id: Makefile.am,v 1.76 2007/06/07 15:42:19 strk Exp $
+# $Id: Makefile.am,v 1.77 2007/06/09 19:42:05 bjacques Exp $
AUTOMAKE_OPTIONS =
localedir = $(datadir)/locale
@@ -121,11 +121,13 @@
RISCOS_AGG_SRCS = riscos_glue_agg.cpp riscos_glue_agg.h
SDL_AGG_SRCS = sdl_agg_glue.cpp sdl_agg_glue.h
FLTK_AGG_SRCS = fltk_glue_agg.cpp fltk_glue_agg.h
+ KDE_AGG_SRCS = kde_glue_agg.cpp kde_glue_agg.h
else
GTK_AGG_SRCS =
RISCOS_AGG_SRCS =
SDL_AGG_SRCS =
FLTK_AGG_SRCS =
+ KDE_AGG_SRCS =
endif
if USE_GUI_GTK
@@ -157,8 +159,9 @@
endif
if USE_GUI_KDE
- KDE_SRCS = kde.cpp kdesup.h kde_glue.h $(KDE_CAIRO_SRCS) $(KDE_OPENGL_SRCS)
- AM_CPPFLAGS += -I$(kde_includes)/kio $(all_includes)
+ KDE_SRCS = kde.cpp kdesup.h kde_glue.h $(KDE_CAIRO_SRCS) $(KDE_OPENGL_SRCS)
$(KDE_AGG_SRCS)
+ AM_CPPFLAGS += $(KDE_CFLAGS) $(QT_CFLAGS)
+ AM_LDFLAGS += $(KDE_LIBS) $(QT_LIBS)
else
KDE_SRCS =
endif
Index: gui/kde.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/kde.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- gui/kde.cpp 14 May 2007 09:44:21 -0000 1.14
+++ gui/kde.cpp 9 Jun 2007 19:42:05 -0000 1.15
@@ -22,12 +22,14 @@
#endif
-#include <qgl.h>
#include <qtimer.h>
#include <qwidget.h>
#include <qmessagebox.h>
#include <qcursor.h>
#include <qxembed.h>
+#include <qnamespace.h>
+
+#include "Range2d.h"
#include "gnash.h"
#include "movie_definition.h"
@@ -77,20 +79,22 @@
}
bool
-KdeGui::createWindow(const char* /*windowtitle*/, int width, int height)
+KdeGui::createWindow(const char* windowtitle, int width, int height)
{
GNASH_REPORT_FUNCTION;
- _qwidget->makeCurrent();
_qwidget->setGeometry(0, 0, width, height);
+ _qwidget->setCaption(windowtitle);
+
_qapp->setMainWidget(_qwidget);
_qwidget->show();
_glue.prepDrawingArea(_qwidget);
+ _renderer = _glue.createRenderHandler();
+ _glue.initBuffer(width, height);
_width = width;
_height = height;
- _renderer = _glue.createRenderHandler();
set_render_handler(_renderer);
return true;
@@ -103,6 +107,13 @@
_glue.render();
}
+
+void
+KdeGui::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+ _glue.setInvalidatedRegions(ranges);
+}
+
void
KdeGui::setTimeout(unsigned int timeout)
{
@@ -241,6 +252,13 @@
notify_key_event(c, mod, down);
}
+void
+KdeGui::resize(int width, int height)
+{
+ _glue.resize(width, height);
+ resize_view(width, height);
+}
+
/// \brief restart the movie from the beginning
void
@@ -332,11 +350,13 @@
assert(_godfather);
QPoint position = event->pos();
- _godfather->notify_mouse_moved(position.x(), position.y());
+ float xscale = _godfather->getXScale();
+ float yscale = _godfather->getYScale();
+
+ _godfather->notify_mouse_moved(position.x() / xscale, position.y() /
yscale);
}
qwidget::qwidget(KdeGui* godfather)
- : QGLWidget(0, "hi")
{
_qmenu.insertItem(_("Play Movie"), this, SLOT(menuitem_play_callback()));
_qmenu.insertItem(_("Pause Movie"), this, SLOT(menuitem_pause_callback()));
@@ -400,8 +420,25 @@
void
qwidget::resizeEvent(QResizeEvent *event)
{
- _godfather->resize_view(int(event->size().width()),
int(event->size().height()));
+ _godfather->resize(event->size().width(), event->size().height());
+}
+
+void
+qwidget::paintEvent(QPaintEvent *event)
+{
+ const QRegion& region = event->region();
+ QRect rect = region.boundingRect();
+
+ geometry::Range2d<int> range(PIXELS_TO_TWIPS(rect.x()-1),
+ PIXELS_TO_TWIPS(rect.y()-1),
+ PIXELS_TO_TWIPS(rect.right()+1),
+ PIXELS_TO_TWIPS(rect.bottom()+1));
+ InvalidatedRanges ranges;
+ ranges.add(range);
+
+ _godfather->setInvalidatedRegions(ranges);
+ _godfather->renderBuffer();
}
// end of namespace gnash
Index: gui/kde_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/kde_glue.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- gui/kde_glue.h 28 May 2007 15:41:00 -0000 1.11
+++ gui/kde_glue.h 9 Jun 2007 19:42:05 -0000 1.12
@@ -19,11 +19,12 @@
//
-/* $Id: kde_glue.h,v 1.11 2007/05/28 15:41:00 ann Exp $ */
+/* $Id: kde_glue.h,v 1.12 2007/06/09 19:42:05 bjacques Exp $ */
#include "gnash.h"
#include <qwidget.h>
+#include "snappingrange.h"
namespace gnash
{
@@ -31,12 +32,16 @@
class KdeGlue
{
public:
- virtual ~KdeGlue() { };
+ KdeGlue() : _drawing_area(NULL) {}
+ virtual ~KdeGlue() { }
virtual bool init(int argc, char **argv[]) = 0;
virtual void prepDrawingArea(QWidget *drawing_area) = 0;
virtual render_handler* createRenderHandler() = 0;
virtual void render() = 0;
+ virtual void setInvalidatedRegions(const InvalidatedRanges& /* ranges */)
{}
+ virtual void resize(int, int) {}
+ virtual void initBuffer(int, int) {}
protected:
QWidget *_drawing_area;
};
Index: gui/kde_glue_opengl.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/kde_glue_opengl.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- gui/kde_glue_opengl.cpp 28 May 2007 15:41:00 -0000 1.10
+++ gui/kde_glue_opengl.cpp 9 Jun 2007 19:42:05 -0000 1.11
@@ -18,7 +18,7 @@
//
//
-/* $Id: kde_glue_opengl.cpp,v 1.10 2007/05/28 15:41:00 ann Exp $ */
+/* $Id: kde_glue_opengl.cpp,v 1.11 2007/06/09 19:42:05 bjacques Exp $ */
#include "kde_glue_opengl.h"
#include "tu_opengl_includes.h"
@@ -58,6 +58,7 @@
KdeOpenGLGlue::prepDrawingArea(QWidget *drawing_area)
{
// GNASH_REPORT_FUNCTION;
+ static_cast<QGLWidget*>(drawing_area)->makeCurrent();
_drawing_area = drawing_area;
}
Index: gui/kdesup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/kdesup.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- gui/kdesup.h 28 May 2007 15:41:00 -0000 1.17
+++ gui/kdesup.h 9 Jun 2007 19:42:05 -0000 1.18
@@ -52,15 +52,27 @@
// #include <cairo.h>
// #include "kde_glue_cairo.h"
# error "Cairo not supported yet for KDE!"
+#elif defined(RENDERER_AGG)
+# include "kde_glue_agg.h"
#endif
+
+#ifdef RENDERER_OPENGL
+#define WIDGETCLASS QGLWidget
+#define GLUE KdeOpenGLGlue
+#else
+#define WIDGETCLASS QWidget
+#define GLUE KdeAggGlue
+#endif
+
+
namespace gnash
{
class KdeGui;
-class DSOEXPORT qwidget : public QGLWidget
+class DSOEXPORT qwidget : public WIDGETCLASS
{
Q_OBJECT
public:
@@ -75,6 +87,7 @@
void keyReleaseEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *);
void resizeEvent(QResizeEvent *event);
+ void paintEvent (QPaintEvent *event);
public slots:
void menuitem_restart_callback();
void menuitem_quit_callback();
@@ -106,10 +119,12 @@
virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
virtual void handleKeyEvent(QKeyEvent *event, bool down);
+ void setInvalidatedRegions(const InvalidatedRanges& ranges);
+ void resize(int width, int height);
private:
QApplication* _qapp;
qwidget* _qwidget;
- KdeOpenGLGlue _glue;
+ GLUE _glue;
QTimer *_timer;
Index: gui/kde_glue_agg.cpp
===================================================================
RCS file: gui/kde_glue_agg.cpp
diff -N gui/kde_glue_agg.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gui/kde_glue_agg.cpp 9 Jun 2007 19:42:05 -0000 1.1
@@ -0,0 +1,158 @@
+//
+// Copyright (C) 2005, 2006, 2007 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: kde_glue_agg.cpp,v 1.1 2007/06/09 19:42:05 bjacques Exp $ */
+
+#include "kde_glue_agg.h"
+#include "render_handler.h"
+#include "render_handler_agg.h"
+#include <qpixmap.h>
+#include <qcolor.h>
+
+namespace gnash
+{
+
+KdeAggGlue::KdeAggGlue()
+: _offscreenbuf(NULL),
+ _renderer(NULL),
+ _width(0),
+ _height(0)
+{
+}
+
+KdeAggGlue::~KdeAggGlue()
+{
+}
+
+bool
+KdeAggGlue::init(int /* argc */, char *** /* argv */)
+{
+// GNASH_REPORT_FUNCTION;
+
+ return true;
+}
+
+
+void
+KdeAggGlue::prepDrawingArea(QWidget *drawing_area)
+{
+// GNASH_REPORT_FUNCTION;
+ _drawing_area = drawing_area;
+}
+
+
+void
+KdeAggGlue::initBuffer(int width, int height)
+{
+ assert(_renderer);
+
+ int _bpp = 32;
+ int depth_bytes = _bpp / 8;
+
+ assert(_bpp % 8 == 0);
+
+#define CHUNK_SIZE (100 * 100 * depth_bytes)
+
+ int bufsize = (width * height * depth_bytes / CHUNK_SIZE + 1) * CHUNK_SIZE;
+
+ _offscreenbuf = new unsigned char[bufsize];
+
+ // 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.
+ render_handler_agg_base * renderer =
+ static_cast<render_handler_agg_base *>(_renderer);
+ renderer->init_buffer(_offscreenbuf, bufsize, width, height);
+
+ _width = width;
+ _height = height;
+
+ _validbounds.setTo(0, 0, _width, _height);
+ _drawbounds.push_back(_validbounds);
+
+ _qimage.reset(new QImage(_offscreenbuf, _width, _height, 32 /* bits per
pixel */,
+ 0 , 0, QImage::IgnoreEndian));
+}
+
+void
+KdeAggGlue::render()
+{
+ // In order to use our buffer in QT, we must copy it into a pixmap. This is
+ // an expensive operation, but, as far as I can see, the only way to do it.
+ QPixmap qpixmap(*_qimage);
+
+ for (unsigned bno=0; bno < _drawbounds.size(); bno++) {
+ geometry::Range2d<int>& bounds = _drawbounds[bno];
+
+ assert ( bounds.isFinite() );
+
+ QPoint dest_point(bounds.getMinX(), bounds.getMinY()) ;
+ QRect src_rect(bounds.getMinX(), bounds.getMinY(), bounds.width(),
+ bounds.height());
+
+ bitBlt (_drawing_area, dest_point, &qpixmap, src_rect, Qt::CopyROP,
+ true /* ignore mask */ );
+ }
+}
+
+void
+KdeAggGlue::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+ _renderer->set_invalidated_regions(ranges);
+
+ _drawbounds.clear();
+
+ for (size_t rno=0; rno<ranges.size(); rno++) {
+
+ geometry::Range2d<int> bounds = Intersection(
+ _renderer->world_to_pixel(ranges.getRange(rno)),
+ _validbounds);
+
+ // it may happen that a particular range is out of the screen, which
+ // will lead to bounds==null.
+ if (bounds.isNull()) continue;
+
+ assert(bounds.isFinite());
+
+ _drawbounds.push_back(bounds);
+
+ }
+}
+
+
+render_handler*
+KdeAggGlue::createRenderHandler()
+{
+ // QT requires the use of this pixel format...
+ _renderer = create_render_handler_agg("BGRA32");
+ return _renderer;
+}
+
+void
+KdeAggGlue::resize(int width, int height)
+{
+ if (!_offscreenbuf) {
+ // If initialisation has not taken place yet, we don't want to touch
this.
+ return;
+ }
+
+ delete [] _offscreenbuf;
+ initBuffer(width, height);
+}
+
+// end of namespace gnash
+}
Index: gui/kde_glue_agg.h
===================================================================
RCS file: gui/kde_glue_agg.h
diff -N gui/kde_glue_agg.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gui/kde_glue_agg.h 9 Jun 2007 19:42:05 -0000 1.1
@@ -0,0 +1,52 @@
+//
+// Copyright (C) 2005, 2006, 2007 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 "kde_glue.h"
+#include <qimage.h>
+
+
+namespace gnash
+{
+
+class KdeAggGlue : public KdeGlue
+{
+ public:
+ KdeAggGlue();
+ ~KdeAggGlue();
+
+ bool init(int argc, char **argv[]);
+ void prepDrawingArea(QWidget *drawing_area);
+ render_handler* createRenderHandler();
+ void initBuffer(int width, int height);
+ void resize(int width, int height);
+ void render();
+ void setInvalidatedRegions(const InvalidatedRanges& ranges);
+
+ private:
+ int _width;
+ int _height;
+ unsigned char* _offscreenbuf;
+ render_handler* _renderer;
+ geometry::Range2d<int> _validbounds;
+ std::vector< geometry::Range2d<int> > _drawbounds;
+ std::auto_ptr<QImage> _qimage;
+};
+
+
+
+
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog configure.ac gui/Makefile.am gu...,
Bastiaan Jacques <=