Gnash  0.8.11dev
GnashDevice.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010. 2011, 2012
3 // Free Software 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 #ifndef __GNASH_DEVICE_H__
21 #define __GNASH_DEVICE_H__ 1
22 
23 #ifdef HAVE_CONFIG_H
24 #include "gnashconfig.h"
25 #endif
26 
27 #include <cstdint>
28 #include "log.h"
29 
35 namespace gnash {
36 
37 namespace renderer {
38 
40 {
43  typedef long native_window_t;
44 
48  typedef enum {GNASH_NODEV, EGL, DIRECTFB, X11, RAWFB} dtype_t;
49 
50  GnashDevice(int argc, char *argv[]);
51  GnashDevice() { };
52 
53  virtual ~GnashDevice() { };
54 
58  virtual dtype_t getType() = 0;
59 
62  virtual bool initDevice(int argc, char *argv[]) = 0;
63 
66  virtual bool attachWindow(native_window_t window) = 0;
67 
68  // Utility methods not in the base class
69 
71  virtual const char *getErrorString(int error) = 0;
72 
74  // int queryGNASHConfig() { return queryGNASHConfig(_gnashDisplay); };
75  // int queryGNASHConfig(GNASHDisplay display);
76 
78  virtual size_t getStride() = 0;
79 
81  virtual size_t getWidth() = 0;
82 
84  virtual size_t getHeight() = 0;
85 
87  virtual int getDepth() = 0;
88 
90  virtual int getRedSize() = 0;
91 
93  virtual int getGreenSize() = 0;
94 
96  virtual int getBlueSize() = 0;
97 
99  virtual bool isSingleBuffered() = 0;
100 
102  virtual bool isBufferDestroyed() = 0;
103 
105  virtual int getID() = 0;
106 
108  virtual bool supportsRenderer(rtype_t rtype) = 0;
109 
111  virtual bool isNativeRender() = 0;
112 
113  // These are only used for the Framebuffer
114 
116  virtual std::uint8_t *getFBMemory() { return nullptr; };
117 
119  virtual std::uint8_t *getOffscreenBuffer() { return nullptr; };
120 
121  virtual size_t getFBMemSize() { return 0; };
122 
123  // bindClient() is used by OpenVG, OpenGLES1, and OpenGLES2
124  // to bind the client type to the EGL surface. This method
125  // is unused by the RawFB, DirectFB, and X11 Devices.
126  virtual bool bindClient(GnashDevice::rtype_t) { return false; };
127 
128  virtual bool swapBuffers() {
130  return false;
131  };
132 };
133 
134 } // namespace renderer
135 } // namespace gnash
136 
137 #endif // end of __GNASH_DEVICE_H__
138 
139 // local Variables:
140 // mode: C++
141 // indent-tabs-mode: nil
142 // End:
virtual const char * getErrorString(int error)=0
Return a string with the error code as text, instead of a numeric value.
virtual int getBlueSize()=0
Get the size of the Blue pixel.
Definition: GnashDevice.h:48
Definition: GnashDevice.h:48
Definition: GnashDevice.h:46
virtual dtype_t getType()=0
virtual std::uint8_t * getOffscreenBuffer()
Get the memory from an offscreen buffer to support Double Buffering.
Definition: GnashDevice.h:119
virtual ~GnashDevice()
Definition: GnashDevice.h:53
virtual size_t getWidth()=0
Get the width of the device.
virtual int getRedSize()=0
Get the size of the Red pixel.
long native_window_t
Definition: GnashDevice.h:43
Definition: GnashDevice.h:46
Definition: GnashDevice.h:48
Definition: GnashDevice.h:39
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
dtype_t
The list of supported device types.
Definition: GnashDevice.h:48
virtual bool isBufferDestroyed()=0
Are buffers destroyed ?
Definition: GnashDevice.h:46
virtual size_t getFBMemSize()
Definition: GnashDevice.h:121
virtual bool isNativeRender()=0
Is this renderering natively.
Definition: GnashDevice.h:48
virtual bool supportsRenderer(rtype_t rtype)=0
Is the specified renderer supported by this hardware ?
virtual bool attachWindow(native_window_t window)=0
Definition: GnashDevice.h:46
virtual size_t getHeight()=0
Get the Height of the device.
Definition: GnashDevice.h:46
virtual bool isSingleBuffered()=0
Is this device single buffered.
virtual int getID()=0
Get the window ID handle.
rtype_t
The list of supported renders that use devices.
Definition: GnashDevice.h:46
Definition: GnashDevice.h:48
GnashDevice()
Definition: GnashDevice.h:51
Definition: GnashDevice.h:46
virtual size_t getStride()=0
Query the system for all supported configs.
virtual bool swapBuffers()
Definition: GnashDevice.h:128
#define GNASH_REPORT_FUNCTION
Definition: log.h:452
virtual int getGreenSize()=0
Get the size of the Green pixel.
virtual std::uint8_t * getFBMemory()
Get the memory from the real framebuffer.
Definition: GnashDevice.h:116
virtual bool initDevice(int argc, char *argv[])=0
virtual int getDepth()=0
Get the depth of the device.
virtual bool bindClient(GnashDevice::rtype_t)
Definition: GnashDevice.h:126