Gnash  0.8.11dev
DirectFBDevice.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 __DIRECTFB_DEVICE_H__
21 #define __DIRECTFB_DEVICE_H__ 1
22 
23 #ifdef HAVE_CONFIG_H
24 #include "gnashconfig.h"
25 #endif
26 
27 #include <memory>
28 
29 #ifdef HAVE_DIRECTFB_H
30 # include <directfb/directfb.h>
31 #else
32 # error "This file needs DirectFB"
33 #endif
34 
35 #include "GnashDevice.h"
36 
37 namespace gnash {
38 
39 namespace renderer {
40 
41 namespace directfb {
42 
44 {
45  public:
47  DirectFBDevice(int argc, char *argv[]);
48 
50 
51  dtype_t getType() { return DIRECTFB; };
52 
53  // Initialize DirectFB Device layer
54  bool initDevice(int argc, char *argv[]);
55 
56  // Initialize DirectFB Window layer
57  // bool initDirectFB(DirectFBNativeWindowType window);
59 
60  // Utility methods not in the base class
62  const char *getErrorString(int error);
63 
64  // Accessors for the settings needed by higher level code.
65  // Surface accessors
66  size_t getWidth() {
67  return getWidth(_surface);
68  }
69 
70  size_t getHeight() {
71  return getHeight(_surface);
72  }
73 
74  int getDepth() {
75  DFBSurfacePixelFormat format;
76  if (_surface) {
77  _surface->GetPixelFormat(_surface, &format);
78  return getDepth(format);
79  }
80  return 0;
81  }
82 
83  int getRedSize() {
84  return 0;
85  };
86  int getGreenSize() {
87  return 0;
88  };
89  int getBlueSize() {
90  return 0;
91  };
92 
94  if (_surface) {
95  DFBSurfaceCapabilities caps;
96  _surface->GetCapabilities(_surface, &caps);
97  if (caps & DSCAPS_DOUBLE) {
98  return false;
99  }
100  }
101  return true;
102  }
103 
104  int getID() {
105  return static_cast<int>(getSurfaceID());
106  }
107 
109  // return isBufferDestroyed(_directfbSurface);
110  return false;
111  }
112 
113  int getSurfaceID() {
114  if (_layer) {
115  DFBDisplayLayerID id;
116  _screen->GetID(_screen, &id);
117  return static_cast<int>(id);
118  }
119  return 0;
120  }
121 
122  virtual bool supportsRenderer(rtype_t /* rtype */) { return true; };
123 
124  // Overload some of the base class methods to deal with Device specific
125  // data types.
126  int getDepth(DFBSurfacePixelFormat format);
127 
128  size_t getWidth(IDirectFBSurface *surface) {
129  int x, y;
130  if (surface) {
131  surface->GetSize(surface, &x, &y);
132  return static_cast<size_t>(x);
133  }
134  return 0;
135  };
136  size_t getHeight(IDirectFBSurface *surface) {
137  int x, y;
138  if (surface) {
139  surface->GetSize(surface, &x, &y);
140  return static_cast<size_t>(y);
141  }
142  return 0;
143  }
145  if (_surface) {
146  DFBSurfaceCapabilities caps;
147  _surface->GetCapabilities(_surface, &caps);
148  if (caps & DSCAPS_DOUBLE) {
149  return true;
150  }
151  return false;
152  }
153  }
154  // Context accessors
155  int getContextID() {
156  if (_layer) {
157  DFBDisplayLayerID id;
158  _layer->GetID(_layer, &id);
159  return static_cast<int>(id);
160  }
161  return 0;
162  }
163 
165  if (_layer) {
166  DFBDisplayLayerConfig config;
167  _layer->GetConfiguration(_layer, &config);
168  if (config.buffermode & DLBM_FRONTONLY) {
169  return true;
170  }
171  return false;
172  }
173  return false;
174  }
176  if (_layer) {
177  DFBDisplayLayerConfig config;
178  _layer->GetConfiguration(_layer, &config);
179  if (config.buffermode & DLBM_FRONTONLY) {
180  return false;
181  }
182  return true;
183  }
184  return true;
185  }
186 
187  bool isNativeRender() {
188  return true;
189  }
190 
191  size_t getVerticalRes() {
192  return getVerticalRes(_screen);
193  }
194  size_t getVerticalRes(IDirectFBScreen *screen) {
195  int x, y;
196  if (screen) {
197  screen->GetSize(screen, &x, &y);
198  return static_cast<size_t>(x);
199  }
200  return 0;
201  }
202  size_t getHorzRes() {
203  return getHorzRes(_screen);
204  }
205  size_t getHorzRes(IDirectFBScreen *screen) {
206  int x, y;
207  if (screen) {
208  screen->GetSize(screen, &x, &y);
209  return static_cast<size_t>(y);
210  }
211  return 0;
212  }
213 
215  void printDirectFB() {
217  };
218  void printDirectFB(IDirectFB *fb);
219 
221  void printFBSurface() {
223  };
224  void printFBSurface(IDirectFBSurface *surface);
225 
227  void printFBFont() {
229  };
230  void printFBFont(IDirectFBFont *font);
231 
233  void printFBDisplay() {
235  };
236  void printFBDisplay(IDirectFBDisplayLayer *display);
237 
238  void printFBLayer() {
240  };
241  void printFBDisplayLayer(IDirectFBDisplayLayer *layer);
242 
244  void printFBScreen() {
246  };
247  void printFBScreen(IDirectFBScreen *screen);
248 
252  };
253  void printFBInputDevice(IDirectFBInputDevice *input);
254 
255 protected:
256  void printAccelerationMask(DFBAccelerationMask mask);
257  void printSurfaceBlittingFlags(DFBSurfaceBlittingFlags flags);
258  void printSurfaceDrawingFlags(DFBSurfaceDrawingFlags flags);
259  void printGrapbicsDriverIndo(DFBGraphicsDriverInfo *driver);
260  void printSurfaceDescriptionFlags(DFBSurfaceDescriptionFlags flags);
261  void printSurfaceCapabilities(DFBSurfaceCapabilities caps);
262  void printSurfacePixelFormat(DFBSurfacePixelFormat format);
263  void printDisplayLayerTypeFlags(DFBDisplayLayerTypeFlags flags);
264  void printDisplayLayerCapabilities(DFBDisplayLayerCapabilities caps);
265  void printfScreenCapabilities(DFBScreenCapabilities caos);
266  void printDisplayLayerConfig(DFBDisplayLayerConfig *config);
267  void printDisplayLayerBufferMode(DFBDisplayLayerBufferMode mode);
268 
269  void printColor(DFBColor color);
270  // void printFBSurfaceHintFlags(DFBSurfaceHintFlags flags);
271 
272  IDirectFB *_dfb;
273  IDirectFBSurface *_surface;
274  IDirectFBInputDevice *_keyboard;
275  IDirectFBEventBuffer *_keybuffer;
276  IDirectFBImageProvider *_provider;
277  IDirectFBFont *_font;
278  IDirectFBDisplayLayer *_layer;
279  IDirectFBScreen *_screen;
280 };
281 
282 } // namespace directfb
283 } // namespace renderer
284 } // namespace gnash
285 
286 #endif // end of __DIRECTFB_DEVICE_H__
287 
288 // local Variables:
289 // mode: C++
290 // indent-tabs-mode: nil
291 // End:
gnash::LogFile::getDefaultInstance
static LogFile & getDefaultInstance()
Definition: log.cpp:77
gnash::renderer::directfb::DirectFBDevice::printFBInputDevice
void printFBInputDevice()
print the data in a DirectFBInputDevice
Definition: DirectFBDevice.h:250
gnash::renderer::directfb::DirectFBDevice::isBufferDestroyed
bool isBufferDestroyed()
Are buffers destroyed ?
Definition: DirectFBDevice.h:108
gnash::renderer::directfb::DirectFBDevice::printGrapbicsDriverIndo
void printGrapbicsDriverIndo(DFBGraphicsDriverInfo *driver)
Definition: DirectFBDevice.cpp:855
gnash::renderer::GnashDevice::native_window_t
long native_window_t
Definition: GnashDevice.h:43
gnash::renderer::directfb::DirectFBDevice::getSurfaceID
int getSurfaceID()
Definition: DirectFBDevice.h:113
gnash::renderer::directfb::DirectFBDevice::printFBScreen
void printFBScreen()
print the data in a DirectFBFont
Definition: DirectFBDevice.h:244
gnash::renderer::directfb::DirectFBDevice::getWidth
size_t getWidth(IDirectFBSurface *surface)
Definition: DirectFBDevice.h:128
gnash::renderer::directfb::DirectFBDevice::_font
IDirectFBFont * _font
Definition: DirectFBDevice.h:277
gnash::renderer::directfb::DirectFBDevice::printFBFont
void printFBFont()
print the data in a DirectFBFont
Definition: DirectFBDevice.h:227
gnash::renderer::directfb::DirectFBDevice::getErrorString
const char * getErrorString(int error)
Return a string with the error code as text, instead of a numeric value.
Definition: DirectFBDevice.cpp:586
dbglogfile
#define dbglogfile
Definition: gtkext.cpp:48
gnash::renderer::directfb::DirectFBDevice::_layer
IDirectFBDisplayLayer * _layer
Definition: DirectFBDevice.h:278
gnash::renderer::directfb::DirectFBDevice::printDisplayLayerConfig
void printDisplayLayerConfig(DFBDisplayLayerConfig *config)
Definition: DirectFBDevice.cpp:201
gnash::renderer::directfb::DirectFBDevice::getVerticalRes
size_t getVerticalRes(IDirectFBScreen *screen)
Definition: DirectFBDevice.h:194
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::renderer::directfb::DirectFBDevice::_screen
IDirectFBScreen * _screen
Definition: DirectFBDevice.h:279
gnash::LogFile
Definition: log.h:64
gnash::renderer::directfb::DirectFBDevice::printColor
void printColor(DFBColor color)
Definition: DirectFBDevice.cpp:1195
_
#define _(String)
Definition: log.h:44
Renderer.h
gnash::renderer::directfb::DirectFBDevice::printDisplayLayerCapabilities
void printDisplayLayerCapabilities(DFBDisplayLayerCapabilities caps)
Definition: DirectFBDevice.cpp:404
gnash::renderer::directfb::DirectFBDevice::printSurfaceCapabilities
void printSurfaceCapabilities(DFBSurfaceCapabilities caps)
Definition: DirectFBDevice.cpp:984
gnash::renderer::GnashDevice::dtype_t
dtype_t
The list of supported device types.
Definition: GnashDevice.h:48
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::renderer::directfb::DirectFBDevice::getVerticalRes
size_t getVerticalRes()
Definition: DirectFBDevice.h:191
GNASH_REPORT_FUNCTION
#define GNASH_REPORT_FUNCTION
Definition: log.h:452
gnash::renderer::directfb::DirectFBDevice::printFBSurface
void printFBSurface()
print the data in a DirectFBSurface
Definition: DirectFBDevice.h:221
gnash::renderer::directfb::DirectFBDevice::printFBDisplay
void printFBDisplay()
print the data in a DirectFBDisplay
Definition: DirectFBDevice.h:233
gnash::renderer::directfb::DirectFBDevice::getID
int getID()
Get the window ID handle.
Definition: DirectFBDevice.h:104
gnash::renderer::GnashDevice::DIRECTFB
@ DIRECTFB
Definition: GnashDevice.h:48
gnash::renderer::directfb::DirectFBDevice::initDevice
bool initDevice(int argc, char *argv[])
Definition: DirectFBDevice.cpp:107
gnash::renderer::directfb::DirectFBDevice::getHorzRes
size_t getHorzRes()
Definition: DirectFBDevice.h:202
gnash::renderer::directfb::DirectFBDevice::printSurfaceDrawingFlags
void printSurfaceDrawingFlags(DFBSurfaceDrawingFlags flags)
Definition: DirectFBDevice.cpp:823
gnash::renderer::directfb::FONT
const char * FONT
Definition: DirectFBDevice.cpp:50
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::renderer::directfb::DirectFBDevice::supportsRenderer
virtual bool supportsRenderer(rtype_t)
Is the specified renderer supported by this hardware ?
Definition: DirectFBDevice.h:122
gnash::renderer::directfb::DirectFBDevice::getGreenSize
int getGreenSize()
Get the size of the Green pixel.
Definition: DirectFBDevice.h:86
color
const VGfloat color[4]
Definition: testr_gtk.cpp:82
gnash::renderer::directfb::DirectFBDevice::DirectFBDevice
DirectFBDevice()
Definition: DirectFBDevice.cpp:52
gnash::renderer::GnashDevice
Definition: GnashDevice.h:40
gnash::renderer::directfb::DirectFBDevice::getDepth
int getDepth()
Get the depth of the device.
Definition: DirectFBDevice.h:74
gnash::renderer::directfb::DirectFBDevice::getRedSize
int getRedSize()
Get the size of the Red pixel.
Definition: DirectFBDevice.h:83
gnash::renderer::directfb::DirectFBDevice::printDisplayLayerBufferMode
void printDisplayLayerBufferMode(DFBDisplayLayerBufferMode mode)
Definition: DirectFBDevice.cpp:218
gnash::key::code
code
Definition: GnashKey.h:44
gnash::renderer::directfb::DirectFBDevice::getBlueSize
int getBlueSize()
Get the size of the Blue pixel.
Definition: DirectFBDevice.h:89
gnash::renderer::directfb::DirectFBDevice::_keybuffer
IDirectFBEventBuffer * _keybuffer
Definition: DirectFBDevice.h:275
gnash::renderer::directfb::DirectFBDevice::printSurfaceBlittingFlags
void printSurfaceBlittingFlags(DFBSurfaceBlittingFlags flags)
Definition: DirectFBDevice.cpp:759
gnash::renderer::directfb::DirectFBDevice::getType
dtype_t getType()
Definition: DirectFBDevice.h:51
gnash::renderer::directfb::DirectFBDevice
Definition: DirectFBDevice.h:44
gnash::renderer::directfb::DirectFBDevice::printAccelerationMask
void printAccelerationMask(DFBAccelerationMask mask)
Definition: DirectFBDevice.cpp:715
gnash::renderer::directfb::DirectFBDevice::_dfb
IDirectFB * _dfb
Definition: DirectFBDevice.h:272
gnash::renderer::directfb::DirectFBDevice::printFBLayer
void printFBLayer()
Definition: DirectFBDevice.h:238
gnash::renderer::directfb::DirectFBDevice::isContextSingleBuffered
bool isContextSingleBuffered()
Definition: DirectFBDevice.h:164
gnash::renderer::directfb::DirectFBDevice::getHorzRes
size_t getHorzRes(IDirectFBScreen *screen)
Definition: DirectFBDevice.h:205
gnash::renderer::directfb::DirectFBDevice::isNativeRender
bool isNativeRender()
Is this renderering natively.
Definition: DirectFBDevice.h:187
gnash::renderer::directfb::DirectFBDevice::getHeight
size_t getHeight()
Get the Height of the device.
Definition: DirectFBDevice.h:70
gnash::renderer::directfb::DirectFBDevice::isSurfaceBackBuffered
bool isSurfaceBackBuffered()
Definition: DirectFBDevice.h:144
gnash::renderer::directfb::DirectFBDevice::printDirectFB
void printDirectFB()
print the data in a DirectFB
Definition: DirectFBDevice.h:215
log.h
gnash::renderer::directfb::DirectFBDevice::getWidth
size_t getWidth()
Get the width of the device.
Definition: DirectFBDevice.h:66
gnash::renderer::directfb::DirectFBDevice::~DirectFBDevice
~DirectFBDevice()
Definition: DirectFBDevice.cpp:82
gnash::renderer::directfb::DirectFBDevice::attachWindow
bool attachWindow(GnashDevice::native_window_t window)
Definition: DirectFBDevice.cpp:193
gnash::renderer::directfb::DirectFBDevice::_keyboard
IDirectFBInputDevice * _keyboard
Definition: DirectFBDevice.h:274
gnashconfig.h
gnash::renderer::directfb::DirectFBDevice::printSurfaceDescriptionFlags
void printSurfaceDescriptionFlags(DFBSurfaceDescriptionFlags flags)
Definition: DirectFBDevice.cpp:942
gnash::config
struct lirc_config * config
Definition: lirc_ext.cpp:43
gnash::renderer::directfb::DirectFBDevice::isContextBackBuffered
bool isContextBackBuffered()
Definition: DirectFBDevice.h:175
gnash::renderer::directfb::DirectFBDevice::isSingleBuffered
bool isSingleBuffered()
Is this device single buffered.
Definition: DirectFBDevice.h:93
gnash::renderer::directfb::DirectFBDevice::printSurfacePixelFormat
void printSurfacePixelFormat(DFBSurfacePixelFormat format)
Definition: DirectFBDevice.cpp:1056
gnash::renderer::directfb::DirectFBDevice::getContextID
int getContextID()
Definition: DirectFBDevice.h:155
gnash::renderer::directfb::DirectFBDevice::_provider
IDirectFBImageProvider * _provider
Definition: DirectFBDevice.h:276
gnash::renderer::directfb::DirectFBDevice::_surface
IDirectFBSurface * _surface
Definition: DirectFBDevice.h:273
DirectFBDevice.h
GnashDevice.h
gnash::renderer::GnashDevice::rtype_t
rtype_t
The list of supported renders that use devices.
Definition: GnashDevice.h:46
gnash::renderer::directfb::DirectFBDevice::getHeight
size_t getHeight(IDirectFBSurface *surface)
Definition: DirectFBDevice.h:136
GnashException.h
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::renderer::directfb::DirectFBDevice::printfScreenCapabilities
void printfScreenCapabilities(DFBScreenCapabilities caos)
Definition: DirectFBDevice.cpp:529
gnash::renderer::directfb::DirectFBDevice::printFBDisplayLayer
void printFBDisplayLayer(IDirectFBDisplayLayer *layer)
gnash::renderer::directfb::DirectFBDevice::printDisplayLayerTypeFlags
void printDisplayLayerTypeFlags(DFBDisplayLayerTypeFlags flags)
Definition: DirectFBDevice.cpp:558