Gnash  0.8.11dev
gtk_glue_ovg.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 
20 #ifdef HAVE_CONFIG_H
21 #include "gnashconfig.h"
22 #endif
23 
24 #include "gtk_glue.h"
25 
26 #include <gtk/gtk.h>
27 #include <gdk/gdk.h>
28 #include <boost/scoped_array.hpp>
29 #include <boost/scoped_ptr.hpp>
30 #include "openvg/OpenVGRenderer.h"
31 
32 #ifdef HAVE_VG_OPENVG_H
33 #include <VG/openvg.h>
34 #endif
35 
36 #ifdef HAVE_EGL_EGL_H
37 # include <EGL/egl.h>
38 #else
39 # error "This file needs EGL, which is part of OpenGL-ES"
40 #endif
41 
42 namespace gnash {
43 
44 namespace gui {
45 
46 class GtkOvgGlue : public GtkGlue
47 {
48  public:
49  GtkOvgGlue();
50  ~GtkOvgGlue();
51 
52  // Initialize EGL
53  bool init(int argc, char **argv[]);
54 
55  // Prepare the drawing area
56  void prepDrawingArea(GtkWidget *drawing_area);
57 
58  // Create the renderer
60 
61  // Set the size of the rendering window
62  void setRenderHandlerSize(int width, int height);
63  void beforeRendering();
64 
65  void configure(GtkWidget *const widget, GdkEventConfigure *const event);
66 
67  // Render the drawing area to the display
68  void render();
69  void render(int minx, int miny, int maxx, int maxy);
70 
71  private:
72  // offscreenbuf is only used with ENABLE_EGL_OFFSCREEN
73  GdkImage *_offscreenbuf;
74  unsigned int _bpp;
75  unsigned int _width;
76  unsigned int _height;
77 
78  boost::shared_ptr<renderer::openvg::Renderer_ovg> _renderer;
79 };
80 
81 } // namespace gui
82 } // namespace gnash
83 
84 // local Variables:
85 // mode: C++
86 // indent-tabs-mode: nil
87 // End: