gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10907: Add OpenGL glue for the Qt/K


From: John Wimer
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10907: Add OpenGL glue for the Qt/KDE4 gui.
Date: Fri, 22 May 2009 23:29:17 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 10907
committer: John Wimer <address@hidden>
branch nick: trunk
timestamp: Fri 2009-05-22 23:29:17 +0200
message:
  Add OpenGL glue for the Qt/KDE4 gui.
  The automake probably only works for *nix and should be corrected
added:
  gui/Kde4GlueOgl.cpp
  gui/Kde4GlueOgl.h
modified:
  gui/Kde4Glue.h
  gui/Kde4GlueAgg.cpp
  gui/Kde4Gui.h
  gui/am-frag/kde4.am
  gui/klash4.moc.in
  plugin/klash4/klash_part.moc.in
=== modified file 'gui/Kde4Glue.h'
--- a/gui/Kde4Glue.h    2009-02-25 22:33:03 +0000
+++ b/gui/Kde4Glue.h    2009-05-22 21:29:17 +0000
@@ -40,6 +40,7 @@
     virtual void prepDrawingArea(QWidget *drawing_area) = 0;
     virtual render_handler* createRenderHandler() = 0;
     virtual void render() = 0;
+    virtual void render(const QRect& updateRect) = 0;
     virtual void setInvalidatedRegions(const InvalidatedRanges& /* ranges */) 
{}
     virtual void resize(int, int) {}
     virtual void initBuffer(int, int) {}

=== modified file 'gui/Kde4GlueAgg.cpp'
--- a/gui/Kde4GlueAgg.cpp       2009-02-25 22:33:03 +0000
+++ b/gui/Kde4GlueAgg.cpp       2009-05-22 21:29:17 +0000
@@ -33,7 +33,7 @@
 :
   _width(0),
   _height(0),
-   _renderer(0)
+  _renderer(0)
 {
 }
 

=== added file 'gui/Kde4GlueOgl.cpp'
--- a/gui/Kde4GlueOgl.cpp       1970-01-01 00:00:00 +0000
+++ b/gui/Kde4GlueOgl.cpp       2009-05-22 21:29:17 +0000
@@ -0,0 +1,88 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 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 3 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 "gnashconfig.h"
+#endif
+
+#include "Kde4GlueOgl.h"
+#include "render_handler.h"
+#include "render_handler_agg.h"
+#include <QRect>
+#include <QGLWidget>
+
+namespace gnash
+{
+
+Kde4OglGlue::Kde4OglGlue()
+:
+  _width(0),
+  _height(0),
+  _renderer(0)
+{
+}
+
+Kde4OglGlue::~Kde4OglGlue()
+{
+}
+
+bool
+Kde4OglGlue::init(int /* argc */, char *** /* argv */)
+{
+    return true;
+}
+
+
+void
+Kde4OglGlue::prepDrawingArea(QWidget *drawing_area)
+{
+    assert(drawing_area);
+    _drawing_area = drawing_area;
+    static_cast<QGLWidget*>(_drawing_area)->makeCurrent();
+}
+
+
+void
+Kde4OglGlue::render()
+{
+    assert(_drawing_area);
+    static_cast<QGLWidget*>(_drawing_area)->swapBuffers();
+}
+
+
+void
+Kde4OglGlue::render(const QRect& /*updateRect*/)
+{
+  render();
+}
+
+
+render_handler*
+Kde4OglGlue::createRenderHandler()
+{
+    _renderer = create_render_handler_ogl();
+
+    if ( ! _renderer )
+    {
+        throw GnashException("Could not create OpenGL renderer");
+    }
+    return _renderer;
+}
+
+// end of namespace gnash
+}

=== added file 'gui/Kde4GlueOgl.h'
--- a/gui/Kde4GlueOgl.h 1970-01-01 00:00:00 +0000
+++ b/gui/Kde4GlueOgl.h 2009-05-22 21:29:17 +0000
@@ -0,0 +1,64 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 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 3 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
+
+#ifndef GNASH_KDE4_AGG_GLUE_H
+#define GNASH_KDE4_AGG_GLUE_H
+
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "Kde4Glue.h"
+
+#include <QImage>
+#include <boost/scoped_array.hpp>
+#include <QPainter>
+#include "snappingrange.h"
+
+class QRect;
+
+namespace gnash
+{
+
+class Kde4OglGlue : public Kde4Glue
+{
+  public:
+    Kde4OglGlue();
+    ~Kde4OglGlue();
+    
+    bool init(int argc, char **argv[]);
+    void prepDrawingArea(QWidget *drawing_area);
+    render_handler* createRenderHandler();
+    void render();
+    void render(const QRect& updateRect);
+
+  private:
+    int _width;
+    int _height;
+    boost::scoped_array<unsigned char> _offscreenbuf;
+    render_handler* _renderer; // We don't own this pointer.
+    std::auto_ptr<QImage> _image;
+    std::auto_ptr<QPainter> _painter;
+};
+
+
+
+
+}
+
+#endif

=== modified file 'gui/Kde4Gui.h'
--- a/gui/Kde4Gui.h     2009-04-13 15:08:49 +0000
+++ b/gui/Kde4Gui.h     2009-05-22 21:29:17 +0000
@@ -29,11 +29,16 @@
 #include <QDialog>
 
 #ifdef RENDERER_OPENGL
-# error "OGL not supported yet for KDE4!"
+# include "Kde4GlueOgl.h"
+# include <QGLWidget>
+# define BaseWidget QGLWidget
+# define GlueClass Kde4OglGlue
 #elif defined(RENDERER_CAIRO)
 # error "Cairo not supported yet for KDE4!"
 #elif defined(RENDERER_AGG)
 # include "Kde4GlueAgg.h"
+# define BaseWidget QWidget
+# define GlueClass Kde4AggGlue
 #endif
 
 
@@ -54,7 +59,7 @@
 namespace gnash
 {
 
-class DrawingWidget : public QWidget
+class DrawingWidget : public BaseWidget
 {
     Q_OBJECT
 
@@ -176,7 +181,7 @@
     DrawingWidget* _drawingWidget;
     
     /// Takes care of painting onto the widget.
-    Kde4AggGlue _glue;
+    GlueClass _glue;
     
     /// The main application window.
     std::auto_ptr<QMainWindow> _window;

=== modified file 'gui/am-frag/kde4.am'
--- a/gui/am-frag/kde4.am       2009-02-25 22:33:03 +0000
+++ b/gui/am-frag/kde4.am       2009-05-22 21:29:17 +0000
@@ -38,6 +38,14 @@
 kde4_gnash_LDFLAGS = $(LIBLTDL) -export-dynamic 
 kde4_gnash_LDADD = $(MYSQL_LIBS) $(GNASH_LIBS) $(AM_LDFLAGS) $(KDE4_LIBS)
 
+if BUILD_OGL_RENDERER
+kde4_gnash_CPPFLAGS += $(OPENGL_CFLAGS)
+kde4_gnash_LDADD += $(top_builddir)/backend/libgnashogl.la \
+       $(QT4_LIBS) $(OGL_LIBS) -lQtOpenGL
+kde4_gnash_SOURCES += Kde4GlueOgl.cpp Kde4GlueOgl.h \
+               Kde4Gui.cpp Kde4Gui.h Kde4Glue.h
+endif                           # BUILD_OGL_RENDERER
+
 if BUILD_AGG_RENDERER
 kde4_gnash_CPPFLAGS += $(AGG_CFLAGS)
 kde4_gnash_LDADD += $(top_builddir)/backend/libgnashagg.la \

=== modified file 'gui/klash4.moc.in'
--- a/gui/klash4.moc.in 2009-04-13 15:08:49 +0000
+++ b/gui/klash4.moc.in 2009-05-22 21:29:17 +0000
@@ -1,7 +1,7 @@
 /****************************************************************************
 ** Meta object code from reading C++ file 'Kde4Gui.h'
 **
-** Created: Sun Apr 12 21:07:39 2009
+** Created: Fri May 22 20:44:55 2009
 **      by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
 **
 ** WARNING! All changes made in this file will be lost!
@@ -47,7 +47,7 @@
 };
 
 const QMetaObject gnash::DrawingWidget::staticMetaObject = {
-    { &QWidget::staticMetaObject, qt_meta_stringdata_gnash__DrawingWidget,
+    { &BaseWidget::staticMetaObject, qt_meta_stringdata_gnash__DrawingWidget,
       qt_meta_data_gnash__DrawingWidget, 0 }
 };
 
@@ -61,12 +61,12 @@
     if (!_clname) return 0;
     if (!strcmp(_clname, qt_meta_stringdata_gnash__DrawingWidget))
         return static_cast<void*>(const_cast< DrawingWidget*>(this));
-    return QWidget::qt_metacast(_clname);
+    return BaseWidget::qt_metacast(_clname);
 }
 
 int gnash::DrawingWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
 {
-    _id = QWidget::qt_metacall(_c, _id, _a);
+    _id = BaseWidget::qt_metacall(_c, _id, _a);
     if (_id < 0)
         return _id;
     if (_c == QMetaObject::InvokeMetaMethod) {

=== modified file 'plugin/klash4/klash_part.moc.in'
--- a/plugin/klash4/klash_part.moc.in   2009-03-17 12:01:42 +0000
+++ b/plugin/klash4/klash_part.moc.in   2009-05-22 21:29:17 +0000
@@ -1,13 +1,13 @@
 /****************************************************************************
 ** Meta object code from reading C++ file 'klash_part.h'
 **
-** Created: Tue Mar 17 12:54:45 2009
+** Created: Fri May 22 22:24:03 2009
 **      by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
 **
 ** WARNING! All changes made in this file will be lost!
 *****************************************************************************/
 
-#include "../../../../work/plugin/klash4/klash_part.h"
+#include "klash_part.h"
 #if !defined(Q_MOC_OUTPUT_REVISION)
 #error "The header file 'klash_part.h' doesn't include <QObject>."
 #elif Q_MOC_OUTPUT_REVISION != 59


reply via email to

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